<?php

use api\classes\API_inserve;

session_start();

require_once "{$_SERVER['DOCUMENT_ROOT']}/api/classes/API_inserve.php";


$API_inserve = new API_inserve();

if ($API_inserve->request_method === 'GET' || $API_inserve->request_method === 'POST') {
    $API_inserve->checkPermissions('servers', 'RW');
    $API_inserve->setupConnection();

    $API_inserve->syncCompaniesFromSentri();
    $API_inserve->syncServerSubscriptionsToInserve();

    $API_inserve->apiOutput(200, ['success' => 'Sync is done successfully']);
}