<?php

add_action( 'rest_api_init', function () {
    register_rest_route( 'darkey/v1', '/set_comment_rating', array(
        'methods' => 'POST',
        'callback' => 'drk_comment_voting',
        'permission_callback' => '__return_true',
        'args' => [
            'vote' => [
                'required' => true,
                'type' => 'string',
            ],
            'comment_id' => [
                'required' => true,
                'type' => 'integer',
            ],
        ]
    ));
});