raspisms/adapters/AdapterInterface.php

65 lines
2.2 KiB
PHP
Raw Normal View History

2019-11-11 21:01:40 +01:00
<?php
2019-11-12 05:18:32 +01:00
namespace adapters;
2019-11-11 21:01:40 +01:00
/**
* Interface for phones adapters
* Phone's adapters allow RaspiSMS to use a platform to communicate with a phone number.
* Its an adapter between internal and external code, as an API, command line software, physical modem, etc.
*
* All Phone Adapters must implement this interface
*/
interface AdapterInterface
{
2019-11-12 05:18:32 +01:00
/**
* Classname of the adapter
*/
public static function meta_classname() : string;
2019-11-11 21:01:40 +01:00
/**
* Name of the adapter.
* It should probably be the name of the service it adapt (e.g : Gammu SMSD, OVH SMS, SIM800L, etc.)
*/
2019-11-12 05:18:32 +01:00
public static function meta_name() : string;
2019-11-11 21:01:40 +01:00
/**
* Description of the adapter.
* A short description of the service the adapter implements.
*/
2019-11-12 05:18:32 +01:00
public static function meta_description() : string;
2019-11-11 21:01:40 +01:00
/**
* Description of the datas expected by the adapter to help the user. (e.g : A list of expecteds Api credentials fields, with name and value)
*/
2019-11-12 05:18:32 +01:00
public static function meta_datas_help() : string;
2019-11-11 21:01:40 +01:00
/**
* Does the implemented service support flash smss
*/
2019-11-12 05:18:32 +01:00
public static function meta_support_flash() : bool;
2019-11-11 21:01:40 +01:00
/**
* Adapter constructor, called when instanciated by RaspiSMS
* @param string $number : Phone number the adapter is used for
* @param json string $datas : JSON string of the datas to configure interaction with the implemented service
*/
2019-11-12 05:18:32 +01:00
public function __construct (string $number, string $datas);
2019-11-11 21:01:40 +01:00
/**
* Method called to send a SMS to a number
* @param string $destination : Phone number to send the sms to
* @param string $text : Text of the SMS to send
* @param bool $flash : Is the SMS a Flash SMS
* @return mixed Uid of the sended message if send, False else
2019-11-11 21:01:40 +01:00
*/
public function send (string $destination, string $text, bool $flash);
2019-11-11 21:01:40 +01:00
/**
* Method called to read unread SMSs of the number
2019-11-11 21:01:40 +01:00
* @return array : Array of the sms reads
*/
public function read () : array;
2019-11-11 21:01:40 +01:00
}