AssistantInstance.php 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <?php
  2. /**
  3. * This code was generated by
  4. * \ / _ _ _| _ _
  5. * | (_)\/(_)(_|\/| |(/_ v1.0.0
  6. * / /
  7. */
  8. namespace Twilio\Rest\Preview\Understand;
  9. use Twilio\Deserialize;
  10. use Twilio\Exceptions\TwilioException;
  11. use Twilio\InstanceResource;
  12. use Twilio\Options;
  13. use Twilio\Values;
  14. use Twilio\Version;
  15. /**
  16. * PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
  17. *
  18. * @property string accountSid
  19. * @property \DateTime dateCreated
  20. * @property \DateTime dateUpdated
  21. * @property string friendlyName
  22. * @property string latestModelBuildSid
  23. * @property array links
  24. * @property boolean logQueries
  25. * @property string sid
  26. * @property integer ttl
  27. * @property string uniqueName
  28. * @property string url
  29. * @property string responseUrl
  30. * @property string callbackUrl
  31. * @property string callbackEvents
  32. */
  33. class AssistantInstance extends InstanceResource {
  34. protected $_fieldTypes = null;
  35. protected $_intents = null;
  36. protected $_modelBuilds = null;
  37. protected $_queries = null;
  38. /**
  39. * Initialize the AssistantInstance
  40. *
  41. * @param \Twilio\Version $version Version that contains the resource
  42. * @param mixed[] $payload The response payload
  43. * @param string $sid The sid
  44. * @return \Twilio\Rest\Preview\Understand\AssistantInstance
  45. */
  46. public function __construct(Version $version, array $payload, $sid = null) {
  47. parent::__construct($version);
  48. // Marshaled Properties
  49. $this->properties = array(
  50. 'accountSid' => Values::array_get($payload, 'account_sid'),
  51. 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')),
  52. 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')),
  53. 'friendlyName' => Values::array_get($payload, 'friendly_name'),
  54. 'latestModelBuildSid' => Values::array_get($payload, 'latest_model_build_sid'),
  55. 'links' => Values::array_get($payload, 'links'),
  56. 'logQueries' => Values::array_get($payload, 'log_queries'),
  57. 'sid' => Values::array_get($payload, 'sid'),
  58. 'ttl' => Values::array_get($payload, 'ttl'),
  59. 'uniqueName' => Values::array_get($payload, 'unique_name'),
  60. 'url' => Values::array_get($payload, 'url'),
  61. 'responseUrl' => Values::array_get($payload, 'response_url'),
  62. 'callbackUrl' => Values::array_get($payload, 'callback_url'),
  63. 'callbackEvents' => Values::array_get($payload, 'callback_events'),
  64. );
  65. $this->solution = array('sid' => $sid ?: $this->properties['sid'], );
  66. }
  67. /**
  68. * Generate an instance context for the instance, the context is capable of
  69. * performing various actions. All instance actions are proxied to the context
  70. *
  71. * @return \Twilio\Rest\Preview\Understand\AssistantContext Context for this
  72. * AssistantInstance
  73. */
  74. protected function proxy() {
  75. if (!$this->context) {
  76. $this->context = new AssistantContext($this->version, $this->solution['sid']);
  77. }
  78. return $this->context;
  79. }
  80. /**
  81. * Fetch a AssistantInstance
  82. *
  83. * @return AssistantInstance Fetched AssistantInstance
  84. * @throws TwilioException When an HTTP error occurs.
  85. */
  86. public function fetch() {
  87. return $this->proxy()->fetch();
  88. }
  89. /**
  90. * Update the AssistantInstance
  91. *
  92. * @param array|Options $options Optional Arguments
  93. * @return AssistantInstance Updated AssistantInstance
  94. * @throws TwilioException When an HTTP error occurs.
  95. */
  96. public function update($options = array()) {
  97. return $this->proxy()->update($options);
  98. }
  99. /**
  100. * Deletes the AssistantInstance
  101. *
  102. * @return boolean True if delete succeeds, false otherwise
  103. * @throws TwilioException When an HTTP error occurs.
  104. */
  105. public function delete() {
  106. return $this->proxy()->delete();
  107. }
  108. /**
  109. * Access the fieldTypes
  110. *
  111. * @return \Twilio\Rest\Preview\Understand\Assistant\FieldTypeList
  112. */
  113. protected function getFieldTypes() {
  114. return $this->proxy()->fieldTypes;
  115. }
  116. /**
  117. * Access the intents
  118. *
  119. * @return \Twilio\Rest\Preview\Understand\Assistant\IntentList
  120. */
  121. protected function getIntents() {
  122. return $this->proxy()->intents;
  123. }
  124. /**
  125. * Access the modelBuilds
  126. *
  127. * @return \Twilio\Rest\Preview\Understand\Assistant\ModelBuildList
  128. */
  129. protected function getModelBuilds() {
  130. return $this->proxy()->modelBuilds;
  131. }
  132. /**
  133. * Access the queries
  134. *
  135. * @return \Twilio\Rest\Preview\Understand\Assistant\QueryList
  136. */
  137. protected function getQueries() {
  138. return $this->proxy()->queries;
  139. }
  140. /**
  141. * Magic getter to access properties
  142. *
  143. * @param string $name Property to access
  144. * @return mixed The requested property
  145. * @throws TwilioException For unknown properties
  146. */
  147. public function __get($name) {
  148. if (array_key_exists($name, $this->properties)) {
  149. return $this->properties[$name];
  150. }
  151. if (property_exists($this, '_' . $name)) {
  152. $method = 'get' . ucfirst($name);
  153. return $this->$method();
  154. }
  155. throw new TwilioException('Unknown property: ' . $name);
  156. }
  157. /**
  158. * Provide a friendly representation
  159. *
  160. * @return string Machine friendly representation
  161. */
  162. public function __toString() {
  163. $context = array();
  164. foreach ($this->solution as $key => $value) {
  165. $context[] = "$key=$value";
  166. }
  167. return '[Twilio.Preview.Understand.AssistantInstance ' . implode(' ', $context) . ']';
  168. }
  169. }