Introduced a new GatewayAPI module to handle SMS messaging integration. This includes interfaces, core classes for API interaction, configuration management, and routing for config retrieval and update. Added necessary initializations in `index.php` to integrate the module seamlessly.
44 lines
1.2 KiB
PHP
44 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace interfaces;
|
|
|
|
use Exception;
|
|
|
|
interface gatewayapi_i
|
|
{
|
|
/**
|
|
* Check if the module is enabled
|
|
* @return bool True if the module is enabled, false otherwise
|
|
*/
|
|
public function isEnabled(): bool;
|
|
|
|
/**
|
|
* Require the module to be enabled
|
|
* @throws Exception If the module is not enabled
|
|
*/
|
|
public function requireEnabled(): void;
|
|
|
|
/**
|
|
* Send a message
|
|
* @param array{string} $to The recipient(s) of the message
|
|
* @param string $message The message to be sent
|
|
* @return bool True if the message was sent, false otherwise
|
|
* @throws Exception If the module is not enabled
|
|
* @throws Exception If the message could not be sent
|
|
*/
|
|
public function send(array $to, string $message): bool;
|
|
|
|
/**
|
|
* Send request to the API
|
|
* @param string $url The URL to send the request to
|
|
* @param string $method The HTTP method to use (GET, POST, PUT, DELETE)
|
|
* @param array $data The data to send with the request
|
|
*/
|
|
public function sendRequest(string $url, string $method, array $data = []): array;
|
|
|
|
/**
|
|
* Get the default request headers
|
|
* @return array The default request headers
|
|
*/
|
|
public function getDefaultRequestHeaders(): array;
|
|
} |