PHP Class BP_REST_Activity_Controller, BP-REST

Class BP_REST_Activity_Controller
Mostrar archivo Open project: buddypress/BP-REST Class Usage Examples

Public Methods

Method Description
__construct ( ) Constructor.
get_collection_params ( ) : array Get the query params for collections of plugins.
get_item ( WP_REST_Request $request ) : WP_REST_Request | WP_Error Retrieve activity.
get_item_permissions_check ( WP_REST_Request $request ) : boolean Check if a given request has access to get information about a specific activity.
get_item_schema ( ) : array Get the plugin schema, conforming to JSON Schema.
get_items ( WP_REST_Request $request ) : WP_REST_Request Retrieve activities.
get_items_permissions_check ( WP_REST_Request $request ) : WP_Error | boolean Check if a given request has access to activity items.
prepare_item_for_response ( stdClass $activity, WP_REST_Request $request, boolean $is_raw = false ) : WP_REST_Response Prepares activity data for return as an object.
register_routes ( ) Register the plugin routes.

Protected Methods

Method Description
prepare_date_response ( string $date_gmt, string | null $date = null ) : string | null Convert the input date to RFC3339 format.
prepare_links ( array $activity ) : array Prepare links for the request.

Method Details

__construct() public method

Constructor.
Since: 0.1.0
public __construct ( )

get_collection_params() public method

Get the query params for collections of plugins.
Since: 0.1.0
public get_collection_params ( ) : array
return array

get_item() public method

Retrieve activity.
Since: 0.1.0
public get_item ( WP_REST_Request $request ) : WP_REST_Request | WP_Error
$request WP_REST_Request
return WP_REST_Request | WP_Error Plugin object data on success, WP_Error otherwise.

get_item_permissions_check() public method

Check if a given request has access to get information about a specific activity.
Since: 0.1.0
public get_item_permissions_check ( WP_REST_Request $request ) : boolean
$request WP_REST_Request Full data about the request.
return boolean

get_item_schema() public method

Get the plugin schema, conforming to JSON Schema.
Since: 0.1.0
public get_item_schema ( ) : array
return array

get_items() public method

Retrieve activities.
Since: 0.1.0
public get_items ( WP_REST_Request $request ) : WP_REST_Request
$request WP_REST_Request
return WP_REST_Request List of activity object data.

get_items_permissions_check() public method

Check if a given request has access to activity items.
Since: 0.1.0
public get_items_permissions_check ( WP_REST_Request $request ) : WP_Error | boolean
$request WP_REST_Request Full data about the request.
return WP_Error | boolean

prepare_date_response() protected method

Convert the input date to RFC3339 format.
protected prepare_date_response ( string $date_gmt, string | null $date = null ) : string | null
$date_gmt string
$date string | null Optional. Date object.
return string | null ISO8601/RFC3339 formatted datetime.

prepare_item_for_response() public method

Prepares activity data for return as an object.
Since: 0.1.0
public prepare_item_for_response ( stdClass $activity, WP_REST_Request $request, boolean $is_raw = false ) : WP_REST_Response
$activity stdClass Activity data.
$request WP_REST_Request
$is_raw boolean Optional, not used. Defaults to false.
return WP_REST_Response

register_routes() public method

Register the plugin routes.
Since: 0.1.0
public register_routes ( )