PageRenderTime 39ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/src/Twilio/Rest/FlexApi.php

http://github.com/twilio/twilio-php
PHP | 134 lines | 59 code | 20 blank | 55 comment | 3 complexity | 59af227aea164647ec0bd84f653e67dc MD5 | raw file
Possible License(s): MIT
  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\FlexApi\V1;
  12. /**
  13. * @property \Twilio\Rest\FlexApi\V1 $v1
  14. * @property \Twilio\Rest\FlexApi\V1\ChannelList $channel
  15. * @property \Twilio\Rest\FlexApi\V1\ConfigurationList $configuration
  16. * @property \Twilio\Rest\FlexApi\V1\FlexFlowList $flexFlow
  17. * @property \Twilio\Rest\FlexApi\V1\WebChannelList $webChannel
  18. * @method \Twilio\Rest\FlexApi\V1\ChannelContext channel(string $sid)
  19. * @method \Twilio\Rest\FlexApi\V1\ConfigurationContext configuration()
  20. * @method \Twilio\Rest\FlexApi\V1\FlexFlowContext flexFlow(string $sid)
  21. * @method \Twilio\Rest\FlexApi\V1\WebChannelContext webChannel(string $sid)
  22. */
  23. class FlexApi extends Domain {
  24. protected $_v1;
  25. /**
  26. * Construct the FlexApi Domain
  27. *
  28. * @param Client $client Client to communicate with Twilio
  29. */
  30. public function __construct(Client $client) {
  31. parent::__construct($client);
  32. $this->baseUrl = 'https://flex-api.twilio.com';
  33. }
  34. /**
  35. * @return V1 Version v1 of flex_api
  36. */
  37. protected function getV1(): V1 {
  38. if (!$this->_v1) {
  39. $this->_v1 = new V1($this);
  40. }
  41. return $this->_v1;
  42. }
  43. /**
  44. * Magic getter to lazy load version
  45. *
  46. * @param string $name Version to return
  47. * @return \Twilio\Version The requested version
  48. * @throws TwilioException For unknown versions
  49. */
  50. public function __get(string $name) {
  51. $method = 'get' . \ucfirst($name);
  52. if (\method_exists($this, $method)) {
  53. return $this->$method();
  54. }
  55. throw new TwilioException('Unknown version ' . $name);
  56. }
  57. /**
  58. * Magic caller to get resource contexts
  59. *
  60. * @param string $name Resource to return
  61. * @param array $arguments Context parameters
  62. * @return \Twilio\InstanceContext The requested resource context
  63. * @throws TwilioException For unknown resource
  64. */
  65. public function __call(string $name, array $arguments) {
  66. $method = 'context' . \ucfirst($name);
  67. if (\method_exists($this, $method)) {
  68. return \call_user_func_array([$this, $method], $arguments);
  69. }
  70. throw new TwilioException('Unknown context ' . $name);
  71. }
  72. protected function getChannel(): \Twilio\Rest\FlexApi\V1\ChannelList {
  73. return $this->v1->channel;
  74. }
  75. /**
  76. * @param string $sid The SID that identifies the Flex chat channel resource to
  77. * fetch
  78. */
  79. protected function contextChannel(string $sid): \Twilio\Rest\FlexApi\V1\ChannelContext {
  80. return $this->v1->channel($sid);
  81. }
  82. protected function getConfiguration(): \Twilio\Rest\FlexApi\V1\ConfigurationList {
  83. return $this->v1->configuration;
  84. }
  85. protected function contextConfiguration(): \Twilio\Rest\FlexApi\V1\ConfigurationContext {
  86. return $this->v1->configuration();
  87. }
  88. protected function getFlexFlow(): \Twilio\Rest\FlexApi\V1\FlexFlowList {
  89. return $this->v1->flexFlow;
  90. }
  91. /**
  92. * @param string $sid The SID that identifies the resource to fetch
  93. */
  94. protected function contextFlexFlow(string $sid): \Twilio\Rest\FlexApi\V1\FlexFlowContext {
  95. return $this->v1->flexFlow($sid);
  96. }
  97. protected function getWebChannel(): \Twilio\Rest\FlexApi\V1\WebChannelList {
  98. return $this->v1->webChannel;
  99. }
  100. /**
  101. * @param string $sid The SID of the WebChannel resource to fetch
  102. */
  103. protected function contextWebChannel(string $sid): \Twilio\Rest\FlexApi\V1\WebChannelContext {
  104. return $this->v1->webChannel($sid);
  105. }
  106. /**
  107. * Provide a friendly representation
  108. *
  109. * @return string Machine friendly representation
  110. */
  111. public function __toString(): string {
  112. return '[Twilio.FlexApi]';
  113. }
  114. }