Improve adapters datas interface by defining fields and implement real OVH SMS API adapter !

This commit is contained in:
osaajani 2020-01-09 22:23:58 +01:00
parent 4cd1105ae6
commit c4bc7d94c1
7 changed files with 591 additions and 48 deletions

View file

@ -31,6 +31,12 @@
* 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)
*/
public static function meta_datas_help() : string { return 'No datas.'; }
/**
* List of entries we want in datas for the adapter
* @return array : Eachline line is a field as an array with keys : name, title, description, required
*/
public static function meta_datas_fields() : array { return []; }
/**
* Does the implemented service support flash smss
@ -84,7 +90,7 @@
* @param bool $flash : Is the SMS a Flash SMS
* @return mixed Uid of the sended message if send, False else
*/
public function send (string $destination, string $text, bool $flash)
public function send (string $destination, string $text, bool $flash = false)
{
$uid = uniqid();
@ -125,6 +131,17 @@
}
/**
* Method called to verify if the adapter is working correctly
* should be use for exemple to verify that credentials and number are both valid
* @return boolean : False on error, true else
*/
public function test () : bool
{
return true;
}
/**
* Method called on reception of a status update notification for a SMS
* @return mixed : False on error, else array ['uid' => uid of the sms, 'status' => New status of the sms ('unknown', 'delivered', 'failed')]