1
0

Monitor.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <?php
  2. /**
  3. * This code was generated by
  4. * \ / _ _ _| _ _
  5. * | (_)\/(_)(_|\/| |(/_ v1.0.0
  6. * / /
  7. */
  8. namespace Twilio\Rest;
  9. use Twilio\Domain;
  10. use Twilio\Exceptions\TwilioException;
  11. use Twilio\Rest\Monitor\V1;
  12. /**
  13. * @property \Twilio\Rest\Monitor\V1 v1
  14. * @property \Twilio\Rest\Monitor\V1\AlertList alerts
  15. * @property \Twilio\Rest\Monitor\V1\EventList events
  16. * @method \Twilio\Rest\Monitor\V1\AlertContext alerts(string $sid)
  17. * @method \Twilio\Rest\Monitor\V1\EventContext events(string $sid)
  18. */
  19. class Monitor extends Domain {
  20. protected $_v1 = null;
  21. /**
  22. * Construct the Monitor Domain
  23. *
  24. * @param \Twilio\Rest\Client $client Twilio\Rest\Client to communicate with
  25. * Twilio
  26. * @return \Twilio\Rest\Monitor Domain for Monitor
  27. */
  28. public function __construct(Client $client) {
  29. parent::__construct($client);
  30. $this->baseUrl = 'https://monitor.twilio.com';
  31. }
  32. /**
  33. * @return \Twilio\Rest\Monitor\V1 Version v1 of monitor
  34. */
  35. protected function getV1() {
  36. if (!$this->_v1) {
  37. $this->_v1 = new V1($this);
  38. }
  39. return $this->_v1;
  40. }
  41. /**
  42. * Magic getter to lazy load version
  43. *
  44. * @param string $name Version to return
  45. * @return \Twilio\Version The requested version
  46. * @throws \Twilio\Exceptions\TwilioException For unknown versions
  47. */
  48. public function __get($name) {
  49. $method = 'get' . ucfirst($name);
  50. if (method_exists($this, $method)) {
  51. return $this->$method();
  52. }
  53. throw new TwilioException('Unknown version ' . $name);
  54. }
  55. /**
  56. * Magic caller to get resource contexts
  57. *
  58. * @param string $name Resource to return
  59. * @param array $arguments Context parameters
  60. * @return \Twilio\InstanceContext The requested resource context
  61. * @throws \Twilio\Exceptions\TwilioException For unknown resource
  62. */
  63. public function __call($name, $arguments) {
  64. $method = 'context' . ucfirst($name);
  65. if (method_exists($this, $method)) {
  66. return call_user_func_array(array($this, $method), $arguments);
  67. }
  68. throw new TwilioException('Unknown context ' . $name);
  69. }
  70. /**
  71. * @return \Twilio\Rest\Monitor\V1\AlertList
  72. */
  73. protected function getAlerts() {
  74. return $this->v1->alerts;
  75. }
  76. /**
  77. * @param string $sid The sid
  78. * @return \Twilio\Rest\Monitor\V1\AlertContext
  79. */
  80. protected function contextAlerts($sid) {
  81. return $this->v1->alerts($sid);
  82. }
  83. /**
  84. * @return \Twilio\Rest\Monitor\V1\EventList
  85. */
  86. protected function getEvents() {
  87. return $this->v1->events;
  88. }
  89. /**
  90. * @param string $sid The sid
  91. * @return \Twilio\Rest\Monitor\V1\EventContext
  92. */
  93. protected function contextEvents($sid) {
  94. return $this->v1->events($sid);
  95. }
  96. /**
  97. * Provide a friendly representation
  98. *
  99. * @return string Machine friendly representation
  100. */
  101. public function __toString() {
  102. return '[Twilio.Monitor]';
  103. }
  104. }