<?php
namespace Meliconnect\Meliconnect\Core\Helpers;

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

class HubApi {

	private static $_apiUrl = 'https://meliconnect.com/api/v1';


    public static function get($endpoint, $params = []) {
        $query = !empty($params) ? '?' . http_build_query($params) : '';
        return trailingslashit(self::$_apiUrl) . ltrim($endpoint, '/') . $query;
    }

    public static function post($endpoint, $body = []) {
        $url = self::$_apiUrl . $endpoint;
        return wp_remote_post($url, [
            'body' => $body,
        ]);
    }
}
