/libraries/fabrik/vendor/twilio/sdk/src/Twilio/Rest/Preview/Marketplace/InstalledAddOn/InstalledAddOnExtensionInstance.php

https://github.com/trob/fabrik · PHP · 133 lines · 57 code · 14 blank · 62 comment · 3 complexity · 6ea3acf0aee787519714b24b7101d37e MD5 · raw file

  1. <?php
  2. /**
  3. * This code was generated by
  4. * \ / _ _ _| _ _
  5. * | (_)\/(_)(_|\/| |(/_ v1.0.0
  6. * / /
  7. */
  8. namespace Twilio\Rest\Preview\Marketplace\InstalledAddOn;
  9. use Twilio\Exceptions\TwilioException;
  10. use Twilio\InstanceResource;
  11. use Twilio\Values;
  12. use Twilio\Version;
  13. /**
  14. * 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.
  15. *
  16. * @property string $sid
  17. * @property string $installedAddOnSid
  18. * @property string $friendlyName
  19. * @property string $productName
  20. * @property string $uniqueName
  21. * @property bool $enabled
  22. * @property string $url
  23. */
  24. class InstalledAddOnExtensionInstance extends InstanceResource {
  25. /**
  26. * Initialize the InstalledAddOnExtensionInstance
  27. *
  28. * @param \Twilio\Version $version Version that contains the resource
  29. * @param mixed[] $payload The response payload
  30. * @param string $installedAddOnSid The SID of the InstalledAddOn resource to
  31. * which this extension applies
  32. * @param string $sid The SID of the InstalledAddOn Extension resource to fetch
  33. * @return \Twilio\Rest\Preview\Marketplace\InstalledAddOn\InstalledAddOnExtensionInstance
  34. */
  35. public function __construct(Version $version, array $payload, $installedAddOnSid, $sid = null) {
  36. parent::__construct($version);
  37. // Marshaled Properties
  38. $this->properties = array(
  39. 'sid' => Values::array_get($payload, 'sid'),
  40. 'installedAddOnSid' => Values::array_get($payload, 'installed_add_on_sid'),
  41. 'friendlyName' => Values::array_get($payload, 'friendly_name'),
  42. 'productName' => Values::array_get($payload, 'product_name'),
  43. 'uniqueName' => Values::array_get($payload, 'unique_name'),
  44. 'enabled' => Values::array_get($payload, 'enabled'),
  45. 'url' => Values::array_get($payload, 'url'),
  46. );
  47. $this->solution = array(
  48. 'installedAddOnSid' => $installedAddOnSid,
  49. 'sid' => $sid ?: $this->properties['sid'],
  50. );
  51. }
  52. /**
  53. * Generate an instance context for the instance, the context is capable of
  54. * performing various actions. All instance actions are proxied to the context
  55. *
  56. * @return \Twilio\Rest\Preview\Marketplace\InstalledAddOn\InstalledAddOnExtensionContext Context for this
  57. * InstalledAddOnExtensionInstance
  58. */
  59. protected function proxy() {
  60. if (!$this->context) {
  61. $this->context = new InstalledAddOnExtensionContext(
  62. $this->version,
  63. $this->solution['installedAddOnSid'],
  64. $this->solution['sid']
  65. );
  66. }
  67. return $this->context;
  68. }
  69. /**
  70. * Fetch a InstalledAddOnExtensionInstance
  71. *
  72. * @return InstalledAddOnExtensionInstance Fetched
  73. * InstalledAddOnExtensionInstance
  74. * @throws TwilioException When an HTTP error occurs.
  75. */
  76. public function fetch() {
  77. return $this->proxy()->fetch();
  78. }
  79. /**
  80. * Update the InstalledAddOnExtensionInstance
  81. *
  82. * @param bool $enabled Whether the Extension should be invoked
  83. * @return InstalledAddOnExtensionInstance Updated
  84. * InstalledAddOnExtensionInstance
  85. * @throws TwilioException When an HTTP error occurs.
  86. */
  87. public function update($enabled) {
  88. return $this->proxy()->update($enabled);
  89. }
  90. /**
  91. * Magic getter to access properties
  92. *
  93. * @param string $name Property to access
  94. * @return mixed The requested property
  95. * @throws TwilioException For unknown properties
  96. */
  97. public function __get($name) {
  98. if (\array_key_exists($name, $this->properties)) {
  99. return $this->properties[$name];
  100. }
  101. if (\property_exists($this, '_' . $name)) {
  102. $method = 'get' . \ucfirst($name);
  103. return $this->$method();
  104. }
  105. throw new TwilioException('Unknown property: ' . $name);
  106. }
  107. /**
  108. * Provide a friendly representation
  109. *
  110. * @return string Machine friendly representation
  111. */
  112. public function __toString() {
  113. $context = array();
  114. foreach ($this->solution as $key => $value) {
  115. $context[] = "$key=$value";
  116. }
  117. return '[Twilio.Preview.Marketplace.InstalledAddOnExtensionInstance ' . \implode(' ', $context) . ']';
  118. }
  119. }