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

860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
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.