/libraries/fabrik/vendor/twilio/sdk/src/Twilio/Rest/Monitor/V1/AlertInstance.php

https://github.com/trob/fabrik · PHP · 133 lines · 60 code · 13 blank · 60 comment · 3 complexity · 8d24394c061b0b31e9072e2bf87dc46c MD5 · raw file

  1. <?php
  2. /**
  3. * This code was generated by
  4. * \ / _ _ _| _ _
  5. * | (_)\/(_)(_|\/| |(/_ v1.0.0
  6. * / /
  7. */
  8. namespace Twilio\Rest\Monitor\V1;
  9. use Twilio\Deserialize;
  10. use Twilio\Exceptions\TwilioException;
  11. use Twilio\InstanceResource;
  12. use Twilio\Values;
  13. use Twilio\Version;
  14. /**
  15. * @property string $accountSid
  16. * @property string $alertText
  17. * @property string $apiVersion
  18. * @property \DateTime $dateCreated
  19. * @property \DateTime $dateGenerated
  20. * @property \DateTime $dateUpdated
  21. * @property string $errorCode
  22. * @property string $logLevel
  23. * @property string $moreInfo
  24. * @property string $requestMethod
  25. * @property string $requestUrl
  26. * @property string $requestVariables
  27. * @property string $resourceSid
  28. * @property string $responseBody
  29. * @property string $responseHeaders
  30. * @property string $sid
  31. * @property string $url
  32. * @property string $requestHeaders
  33. * @property string $serviceSid
  34. */
  35. class AlertInstance extends InstanceResource {
  36. /**
  37. * Initialize the AlertInstance
  38. *
  39. * @param \Twilio\Version $version Version that contains the resource
  40. * @param mixed[] $payload The response payload
  41. * @param string $sid The SID that identifies the resource to fetch
  42. * @return \Twilio\Rest\Monitor\V1\AlertInstance
  43. */
  44. public function __construct(Version $version, array $payload, $sid = null) {
  45. parent::__construct($version);
  46. // Marshaled Properties
  47. $this->properties = array(
  48. 'accountSid' => Values::array_get($payload, 'account_sid'),
  49. 'alertText' => Values::array_get($payload, 'alert_text'),
  50. 'apiVersion' => Values::array_get($payload, 'api_version'),
  51. 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')),
  52. 'dateGenerated' => Deserialize::dateTime(Values::array_get($payload, 'date_generated')),
  53. 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')),
  54. 'errorCode' => Values::array_get($payload, 'error_code'),
  55. 'logLevel' => Values::array_get($payload, 'log_level'),
  56. 'moreInfo' => Values::array_get($payload, 'more_info'),
  57. 'requestMethod' => Values::array_get($payload, 'request_method'),
  58. 'requestUrl' => Values::array_get($payload, 'request_url'),
  59. 'requestVariables' => Values::array_get($payload, 'request_variables'),
  60. 'resourceSid' => Values::array_get($payload, 'resource_sid'),
  61. 'responseBody' => Values::array_get($payload, 'response_body'),
  62. 'responseHeaders' => Values::array_get($payload, 'response_headers'),
  63. 'sid' => Values::array_get($payload, 'sid'),
  64. 'url' => Values::array_get($payload, 'url'),
  65. 'requestHeaders' => Values::array_get($payload, 'request_headers'),
  66. 'serviceSid' => Values::array_get($payload, 'service_sid'),
  67. );
  68. $this->solution = array('sid' => $sid ?: $this->properties['sid'], );
  69. }
  70. /**
  71. * Generate an instance context for the instance, the context is capable of
  72. * performing various actions. All instance actions are proxied to the context
  73. *
  74. * @return \Twilio\Rest\Monitor\V1\AlertContext Context for this AlertInstance
  75. */
  76. protected function proxy() {
  77. if (!$this->context) {
  78. $this->context = new AlertContext($this->version, $this->solution['sid']);
  79. }
  80. return $this->context;
  81. }
  82. /**
  83. * Fetch a AlertInstance
  84. *
  85. * @return AlertInstance Fetched AlertInstance
  86. * @throws TwilioException When an HTTP error occurs.
  87. */
  88. public function fetch() {
  89. return $this->proxy()->fetch();
  90. }
  91. /**
  92. * Magic getter to access properties
  93. *
  94. * @param string $name Property to access
  95. * @return mixed The requested property
  96. * @throws TwilioException For unknown properties
  97. */
  98. public function __get($name) {
  99. if (\array_key_exists($name, $this->properties)) {
  100. return $this->properties[$name];
  101. }
  102. if (\property_exists($this, '_' . $name)) {
  103. $method = 'get' . \ucfirst($name);
  104. return $this->$method();
  105. }
  106. throw new TwilioException('Unknown property: ' . $name);
  107. }
  108. /**
  109. * Provide a friendly representation
  110. *
  111. * @return string Machine friendly representation
  112. */
  113. public function __toString() {
  114. $context = array();
  115. foreach ($this->solution as $key => $value) {
  116. $context[] = "$key=$value";
  117. }
  118. return '[Twilio.Monitor.V1.AlertInstance ' . \implode(' ', $context) . ']';
  119. }
  120. }