PageRenderTime 27ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/sendinblue/api-v3-sdk/lib/Model/SendTransacSms.php

https://gitlab.com/i-have-a-green/digitemis-v3
PHP | 500 lines | 358 code | 26 blank | 116 comment | 3 complexity | fce368718a71b95bf9d063b5f1406e17 MD5 | raw file
  1. <?php
  2. /**
  3. * SendTransacSms
  4. *
  5. * PHP version 5
  6. *
  7. * @category Class
  8. * @package SendinBlue\Client
  9. * @author Swagger Codegen team
  10. * @link https://github.com/swagger-api/swagger-codegen
  11. */
  12. /**
  13. * SendinBlue API
  14. *
  15. * SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/sendinblue **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable |
  16. *
  17. * OpenAPI spec version: 3.0.0
  18. * Contact: contact@sendinblue.com
  19. * Generated by: https://github.com/swagger-api/swagger-codegen.git
  20. * Swagger Codegen version: 2.4.12
  21. */
  22. /**
  23. * NOTE: This class is auto generated by the swagger code generator program.
  24. * https://github.com/swagger-api/swagger-codegen
  25. * Do not edit the class manually.
  26. */
  27. namespace SendinBlue\Client\Model;
  28. use \ArrayAccess;
  29. use \SendinBlue\Client\ObjectSerializer;
  30. /**
  31. * SendTransacSms Class Doc Comment
  32. *
  33. * @category Class
  34. * @package SendinBlue\Client
  35. * @author Swagger Codegen team
  36. * @link https://github.com/swagger-api/swagger-codegen
  37. */
  38. class SendTransacSms implements ModelInterface, ArrayAccess
  39. {
  40. const DISCRIMINATOR = null;
  41. /**
  42. * The original name of the model.
  43. *
  44. * @var string
  45. */
  46. protected static $swaggerModelName = 'sendTransacSms';
  47. /**
  48. * Array of property to type mappings. Used for (de)serialization
  49. *
  50. * @var string[]
  51. */
  52. protected static $swaggerTypes = [
  53. 'sender' => 'string',
  54. 'recipient' => 'string',
  55. 'content' => 'string',
  56. 'type' => 'string',
  57. 'tag' => 'string',
  58. 'webUrl' => 'string'
  59. ];
  60. /**
  61. * Array of property to format mappings. Used for (de)serialization
  62. *
  63. * @var string[]
  64. */
  65. protected static $swaggerFormats = [
  66. 'sender' => null,
  67. 'recipient' => null,
  68. 'content' => null,
  69. 'type' => null,
  70. 'tag' => null,
  71. 'webUrl' => 'url'
  72. ];
  73. /**
  74. * Array of property to type mappings. Used for (de)serialization
  75. *
  76. * @return array
  77. */
  78. public static function swaggerTypes()
  79. {
  80. return self::$swaggerTypes;
  81. }
  82. /**
  83. * Array of property to format mappings. Used for (de)serialization
  84. *
  85. * @return array
  86. */
  87. public static function swaggerFormats()
  88. {
  89. return self::$swaggerFormats;
  90. }
  91. /**
  92. * Array of attributes where the key is the local name,
  93. * and the value is the original name
  94. *
  95. * @var string[]
  96. */
  97. protected static $attributeMap = [
  98. 'sender' => 'sender',
  99. 'recipient' => 'recipient',
  100. 'content' => 'content',
  101. 'type' => 'type',
  102. 'tag' => 'tag',
  103. 'webUrl' => 'webUrl'
  104. ];
  105. /**
  106. * Array of attributes to setter functions (for deserialization of responses)
  107. *
  108. * @var string[]
  109. */
  110. protected static $setters = [
  111. 'sender' => 'setSender',
  112. 'recipient' => 'setRecipient',
  113. 'content' => 'setContent',
  114. 'type' => 'setType',
  115. 'tag' => 'setTag',
  116. 'webUrl' => 'setWebUrl'
  117. ];
  118. /**
  119. * Array of attributes to getter functions (for serialization of requests)
  120. *
  121. * @var string[]
  122. */
  123. protected static $getters = [
  124. 'sender' => 'getSender',
  125. 'recipient' => 'getRecipient',
  126. 'content' => 'getContent',
  127. 'type' => 'getType',
  128. 'tag' => 'getTag',
  129. 'webUrl' => 'getWebUrl'
  130. ];
  131. /**
  132. * Array of attributes where the key is the local name,
  133. * and the value is the original name
  134. *
  135. * @return array
  136. */
  137. public static function attributeMap()
  138. {
  139. return self::$attributeMap;
  140. }
  141. /**
  142. * Array of attributes to setter functions (for deserialization of responses)
  143. *
  144. * @return array
  145. */
  146. public static function setters()
  147. {
  148. return self::$setters;
  149. }
  150. /**
  151. * Array of attributes to getter functions (for serialization of requests)
  152. *
  153. * @return array
  154. */
  155. public static function getters()
  156. {
  157. return self::$getters;
  158. }
  159. /**
  160. * The original name of the model.
  161. *
  162. * @return string
  163. */
  164. public function getModelName()
  165. {
  166. return self::$swaggerModelName;
  167. }
  168. const TYPE_TRANSACTIONAL = 'transactional';
  169. const TYPE_MARKETING = 'marketing';
  170. /**
  171. * Gets allowable values of the enum
  172. *
  173. * @return string[]
  174. */
  175. public function getTypeAllowableValues()
  176. {
  177. return [
  178. self::TYPE_TRANSACTIONAL,
  179. self::TYPE_MARKETING,
  180. ];
  181. }
  182. /**
  183. * Associative array for storing property values
  184. *
  185. * @var mixed[]
  186. */
  187. protected $container = [];
  188. /**
  189. * Constructor
  190. *
  191. * @param mixed[] $data Associated array of property values
  192. * initializing the model
  193. */
  194. public function __construct(array $data = null)
  195. {
  196. $this->container['sender'] = isset($data['sender']) ? $data['sender'] : null;
  197. $this->container['recipient'] = isset($data['recipient']) ? $data['recipient'] : null;
  198. $this->container['content'] = isset($data['content']) ? $data['content'] : null;
  199. $this->container['type'] = isset($data['type']) ? $data['type'] : 'transactional';
  200. $this->container['tag'] = isset($data['tag']) ? $data['tag'] : null;
  201. $this->container['webUrl'] = isset($data['webUrl']) ? $data['webUrl'] : null;
  202. }
  203. /**
  204. * Show all the invalid properties with reasons.
  205. *
  206. * @return array invalid properties with reasons
  207. */
  208. public function listInvalidProperties()
  209. {
  210. $invalidProperties = [];
  211. if ($this->container['sender'] === null) {
  212. $invalidProperties[] = "'sender' can't be null";
  213. }
  214. if ((mb_strlen($this->container['sender']) > 11)) {
  215. $invalidProperties[] = "invalid value for 'sender', the character length must be smaller than or equal to 11.";
  216. }
  217. if ($this->container['recipient'] === null) {
  218. $invalidProperties[] = "'recipient' can't be null";
  219. }
  220. if ($this->container['content'] === null) {
  221. $invalidProperties[] = "'content' can't be null";
  222. }
  223. $allowedValues = $this->getTypeAllowableValues();
  224. if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) {
  225. $invalidProperties[] = sprintf(
  226. "invalid value for 'type', must be one of '%s'",
  227. implode("', '", $allowedValues)
  228. );
  229. }
  230. return $invalidProperties;
  231. }
  232. /**
  233. * Validate all the properties in the model
  234. * return true if all passed
  235. *
  236. * @return bool True if all properties are valid
  237. */
  238. public function valid()
  239. {
  240. return count($this->listInvalidProperties()) === 0;
  241. }
  242. /**
  243. * Gets sender
  244. *
  245. * @return string
  246. */
  247. public function getSender()
  248. {
  249. return $this->container['sender'];
  250. }
  251. /**
  252. * Sets sender
  253. *
  254. * @param string $sender Name of the sender. Only alphanumeric characters. No more than 11 characters
  255. *
  256. * @return $this
  257. */
  258. public function setSender($sender)
  259. {
  260. if ((mb_strlen($sender) > 11)) {
  261. throw new \InvalidArgumentException('invalid length for $sender when calling SendTransacSms., must be smaller than or equal to 11.');
  262. }
  263. $this->container['sender'] = $sender;
  264. return $this;
  265. }
  266. /**
  267. * Gets recipient
  268. *
  269. * @return string
  270. */
  271. public function getRecipient()
  272. {
  273. return $this->container['recipient'];
  274. }
  275. /**
  276. * Sets recipient
  277. *
  278. * @param string $recipient Mobile number to send SMS with the country code
  279. *
  280. * @return $this
  281. */
  282. public function setRecipient($recipient)
  283. {
  284. $this->container['recipient'] = $recipient;
  285. return $this;
  286. }
  287. /**
  288. * Gets content
  289. *
  290. * @return string
  291. */
  292. public function getContent()
  293. {
  294. return $this->container['content'];
  295. }
  296. /**
  297. * Sets content
  298. *
  299. * @param string $content Content of the message. If more than 160 characters long, will be sent as multiple text messages
  300. *
  301. * @return $this
  302. */
  303. public function setContent($content)
  304. {
  305. $this->container['content'] = $content;
  306. return $this;
  307. }
  308. /**
  309. * Gets type
  310. *
  311. * @return string
  312. */
  313. public function getType()
  314. {
  315. return $this->container['type'];
  316. }
  317. /**
  318. * Sets type
  319. *
  320. * @param string $type Type of the SMS. Marketing SMS messages are those sent typically with marketing content. Transactional SMS messages are sent to individuals and are triggered in response to some action, such as a sign-up, purchase, etc.
  321. *
  322. * @return $this
  323. */
  324. public function setType($type)
  325. {
  326. $allowedValues = $this->getTypeAllowableValues();
  327. if (!is_null($type) && !in_array($type, $allowedValues, true)) {
  328. throw new \InvalidArgumentException(
  329. sprintf(
  330. "Invalid value for 'type', must be one of '%s'",
  331. implode("', '", $allowedValues)
  332. )
  333. );
  334. }
  335. $this->container['type'] = $type;
  336. return $this;
  337. }
  338. /**
  339. * Gets tag
  340. *
  341. * @return string
  342. */
  343. public function getTag()
  344. {
  345. return $this->container['tag'];
  346. }
  347. /**
  348. * Sets tag
  349. *
  350. * @param string $tag Tag of the message
  351. *
  352. * @return $this
  353. */
  354. public function setTag($tag)
  355. {
  356. $this->container['tag'] = $tag;
  357. return $this;
  358. }
  359. /**
  360. * Gets webUrl
  361. *
  362. * @return string
  363. */
  364. public function getWebUrl()
  365. {
  366. return $this->container['webUrl'];
  367. }
  368. /**
  369. * Sets webUrl
  370. *
  371. * @param string $webUrl Webhook to call for each event triggered by the message (delivered etc.)
  372. *
  373. * @return $this
  374. */
  375. public function setWebUrl($webUrl)
  376. {
  377. $this->container['webUrl'] = $webUrl;
  378. return $this;
  379. }
  380. /**
  381. * Returns true if offset exists. False otherwise.
  382. *
  383. * @param integer $offset Offset
  384. *
  385. * @return boolean
  386. */
  387. public function offsetExists($offset)
  388. {
  389. return isset($this->container[$offset]);
  390. }
  391. /**
  392. * Gets offset.
  393. *
  394. * @param integer $offset Offset
  395. *
  396. * @return mixed
  397. */
  398. public function offsetGet($offset)
  399. {
  400. return isset($this->container[$offset]) ? $this->container[$offset] : null;
  401. }
  402. /**
  403. * Sets value based on offset.
  404. *
  405. * @param integer $offset Offset
  406. * @param mixed $value Value to be set
  407. *
  408. * @return void
  409. */
  410. public function offsetSet($offset, $value)
  411. {
  412. if (is_null($offset)) {
  413. $this->container[] = $value;
  414. } else {
  415. $this->container[$offset] = $value;
  416. }
  417. }
  418. /**
  419. * Unsets offset.
  420. *
  421. * @param integer $offset Offset
  422. *
  423. * @return void
  424. */
  425. public function offsetUnset($offset)
  426. {
  427. unset($this->container[$offset]);
  428. }
  429. /**
  430. * Gets the string presentation of the object
  431. *
  432. * @return string
  433. */
  434. public function __toString()
  435. {
  436. if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
  437. return json_encode(
  438. ObjectSerializer::sanitizeForSerialization($this),
  439. JSON_PRETTY_PRINT
  440. );
  441. }
  442. return json_encode(ObjectSerializer::sanitizeForSerialization($this));
  443. }
  444. }