get_body(), true ); return \outbox\handle_activity( $actor_slug, $activity ); } function get_outbox( $request ) { $actor_slug = $request['actor']; return \outbox\get_outbox( $actor_slug ); } function get_object( $request ) { $id = $request['id']; return \objects\get_object( $id ); } function get_activity( $request ) { $id = $request['id']; return \activities\get_activity( $id ); } function get_following( $request ) { $actor_slug = $request['actor']; return \following\get_following_collection( $actor_slug ); } function get_followers( $request ) { $actor_slug = $request['actor']; return \followers\get_followers_collection( $actor_slug ); } function get_likes( $request ) { $object_id = $request['object']; return \likes\get_likes_collection( $object_id ); } function get_shares( $request ) { $object_id = $request['object']; return \shares\get_shares_collection( $object_id ); } function register_routes() { register_rest_route( 'pterotype/v1', '/actor/(?P[a-zA-Z0-9-]+)/outbox', array( 'methods' => 'POST', 'callback' => __NAMESPACE__ . '\post_to_outbox', ) ); register_rest_route( 'pterotype/v1', '/actor/(?P[a-zA-Z0-9-]+/outbox', array( 'methods' => 'POST', 'callback' => __NAMESPACE__ . '\get_outbox', ) ); register_rest_route( 'pterotype/v1', '/actor/(?P[a-zA-Z0-9-]+)', array( 'methods' => 'GET', 'callback' => __NAMESPACE__ . '\get_actor', ) ); register_rest_route( 'pterotype/v1', '/object/(?P[0-9]+)', array( 'methods' => 'GET', 'callback' => __NAMESPACE__ . '\get_object', ) ); register_rest_route( 'pterotype/v1', '/activity/(?P[0-9]+)', array( 'methods' => 'GET', 'callback' => __NAMESPACE__ . '\get_activity', ) ); register_rest_route( 'pterotype/v1', '/actor/(?P[a-zA-Z0-9-]+)/following', array( 'methods' => 'GET', 'callback' => __NAMESPACE__ . '\get_following', ) ); register_rest_route( 'pterotype/v1', '/actor/(?P[a-zA-Z0-9-]+)/followers', array( 'methods' => 'GET', 'callback' => __NAMESPACE__ . '\get_followers', ) ); register_rest_route( 'pterotype/v1', '/object/(?P[0-9]+)/likes', array( 'methods' => 'GET', 'callback' => __NAMESPACE__ . '\get_likes', ) ); register_rest_route( 'pterotype/v1', '/object/(?P[0-9]+)/shares', array( 'methods' => 'GET', 'callback' => __NAMESPACE__ . '\get_shares', ) ); } ?>