BP_REST_Activity_Endpoint::get_collection_params()
Get the query params for collections of plugins.
Description Description
Return Return
(array)
Source Source
File: bp-activity/classes/class-bp-rest-activity-endpoint.php
public function get_collection_params() {
$params = parent::get_collection_params();
$params['context']['default'] = 'view';
$params['exclude'] = array(
'description' => __( 'Ensure result set excludes specific IDs.', 'buddypress' ),
'default' => array(),
'type' => 'array',
'items' => array( 'type' => 'integer' ),
'sanitize_callback' => 'wp_parse_id_list',
'validate_callback' => 'rest_validate_request_arg',
);
$params['include'] = array(
'description' => __( 'Ensure result set includes specific IDs.', 'buddypress' ),
'default' => array(),
'type' => 'array',
'items' => array( 'type' => 'integer' ),
'sanitize_callback' => 'wp_parse_id_list',
'validate_callback' => 'rest_validate_request_arg',
);
$params['order'] = array(
'description' => __( 'Order sort attribute ascending or descending.', 'buddypress' ),
'default' => 'desc',
'type' => 'string',
'enum' => array( 'asc', 'desc' ),
'sanitize_callback' => 'sanitize_key',
'validate_callback' => 'rest_validate_request_arg',
);
$params['after'] = array(
'description' => __( 'Limit result set to items published after a given ISO8601 compliant date.', 'buddypress' ),
'type' => 'string',
'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg',
);
$params['user_id'] = array(
'description' => __( 'Limit result set to items created by a specific user (ID).', 'buddypress' ),
'default' => 0,
'type' => 'integer',
'sanitize_callback' => 'absint',
'validate_callback' => 'rest_validate_request_arg',
);
$params['status'] = array(
'description' => __( 'Limit result set to items with a specific status.', 'buddypress' ),
'default' => 'ham_only',
'type' => 'string',
'enum' => array( 'ham_only', 'spam_only', 'all' ),
'sanitize_callback' => 'sanitize_key',
'validate_callback' => 'rest_validate_request_arg',
);
$params['group_id'] = array(
'description' => __( 'Limit result set to items created by a specific group.', 'buddypress' ),
'default' => 0,
'type' => 'integer',
'sanitize_callback' => 'absint',
'validate_callback' => 'rest_validate_request_arg',
);
$params['site_id'] = array(
'description' => __( 'Limit result set to items created by a specific site.', 'buddypress' ),
'default' => 0,
'type' => 'integer',
'sanitize_callback' => 'absint',
'validate_callback' => 'rest_validate_request_arg',
);
$params['primary_id'] = array(
'description' => __( 'Limit result set to items with a specific prime association ID.', 'buddypress' ),
'default' => 0,
'type' => 'integer',
'sanitize_callback' => 'absint',
'validate_callback' => 'rest_validate_request_arg',
);
$params['secondary_id'] = array(
'description' => __( 'Limit result set to items with a specific secondary association ID.', 'buddypress' ),
'default' => 0,
'type' => 'integer',
'sanitize_callback' => 'absint',
'validate_callback' => 'rest_validate_request_arg',
);
$params['component'] = array(
'description' => __( 'Limit result set to items with a specific active BuddyPress component.', 'buddypress' ),
'type' => 'string',
'enum' => array_keys( buddypress()->active_components ),
'sanitize_callback' => 'sanitize_key',
'validate_callback' => 'rest_validate_request_arg',
);
$params['type'] = array(
'description' => __( 'Limit result set to items with a specific activity type.', 'buddypress' ),
'type' => 'string',
'enum' => array_keys( bp_activity_get_types() ),
'sanitize_callback' => 'sanitize_key',
'validate_callback' => 'rest_validate_request_arg',
);
$params['display_comments'] = array(
'description' => __( 'No comments by default, stream for within stream display, threaded for below each activity item.', 'buddypress' ),
'default' => '',
'type' => 'string',
'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_activity_collection_params', $params );
}
Changelog Changelog
| Version | Description |
|---|---|
| 5.0.0 | Introduced. |