|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace MessageBird\Objects; |
| 4 | + |
| 5 | +/** |
| 6 | + * Class Message |
| 7 | + * |
| 8 | + * @property int $protocolId |
| 9 | + * @package MessageBird\Objects |
| 10 | + */ |
| 11 | +class MessageResponse extends Base |
| 12 | +{ |
| 13 | + /** |
| 14 | + * An unique random ID which is created on the MessageBird |
| 15 | + * platform and is returned upon creation of the object. |
| 16 | + * |
| 17 | + * @var string |
| 18 | + */ |
| 19 | + public $id; |
| 20 | + |
| 21 | + /** |
| 22 | + * The URL of the created object. |
| 23 | + * |
| 24 | + * @var string |
| 25 | + */ |
| 26 | + public $href; |
| 27 | + |
| 28 | + /** |
| 29 | + * Tells you if the message is sent or received. |
| 30 | + * mt: mobile terminated (sent to mobile) |
| 31 | + * mo: mobile originated (received from mobile) |
| 32 | + * |
| 33 | + * @var string |
| 34 | + */ |
| 35 | + public $direction; |
| 36 | + |
| 37 | + /** |
| 38 | + * The type of message. Values can be: sms, binary, premium, or flash |
| 39 | + * |
| 40 | + * @var string |
| 41 | + */ |
| 42 | + public $type; |
| 43 | + |
| 44 | + /** |
| 45 | + * The sender of the message. This can be a telephone number |
| 46 | + * (including country code) or an alphanumeric string. In case |
| 47 | + * of an alphanumeric string, the maximum length is 11 characters. |
| 48 | + * |
| 49 | + * @var string |
| 50 | + */ |
| 51 | + public $originator; |
| 52 | + |
| 53 | + /** |
| 54 | + * The body of the SMS message. |
| 55 | + * |
| 56 | + * @var string |
| 57 | + */ |
| 58 | + public $body; |
| 59 | + |
| 60 | + /** |
| 61 | + * A client reference. Here you can put your own reference, |
| 62 | + * like your internal reference. |
| 63 | + * |
| 64 | + * @var string |
| 65 | + */ |
| 66 | + public $reference; |
| 67 | + |
| 68 | + /** |
| 69 | + * The amount of seconds that the message is valid. |
| 70 | + * If a message is not delivered within this time, |
| 71 | + * the message will be discarded. |
| 72 | + * |
| 73 | + * @var int |
| 74 | + */ |
| 75 | + public $validity; |
| 76 | + |
| 77 | + /** |
| 78 | + * The SMS route that is used to send the message. This is for |
| 79 | + * advanced users. |
| 80 | + * |
| 81 | + * @var int |
| 82 | + */ |
| 83 | + public $gateway; |
| 84 | + |
| 85 | + /** |
| 86 | + * An associative array with extra information. Is only used when a binary or premium |
| 87 | + * message is sent. |
| 88 | + * |
| 89 | + * @var array |
| 90 | + */ |
| 91 | + public $typeDetails = []; |
| 92 | + |
| 93 | + /** |
| 94 | + * The datacoding used, can be plain or unicode |
| 95 | + * |
| 96 | + * @var string |
| 97 | + */ |
| 98 | + public $datacoding; |
| 99 | + |
| 100 | + /** |
| 101 | + * Indicates the message type. 1 is a normal message, 0 is a flash message. |
| 102 | + * |
| 103 | + * @var int |
| 104 | + */ |
| 105 | + public $mclass = 1; |
| 106 | + |
| 107 | + /** |
| 108 | + * The scheduled date and time of the message in RFC3339 format (Y-m-d\TH:i:sP) |
| 109 | + * |
| 110 | + * @var string|null |
| 111 | + */ |
| 112 | + public $scheduledDatetime; |
| 113 | + |
| 114 | + /** |
| 115 | + * The date and time of the creation of the message in RFC3339 format (Y-m-d\TH:i:sP) |
| 116 | + * @var string |
| 117 | + */ |
| 118 | + public $createdDatetime; |
| 119 | + |
| 120 | + /** |
| 121 | + * An array of recipients |
| 122 | + * |
| 123 | + * @var Recipients |
| 124 | + */ |
| 125 | + public $recipients; |
| 126 | + |
| 127 | + /** |
| 128 | + * @param mixed $object |
| 129 | + * |
| 130 | + * @return $this |
| 131 | + */ |
| 132 | + public function loadFromArray($object) |
| 133 | + { |
| 134 | + parent::loadFromArray($object); |
| 135 | + |
| 136 | + $this->recipients = (new Recipients())->loadFromArray($this->recipients); |
| 137 | + $this->typeDetails = get_object_vars($this->typeDetails); |
| 138 | + |
| 139 | + return $this; |
| 140 | + } |
| 141 | +} |
0 commit comments