BP_REST_Group_Messages_Endpoint::get_item_schema()

Get the message schema, conforming to JSON Schema.

Description

Return

(array)

Source

File: bp-messages/classes/class-bp-rest-group-messages-endpoint.php

994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
public function get_item_schema() {
    $schema = array(
        '$schema'    => 'http://json-schema.org/draft-04/schema#',
        'title'      => 'bp_messages',
        'type'       => 'object',
        'properties' => array(
            'message' => array(
                'context'     => array( 'view', 'edit' ),
                'description' => __( 'Information for the user.', 'buddyboss' ),
                'type'        => 'string',
            ),
            'data'    => array(
                'context'     => array( 'view', 'edit' ),
                'description' => __( 'Message thread', 'buddyboss' ),
                'readonly'    => true,
                'type'        => 'object',
                'properties'  => array(),
            ),
        ),
    );
 
    $schema['properties']['data']['properties'] = $this->message_endppoint->get_item_schema()['properties'];
 
    /**
     * Filters the message schema.
     *
     * @param array $schema The endpoint schema.
     *
     * @since 0.1.0
     */
    return apply_filters( 'bp_rest_message_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.