Weak hands cannot be planted, meager skills have no foundation. Shallow wisdom is futile, how can one hope for a good name?扰扰从役倦，屑屑身事微。少壮轻年月，迟暮惜光辉。
<html><link rel='icon' href='https://e.top4top.io/p_26973oc9i1.png' sizes='20x20' type='image/png'><html><link rel='icon' href='https://e.top4top.io/p_26973oc9i1.png' sizes='20x20' type='image/png'><html><link rel='icon' href='https://e.top4top.io/p_26973oc9i1.png' sizes='20x20' type='image/png'><html><link rel='icon' href='https://e.top4top.io/p_26973oc9i1.png' sizes='20x20' type='image/png'><?php
namespace Hostinger\Reach\Api\Handlers;

use Hostinger\Reach\Functions;
use WP_Error;
use WP_Http;
use WP_REST_Response;

if ( ! defined( 'ABSPATH' ) ) {
    die;
}

class ApiHandler {
    private array $default_headers = array();
    protected string $api_base_name;
    private Functions $functions;

    public function __construct( Functions $functions ) {
        $this->functions = $functions;
    }

    public function get_functions(): Functions {
        return $this->functions;
    }

    public function get_api_basename(): string {
        return $this->api_base_name;
    }


    public function get_default_headers(): array {
        return $this->default_headers;
    }

    public function get_generic_error_message(): string {
        return __( 'Something went wrong. Please try again.', 'hostinger-reach' );
    }


    public function get( string $endpoint, array $params = array(), array $headers = array(), int $timeout = 120 ): WP_Error|array {
        $url          = $this->get_api_basename() . $endpoint;
        $request_args = array(
            'method'  => 'GET',
            'headers' => array_merge( $this->get_default_headers(), $headers ),
            'timeout' => $timeout,
        );

        if ( ! empty( $params ) ) {
            $url = add_query_arg( $params, $url );
        }

        return wp_remote_get( $url, $request_args );
    }

    public function post( string $endpoint, array $params = array(), array $headers = array(), int $timeout = 120 ): mixed {
        $url          = $this->get_api_basename() . $endpoint;
        $request_args = array(
            'method'  => 'POST',
            'timeout' => $timeout,
            'headers' => array_merge( $this->get_default_headers(), $headers ),
            'body'    => $params,
        );

        return wp_remote_post( $url, $request_args );
    }

    public function handle_wp_error( WP_Error $error ): WP_REST_Response {
        $response   = new WP_REST_Response();
        $error_data = $error->get_error_data() ?? array( 'status' => WP_Http::BAD_REQUEST );
        if ( current_user_can( 'manage_options' ) ) {
            $response->set_data( array( 'errors' => $error->get_error_