IpMessaging.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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\IpMessaging\V1;
  12. use Twilio\Rest\IpMessaging\V2;
  13. /**
  14. * @property \Twilio\Rest\IpMessaging\V1 v1
  15. * @property \Twilio\Rest\IpMessaging\V2 v2
  16. * @property \Twilio\Rest\IpMessaging\V2\CredentialList credentials
  17. * @property \Twilio\Rest\IpMessaging\V2\ServiceList services
  18. * @method \Twilio\Rest\IpMessaging\V2\CredentialContext credentials(string $sid)
  19. * @method \Twilio\Rest\IpMessaging\V2\ServiceContext services(string $sid)
  20. */
  21. class IpMessaging extends Domain {
  22. protected $_v1 = null;
  23. protected $_v2 = null;
  24. /**
  25. * Construct the IpMessaging Domain
  26. *
  27. * @param \Twilio\Rest\Client $client Twilio\Rest\Client to communicate with
  28. * Twilio
  29. * @return \Twilio\Rest\IpMessaging Domain for IpMessaging
  30. */
  31. public function __construct(Client $client) {
  32. parent::__construct($client);
  33. $this->baseUrl = 'https://ip-messaging.twilio.com';
  34. }
  35. /**
  36. * @return \Twilio\Rest\IpMessaging\V1 Version v1 of ip_messaging
  37. */
  38. protected function getV1() {
  39. if (!$this->_v1) {
  40. $this->_v1 = new V1($this);
  41. }
  42. return $this->_v1;
  43. }
  44. /**
  45. * @return \Twilio\Rest\IpMessaging\V2 Version v2 of ip_messaging
  46. */
  47. protected function getV2() {
  48. if (!$this->_v2) {
  49. $this->_v2 = new V2($this);
  50. }
  51. return $this->_v2;
  52. }
  53. /**
  54. * Magic getter to lazy load version
  55. *
  56. * @param string $name Version to return
  57. * @return \Twilio\Version The requested version
  58. * @throws \Twilio\Exceptions\TwilioException For unknown versions
  59. */
  60. public function __get($name) {
  61. $method = 'get' . ucfirst($name);
  62. if (method_exists($this, $method)) {
  63. return $this->$method();
  64. }
  65. throw new TwilioException('Unknown version ' . $name);
  66. }
  67. /**
  68. * Magic caller to get resource contexts
  69. *
  70. * @param string $name Resource to return
  71. * @param array $arguments Context parameters
  72. * @return \Twilio\InstanceContext The requested resource context
  73. * @throws \Twilio\Exceptions\TwilioException For unknown resource
  74. */
  75. public function __call($name, $arguments) {
  76. $method = 'context' . ucfirst($name);
  77. if (method_exists($this, $method)) {
  78. return call_user_func_array(array($this, $method), $arguments);
  79. }
  80. throw new TwilioException('Unknown context ' . $name);
  81. }
  82. /**
  83. * @return \Twilio\Rest\IpMessaging\V2\CredentialList
  84. */
  85. protected function getCredentials() {
  86. return $this->v2->credentials;
  87. }
  88. /**
  89. * @param string $sid The sid
  90. * @return \Twilio\Rest\IpMessaging\V2\CredentialContext
  91. */
  92. protected function contextCredentials($sid) {
  93. return $this->v2->credentials($sid);
  94. }
  95. /**
  96. * @return \Twilio\Rest\IpMessaging\V2\ServiceList
  97. */
  98. protected function getServices() {
  99. return $this->v2->services;
  100. }
  101. /**
  102. * @param string $sid The sid
  103. * @return \Twilio\Rest\IpMessaging\V2\ServiceContext
  104. */
  105. protected function contextServices($sid) {
  106. return $this->v2->services($sid);
  107. }
  108. /**
  109. * Provide a friendly representation
  110. *
  111. * @return string Machine friendly representation
  112. */
  113. public function __toString() {
  114. return '[Twilio.IpMessaging]';
  115. }
  116. }