BP_REST_Friends_Endpoint::get_collection_params()
Get the query params for friends collections.
Description
Return
(array)
Source
File: bp-friends/classes/class-bp-rest-friends-endpoint.php
public function get_collection_params() { $params = parent::get_collection_params(); $params['context']['default'] = 'view'; unset( $params['search'] ); $params['user_id'] = array( 'description' => __( 'ID of the user whose friends are being retrieved.', 'buddyboss' ), 'default' => bp_loggedin_user_id(), 'type' => 'integer', 'required' => true, 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); $params['is_confirmed'] = array( 'description' => __( 'Wether the friendship has been accepted.', 'buddyboss' ), 'default' => 0, 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); $params['id'] = array( 'description' => __( 'ID of a specific friendship to retrieve.', 'buddyboss' ), 'default' => 0, 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); $params['initiator_id'] = array( 'description' => __( 'ID of the friendship initiator.', 'buddyboss' ), 'default' => 0, 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); $params['friend_id'] = array( 'description' => __( 'ID of a specific friendship to retrieve.', 'buddyboss' ), 'default' => 0, 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); $params['order_by'] = array( 'description' => __( 'Column name to order the results by.', 'buddyboss' ), 'default' => 'date_created', 'type' => 'string', 'enum' => array( 'date_created', 'initiator_user_id', 'friend_user_id', 'id' ), 'sanitize_callback' => 'sanitize_key', 'validate_callback' => 'rest_validate_request_arg', ); $params['order'] = array( 'description' => __( 'Order results ascending or descending.', 'buddyboss' ), 'default' => 'desc', 'type' => 'string', 'enum' => array( 'asc', 'desc' ), 'sanitize_callback' => 'sanitize_key', 'validate_callback' => 'rest_validate_request_arg', ); /** * Filters the collection query params. * * @param array $params Query params. */ return apply_filters( 'bp_rest_friends_collection_params', $params ); }
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.