Files
api/services/nginx/app/classes/cloud_shelly_transport.php
T

36 lines
824 B
PHP

<?php
namespace classes;
require_once WD . '/interfaces/shelly_transport_i.php';
require_once WD . '/classes/shelly.php';
use interfaces\shelly_transport_i;
class cloud_shelly_transport implements shelly_transport_i
{
public function __construct(private readonly ?shelly $client = null)
{
}
private function client(): shelly
{
return $this->client ?? new shelly();
}
public function requireModuleEnabled(): void
{
$this->client()->requireModuleEnabled();
}
public function requireValidSecretKey(): void
{
$this->client()->requireValidSecretKey();
}
public function sendPostRequest(string $endpoint, array $data, ?int $department_id = null): array|object|null
{
return $this->client()->sendPostRequest($endpoint, $data);
}
}