<?php

namespace ModulesGarden\Servers\OpenXchange\App\Http\Actions;

use ModulesGarden\Servers\OpenXchange\App\Libs\RestApi;
use ModulesGarden\Servers\OpenXchange\Core\App\Controllers\Instances\AddonController;


class TestConnection extends AddonController
{
    public function execute($params = null)
    {
        try
        {
            $api = new RestApi($params);
            $api->listContexts();
        }
        catch (\Exception $ex)
        {
            return ['error' => $ex->getMessage()];
        }

        return ['success' => true];
    }
}
