Sync.php 2.6 KB

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