Files
api/services/nginx/app/interfaces/shelly_i.php
T
Jeppe Bundgaard c775ca7b19 Expand Shelly module capabilities with POST requests and device switch management
- Updated `shelly` class to support POST request handling (`sendPostRequest`) and server URL validation.
- Adjusted `shelly_device_state` to handle object-based `status` and `settings`, adding a `populate` method for data initialization.
- Added `shelly_device_switch` helper to manage switching operations via Shelly API.
- Removed unused `api_url` property in `shelly` class.
- Modified `shelly_i` interface with definitions for `requireValidServerUrl` and `sendPostRequest`.
2025-10-15 13:08:27 +02:00

47 lines
1.4 KiB
PHP

<?php
namespace interfaces;
use Exception;
interface shelly_i
{
/**
* Send a request to the shelly api
* @param string $endpoint The endpoint to send the request to (e.g. "latest")
* @param array $data The data to send with the request (e.g. ["key" => "value"])
* @param string $method The method to use for the request (e.g. "GET")
* @return object The response from the shelly module
*/
function sendRequest(string $endpoint, array $data, string $method): object;
/**
* Require the module to be enabled
* @return void
* @throws Exception If the module is not enabled
*/
function requireModuleEnabled(): void;
/**
* Require the secret key to be valid
* @return void
* @throws Exception If the secret key is not valid
*/
function requireValidSecretKey(): void;
/**
* Require the server url to be valid
* @return void
* @throws Exception If the server url is not valid
*/
function requireValidServerUrl(): void;
/**
* Send a POST request to the shelly
* @param string $endpoint The endpoint to send the request to (e.g. "latest")
* @param array $data The data to send with the request (e.g. ["key" => "value"])
* @return array|object|null The response from the shelly
*/
function sendPostRequest(string $endpoint, array $data): array|object|null;
}