From c8d341ba1f4122e01fa1d467fb24b25a7e26993a Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Sun, 3 Jan 2021 20:40:53 +0100 Subject: [PATCH] unify query params --- includes/rest/class-followers.php | 6 +++--- includes/rest/class-following.php | 6 +++--- includes/rest/class-outbox.php | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/includes/rest/class-followers.php b/includes/rest/class-followers.php index 05a7789..cde30a0 100644 --- a/includes/rest/class-followers.php +++ b/includes/rest/class-followers.php @@ -21,7 +21,7 @@ class Followers { */ public static function register_routes() { \register_rest_route( - 'activitypub/1.0', '/users/(?P\d+)/followers', array( + 'activitypub/1.0', '/users/(?P\d+)/followers', array( array( 'methods' => \WP_REST_Server::READABLE, 'callback' => array( '\Activitypub\Rest\Followers', 'get' ), @@ -40,7 +40,7 @@ class Followers { * @return WP_REST_Response */ public static function get( $request ) { - $user_id = $request->get_param( 'id' ); + $user_id = $request->get_param( 'user_id' ); $user = \get_user_by( 'ID', $user_id ); if ( ! $user ) { @@ -87,7 +87,7 @@ class Followers { 'type' => 'integer', ); - $params['id'] = array( + $params['user_id'] = array( 'required' => true, 'type' => 'integer', ); diff --git a/includes/rest/class-following.php b/includes/rest/class-following.php index af48106..4809a9a 100644 --- a/includes/rest/class-following.php +++ b/includes/rest/class-following.php @@ -21,7 +21,7 @@ class Following { */ public static function register_routes() { \register_rest_route( - 'activitypub/1.0', '/users/(?P\d+)/following', array( + 'activitypub/1.0', '/users/(?P\d+)/following', array( array( 'methods' => \WP_REST_Server::READABLE, 'callback' => array( '\Activitypub\Rest\Following', 'get' ), @@ -40,7 +40,7 @@ class Following { * @return WP_REST_Response */ public static function get( $request ) { - $user_id = $request->get_param( 'id' ); + $user_id = $request->get_param( 'user_id' ); $user = \get_user_by( 'ID', $user_id ); if ( ! $user ) { @@ -87,7 +87,7 @@ class Following { 'type' => 'integer', ); - $params['id'] = array( + $params['user_id'] = array( 'required' => true, 'type' => 'integer', ); diff --git a/includes/rest/class-outbox.php b/includes/rest/class-outbox.php index 5aa18f7..d4c0c0a 100644 --- a/includes/rest/class-outbox.php +++ b/includes/rest/class-outbox.php @@ -21,7 +21,7 @@ class Outbox { */ public static function register_routes() { \register_rest_route( - 'activitypub/1.0', '/users/(?P\d+)/outbox', array( + 'activitypub/1.0', '/users/(?P\d+)/outbox', array( array( 'methods' => \WP_REST_Server::READABLE, 'callback' => array( '\Activitypub\Rest\Outbox', 'user_outbox' ), @@ -39,7 +39,7 @@ class Outbox { * @return WP_REST_Response */ public static function user_outbox( $request ) { - $user_id = $request->get_param( 'id' ); + $user_id = $request->get_param( 'user_id' ); $author = \get_user_by( 'ID', $user_id ); if ( ! $author ) { @@ -117,7 +117,7 @@ class Outbox { 'type' => 'integer', ); - $params['id'] = array( + $params['user_id'] = array( 'required' => true, 'type' => 'integer', );