unify query params
This commit is contained in:
parent
46436cb49b
commit
c8d341ba1f
3 changed files with 9 additions and 9 deletions
|
@ -21,7 +21,7 @@ class Followers {
|
||||||
*/
|
*/
|
||||||
public static function register_routes() {
|
public static function register_routes() {
|
||||||
\register_rest_route(
|
\register_rest_route(
|
||||||
'activitypub/1.0', '/users/(?P<id>\d+)/followers', array(
|
'activitypub/1.0', '/users/(?P<user_id>\d+)/followers', array(
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array( '\Activitypub\Rest\Followers', 'get' ),
|
'callback' => array( '\Activitypub\Rest\Followers', 'get' ),
|
||||||
|
@ -40,7 +40,7 @@ class Followers {
|
||||||
* @return WP_REST_Response
|
* @return WP_REST_Response
|
||||||
*/
|
*/
|
||||||
public static function get( $request ) {
|
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 );
|
$user = \get_user_by( 'ID', $user_id );
|
||||||
|
|
||||||
if ( ! $user ) {
|
if ( ! $user ) {
|
||||||
|
@ -87,7 +87,7 @@ class Followers {
|
||||||
'type' => 'integer',
|
'type' => 'integer',
|
||||||
);
|
);
|
||||||
|
|
||||||
$params['id'] = array(
|
$params['user_id'] = array(
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'type' => 'integer',
|
'type' => 'integer',
|
||||||
);
|
);
|
||||||
|
|
|
@ -21,7 +21,7 @@ class Following {
|
||||||
*/
|
*/
|
||||||
public static function register_routes() {
|
public static function register_routes() {
|
||||||
\register_rest_route(
|
\register_rest_route(
|
||||||
'activitypub/1.0', '/users/(?P<id>\d+)/following', array(
|
'activitypub/1.0', '/users/(?P<user_id>\d+)/following', array(
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array( '\Activitypub\Rest\Following', 'get' ),
|
'callback' => array( '\Activitypub\Rest\Following', 'get' ),
|
||||||
|
@ -40,7 +40,7 @@ class Following {
|
||||||
* @return WP_REST_Response
|
* @return WP_REST_Response
|
||||||
*/
|
*/
|
||||||
public static function get( $request ) {
|
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 );
|
$user = \get_user_by( 'ID', $user_id );
|
||||||
|
|
||||||
if ( ! $user ) {
|
if ( ! $user ) {
|
||||||
|
@ -87,7 +87,7 @@ class Following {
|
||||||
'type' => 'integer',
|
'type' => 'integer',
|
||||||
);
|
);
|
||||||
|
|
||||||
$params['id'] = array(
|
$params['user_id'] = array(
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'type' => 'integer',
|
'type' => 'integer',
|
||||||
);
|
);
|
||||||
|
|
|
@ -21,7 +21,7 @@ class Outbox {
|
||||||
*/
|
*/
|
||||||
public static function register_routes() {
|
public static function register_routes() {
|
||||||
\register_rest_route(
|
\register_rest_route(
|
||||||
'activitypub/1.0', '/users/(?P<id>\d+)/outbox', array(
|
'activitypub/1.0', '/users/(?P<user_id>\d+)/outbox', array(
|
||||||
array(
|
array(
|
||||||
'methods' => \WP_REST_Server::READABLE,
|
'methods' => \WP_REST_Server::READABLE,
|
||||||
'callback' => array( '\Activitypub\Rest\Outbox', 'user_outbox' ),
|
'callback' => array( '\Activitypub\Rest\Outbox', 'user_outbox' ),
|
||||||
|
@ -39,7 +39,7 @@ class Outbox {
|
||||||
* @return WP_REST_Response
|
* @return WP_REST_Response
|
||||||
*/
|
*/
|
||||||
public static function user_outbox( $request ) {
|
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 );
|
$author = \get_user_by( 'ID', $user_id );
|
||||||
|
|
||||||
if ( ! $author ) {
|
if ( ! $author ) {
|
||||||
|
@ -117,7 +117,7 @@ class Outbox {
|
||||||
'type' => 'integer',
|
'type' => 'integer',
|
||||||
);
|
);
|
||||||
|
|
||||||
$params['id'] = array(
|
$params['user_id'] = array(
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'type' => 'integer',
|
'type' => 'integer',
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue