PageRenderTime 52ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://gitlab.com/i-have-a-green/digitemis-v3
PHP | 395 lines | 174 code | 41 blank | 180 comment | 6 complexity | de9e8ad81e27d18008c3df12c7e689a4 MD5 | raw file
  1. <?php
  2. /**
  3. * ErrorModel
  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. * ErrorModel 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 ErrorModel 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 = 'errorModel';
  47. /**
  48. * Array of property to type mappings. Used for (de)serialization
  49. *
  50. * @var string[]
  51. */
  52. protected static $swaggerTypes = [
  53. 'code' => 'string',
  54. 'message' => 'string'
  55. ];
  56. /**
  57. * Array of property to format mappings. Used for (de)serialization
  58. *
  59. * @var string[]
  60. */
  61. protected static $swaggerFormats = [
  62. 'code' => null,
  63. 'message' => null
  64. ];
  65. /**
  66. * Array of property to type mappings. Used for (de)serialization
  67. *
  68. * @return array
  69. */
  70. public static function swaggerTypes()
  71. {
  72. return self::$swaggerTypes;
  73. }
  74. /**
  75. * Array of property to format mappings. Used for (de)serialization
  76. *
  77. * @return array
  78. */
  79. public static function swaggerFormats()
  80. {
  81. return self::$swaggerFormats;
  82. }
  83. /**
  84. * Array of attributes where the key is the local name,
  85. * and the value is the original name
  86. *
  87. * @var string[]
  88. */
  89. protected static $attributeMap = [
  90. 'code' => 'code',
  91. 'message' => 'message'
  92. ];
  93. /**
  94. * Array of attributes to setter functions (for deserialization of responses)
  95. *
  96. * @var string[]
  97. */
  98. protected static $setters = [
  99. 'code' => 'setCode',
  100. 'message' => 'setMessage'
  101. ];
  102. /**
  103. * Array of attributes to getter functions (for serialization of requests)
  104. *
  105. * @var string[]
  106. */
  107. protected static $getters = [
  108. 'code' => 'getCode',
  109. 'message' => 'getMessage'
  110. ];
  111. /**
  112. * Array of attributes where the key is the local name,
  113. * and the value is the original name
  114. *
  115. * @return array
  116. */
  117. public static function attributeMap()
  118. {
  119. return self::$attributeMap;
  120. }
  121. /**
  122. * Array of attributes to setter functions (for deserialization of responses)
  123. *
  124. * @return array
  125. */
  126. public static function setters()
  127. {
  128. return self::$setters;
  129. }
  130. /**
  131. * Array of attributes to getter functions (for serialization of requests)
  132. *
  133. * @return array
  134. */
  135. public static function getters()
  136. {
  137. return self::$getters;
  138. }
  139. /**
  140. * The original name of the model.
  141. *
  142. * @return string
  143. */
  144. public function getModelName()
  145. {
  146. return self::$swaggerModelName;
  147. }
  148. const CODE_INVALID_PARAMETER = 'invalid_parameter';
  149. const CODE_MISSING_PARAMETER = 'missing_parameter';
  150. const CODE_OUT_OF_RANGE = 'out_of_range';
  151. const CODE_CAMPAIGN_PROCESSING = 'campaign_processing';
  152. const CODE_CAMPAIGN_SENT = 'campaign_sent';
  153. const CODE_DOCUMENT_NOT_FOUND = 'document_not_found';
  154. const CODE_RESELLER_PERMISSION_DENIED = 'reseller_permission_denied';
  155. const CODE_NOT_ENOUGH_CREDITS = 'not_enough_credits';
  156. const CODE_PERMISSION_DENIED = 'permission_denied';
  157. const CODE_DUPLICATE_PARAMETER = 'duplicate_parameter';
  158. const CODE_DUPLICATE_REQUEST = 'duplicate_request';
  159. const CODE_METHOD_NOT_ALLOWED = 'method_not_allowed';
  160. const CODE_UNAUTHORIZED = 'unauthorized';
  161. const CODE_ACCOUNT_UNDER_VALIDATION = 'account_under_validation';
  162. const CODE_NOT_ACCEPTABLE = 'not_acceptable';
  163. /**
  164. * Gets allowable values of the enum
  165. *
  166. * @return string[]
  167. */
  168. public function getCodeAllowableValues()
  169. {
  170. return [
  171. self::CODE_INVALID_PARAMETER,
  172. self::CODE_MISSING_PARAMETER,
  173. self::CODE_OUT_OF_RANGE,
  174. self::CODE_CAMPAIGN_PROCESSING,
  175. self::CODE_CAMPAIGN_SENT,
  176. self::CODE_DOCUMENT_NOT_FOUND,
  177. self::CODE_RESELLER_PERMISSION_DENIED,
  178. self::CODE_NOT_ENOUGH_CREDITS,
  179. self::CODE_PERMISSION_DENIED,
  180. self::CODE_DUPLICATE_PARAMETER,
  181. self::CODE_DUPLICATE_REQUEST,
  182. self::CODE_METHOD_NOT_ALLOWED,
  183. self::CODE_UNAUTHORIZED,
  184. self::CODE_ACCOUNT_UNDER_VALIDATION,
  185. self::CODE_NOT_ACCEPTABLE,
  186. ];
  187. }
  188. /**
  189. * Associative array for storing property values
  190. *
  191. * @var mixed[]
  192. */
  193. protected $container = [];
  194. /**
  195. * Constructor
  196. *
  197. * @param mixed[] $data Associated array of property values
  198. * initializing the model
  199. */
  200. public function __construct(array $data = null)
  201. {
  202. $this->container['code'] = isset($data['code']) ? $data['code'] : null;
  203. $this->container['message'] = isset($data['message']) ? $data['message'] : null;
  204. }
  205. /**
  206. * Show all the invalid properties with reasons.
  207. *
  208. * @return array invalid properties with reasons
  209. */
  210. public function listInvalidProperties()
  211. {
  212. $invalidProperties = [];
  213. if ($this->container['code'] === null) {
  214. $invalidProperties[] = "'code' can't be null";
  215. }
  216. $allowedValues = $this->getCodeAllowableValues();
  217. if (!is_null($this->container['code']) && !in_array($this->container['code'], $allowedValues, true)) {
  218. $invalidProperties[] = sprintf(
  219. "invalid value for 'code', must be one of '%s'",
  220. implode("', '", $allowedValues)
  221. );
  222. }
  223. if ($this->container['message'] === null) {
  224. $invalidProperties[] = "'message' can't be null";
  225. }
  226. return $invalidProperties;
  227. }
  228. /**
  229. * Validate all the properties in the model
  230. * return true if all passed
  231. *
  232. * @return bool True if all properties are valid
  233. */
  234. public function valid()
  235. {
  236. return count($this->listInvalidProperties()) === 0;
  237. }
  238. /**
  239. * Gets code
  240. *
  241. * @return string
  242. */
  243. public function getCode()
  244. {
  245. return $this->container['code'];
  246. }
  247. /**
  248. * Sets code
  249. *
  250. * @param string $code Error code displayed in case of a failure
  251. *
  252. * @return $this
  253. */
  254. public function setCode($code)
  255. {
  256. $allowedValues = $this->getCodeAllowableValues();
  257. if (!in_array($code, $allowedValues, true)) {
  258. throw new \InvalidArgumentException(
  259. sprintf(
  260. "Invalid value for 'code', must be one of '%s'",
  261. implode("', '", $allowedValues)
  262. )
  263. );
  264. }
  265. $this->container['code'] = $code;
  266. return $this;
  267. }
  268. /**
  269. * Gets message
  270. *
  271. * @return string
  272. */
  273. public function getMessage()
  274. {
  275. return $this->container['message'];
  276. }
  277. /**
  278. * Sets message
  279. *
  280. * @param string $message Readable message associated to the failure
  281. *
  282. * @return $this
  283. */
  284. public function setMessage($message)
  285. {
  286. $this->container['message'] = $message;
  287. return $this;
  288. }
  289. /**
  290. * Returns true if offset exists. False otherwise.
  291. *
  292. * @param integer $offset Offset
  293. *
  294. * @return boolean
  295. */
  296. public function offsetExists($offset)
  297. {
  298. return isset($this->container[$offset]);
  299. }
  300. /**
  301. * Gets offset.
  302. *
  303. * @param integer $offset Offset
  304. *
  305. * @return mixed
  306. */
  307. public function offsetGet($offset)
  308. {
  309. return isset($this->container[$offset]) ? $this->container[$offset] : null;
  310. }
  311. /**
  312. * Sets value based on offset.
  313. *
  314. * @param integer $offset Offset
  315. * @param mixed $value Value to be set
  316. *
  317. * @return void
  318. */
  319. public function offsetSet($offset, $value)
  320. {
  321. if (is_null($offset)) {
  322. $this->container[] = $value;
  323. } else {
  324. $this->container[$offset] = $value;
  325. }
  326. }
  327. /**
  328. * Unsets offset.
  329. *
  330. * @param integer $offset Offset
  331. *
  332. * @return void
  333. */
  334. public function offsetUnset($offset)
  335. {
  336. unset($this->container[$offset]);
  337. }
  338. /**
  339. * Gets the string presentation of the object
  340. *
  341. * @return string
  342. */
  343. public function __toString()
  344. {
  345. if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
  346. return json_encode(
  347. ObjectSerializer::sanitizeForSerialization($this),
  348. JSON_PRETTY_PRINT
  349. );
  350. }
  351. return json_encode(ObjectSerializer::sanitizeForSerialization($this));
  352. }
  353. }