PageRenderTime 44ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/src/Twilio/Rest/Api/V2010/AccountInstance.php

http://github.com/twilio/twilio-php
PHP | 343 lines | 175 code | 39 blank | 129 comment | 3 complexity | 20a7e12cb6cb4bc00b8d5c0ccfab6c28 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\Api\V2010;
  9. use Twilio\Deserialize;
  10. use Twilio\Exceptions\TwilioException;
  11. use Twilio\InstanceResource;
  12. use Twilio\Options;
  13. use Twilio\Rest\Api\V2010\Account\AddressList;
  14. use Twilio\Rest\Api\V2010\Account\ApplicationList;
  15. use Twilio\Rest\Api\V2010\Account\AuthorizedConnectAppList;
  16. use Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountryList;
  17. use Twilio\Rest\Api\V2010\Account\BalanceList;
  18. use Twilio\Rest\Api\V2010\Account\CallList;
  19. use Twilio\Rest\Api\V2010\Account\ConferenceList;
  20. use Twilio\Rest\Api\V2010\Account\ConnectAppList;
  21. use Twilio\Rest\Api\V2010\Account\IncomingPhoneNumberList;
  22. use Twilio\Rest\Api\V2010\Account\KeyList;
  23. use Twilio\Rest\Api\V2010\Account\MessageList;
  24. use Twilio\Rest\Api\V2010\Account\NewKeyList;
  25. use Twilio\Rest\Api\V2010\Account\NewSigningKeyList;
  26. use Twilio\Rest\Api\V2010\Account\NotificationList;
  27. use Twilio\Rest\Api\V2010\Account\OutgoingCallerIdList;
  28. use Twilio\Rest\Api\V2010\Account\QueueList;
  29. use Twilio\Rest\Api\V2010\Account\RecordingList;
  30. use Twilio\Rest\Api\V2010\Account\ShortCodeList;
  31. use Twilio\Rest\Api\V2010\Account\SigningKeyList;
  32. use Twilio\Rest\Api\V2010\Account\SipList;
  33. use Twilio\Rest\Api\V2010\Account\TokenList;
  34. use Twilio\Rest\Api\V2010\Account\TranscriptionList;
  35. use Twilio\Rest\Api\V2010\Account\UsageList;
  36. use Twilio\Rest\Api\V2010\Account\ValidationRequestList;
  37. use Twilio\Values;
  38. use Twilio\Version;
  39. /**
  40. * @property string $authToken
  41. * @property \DateTime $dateCreated
  42. * @property \DateTime $dateUpdated
  43. * @property string $friendlyName
  44. * @property string $ownerAccountSid
  45. * @property string $sid
  46. * @property string $status
  47. * @property array $subresourceUris
  48. * @property string $type
  49. * @property string $uri
  50. */
  51. class AccountInstance extends InstanceResource {
  52. protected $_addresses;
  53. protected $_applications;
  54. protected $_authorizedConnectApps;
  55. protected $_availablePhoneNumbers;
  56. protected $_balance;
  57. protected $_calls;
  58. protected $_conferences;
  59. protected $_connectApps;
  60. protected $_incomingPhoneNumbers;
  61. protected $_keys;
  62. protected $_messages;
  63. protected $_newKeys;
  64. protected $_newSigningKeys;
  65. protected $_notifications;
  66. protected $_outgoingCallerIds;
  67. protected $_queues;
  68. protected $_recordings;
  69. protected $_signingKeys;
  70. protected $_sip;
  71. protected $_shortCodes;
  72. protected $_tokens;
  73. protected $_transcriptions;
  74. protected $_usage;
  75. protected $_validationRequests;
  76. /**
  77. * Initialize the AccountInstance
  78. *
  79. * @param Version $version Version that contains the resource
  80. * @param mixed[] $payload The response payload
  81. * @param string $sid Fetch by unique Account Sid
  82. */
  83. public function __construct(Version $version, array $payload, string $sid = null) {
  84. parent::__construct($version);
  85. // Marshaled Properties
  86. $this->properties = [
  87. 'authToken' => Values::array_get($payload, 'auth_token'),
  88. 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')),
  89. 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')),
  90. 'friendlyName' => Values::array_get($payload, 'friendly_name'),
  91. 'ownerAccountSid' => Values::array_get($payload, 'owner_account_sid'),
  92. 'sid' => Values::array_get($payload, 'sid'),
  93. 'status' => Values::array_get($payload, 'status'),
  94. 'subresourceUris' => Values::array_get($payload, 'subresource_uris'),
  95. 'type' => Values::array_get($payload, 'type'),
  96. 'uri' => Values::array_get($payload, 'uri'),
  97. ];
  98. $this->solution = ['sid' => $sid ?: $this->properties['sid'], ];
  99. }
  100. /**
  101. * Generate an instance context for the instance, the context is capable of
  102. * performing various actions. All instance actions are proxied to the context
  103. *
  104. * @return AccountContext Context for this AccountInstance
  105. */
  106. protected function proxy(): AccountContext {
  107. if (!$this->context) {
  108. $this->context = new AccountContext($this->version, $this->solution['sid']);
  109. }
  110. return $this->context;
  111. }
  112. /**
  113. * Fetch the AccountInstance
  114. *
  115. * @return AccountInstance Fetched AccountInstance
  116. * @throws TwilioException When an HTTP error occurs.
  117. */
  118. public function fetch(): AccountInstance {
  119. return $this->proxy()->fetch();
  120. }
  121. /**
  122. * Update the AccountInstance
  123. *
  124. * @param array|Options $options Optional Arguments
  125. * @return AccountInstance Updated AccountInstance
  126. * @throws TwilioException When an HTTP error occurs.
  127. */
  128. public function update(array $options = []): AccountInstance {
  129. return $this->proxy()->update($options);
  130. }
  131. /**
  132. * Access the addresses
  133. */
  134. protected function getAddresses(): AddressList {
  135. return $this->proxy()->addresses;
  136. }
  137. /**
  138. * Access the applications
  139. */
  140. protected function getApplications(): ApplicationList {
  141. return $this->proxy()->applications;
  142. }
  143. /**
  144. * Access the authorizedConnectApps
  145. */
  146. protected function getAuthorizedConnectApps(): AuthorizedConnectAppList {
  147. return $this->proxy()->authorizedConnectApps;
  148. }
  149. /**
  150. * Access the availablePhoneNumbers
  151. */
  152. protected function getAvailablePhoneNumbers(): AvailablePhoneNumberCountryList {
  153. return $this->proxy()->availablePhoneNumbers;
  154. }
  155. /**
  156. * Access the balance
  157. */
  158. protected function getBalance(): BalanceList {
  159. return $this->proxy()->balance;
  160. }
  161. /**
  162. * Access the calls
  163. */
  164. protected function getCalls(): CallList {
  165. return $this->proxy()->calls;
  166. }
  167. /**
  168. * Access the conferences
  169. */
  170. protected function getConferences(): ConferenceList {
  171. return $this->proxy()->conferences;
  172. }
  173. /**
  174. * Access the connectApps
  175. */
  176. protected function getConnectApps(): ConnectAppList {
  177. return $this->proxy()->connectApps;
  178. }
  179. /**
  180. * Access the incomingPhoneNumbers
  181. */
  182. protected function getIncomingPhoneNumbers(): IncomingPhoneNumberList {
  183. return $this->proxy()->incomingPhoneNumbers;
  184. }
  185. /**
  186. * Access the keys
  187. */
  188. protected function getKeys(): KeyList {
  189. return $this->proxy()->keys;
  190. }
  191. /**
  192. * Access the messages
  193. */
  194. protected function getMessages(): MessageList {
  195. return $this->proxy()->messages;
  196. }
  197. /**
  198. * Access the newKeys
  199. */
  200. protected function getNewKeys(): NewKeyList {
  201. return $this->proxy()->newKeys;
  202. }
  203. /**
  204. * Access the newSigningKeys
  205. */
  206. protected function getNewSigningKeys(): NewSigningKeyList {
  207. return $this->proxy()->newSigningKeys;
  208. }
  209. /**
  210. * Access the notifications
  211. */
  212. protected function getNotifications(): NotificationList {
  213. return $this->proxy()->notifications;
  214. }
  215. /**
  216. * Access the outgoingCallerIds
  217. */
  218. protected function getOutgoingCallerIds(): OutgoingCallerIdList {
  219. return $this->proxy()->outgoingCallerIds;
  220. }
  221. /**
  222. * Access the queues
  223. */
  224. protected function getQueues(): QueueList {
  225. return $this->proxy()->queues;
  226. }
  227. /**
  228. * Access the recordings
  229. */
  230. protected function getRecordings(): RecordingList {
  231. return $this->proxy()->recordings;
  232. }
  233. /**
  234. * Access the signingKeys
  235. */
  236. protected function getSigningKeys(): SigningKeyList {
  237. return $this->proxy()->signingKeys;
  238. }
  239. /**
  240. * Access the sip
  241. */
  242. protected function getSip(): SipList {
  243. return $this->proxy()->sip;
  244. }
  245. /**
  246. * Access the shortCodes
  247. */
  248. protected function getShortCodes(): ShortCodeList {
  249. return $this->proxy()->shortCodes;
  250. }
  251. /**
  252. * Access the tokens
  253. */
  254. protected function getTokens(): TokenList {
  255. return $this->proxy()->tokens;
  256. }
  257. /**
  258. * Access the transcriptions
  259. */
  260. protected function getTranscriptions(): TranscriptionList {
  261. return $this->proxy()->transcriptions;
  262. }
  263. /**
  264. * Access the usage
  265. */
  266. protected function getUsage(): UsageList {
  267. return $this->proxy()->usage;
  268. }
  269. /**
  270. * Access the validationRequests
  271. */
  272. protected function getValidationRequests(): ValidationRequestList {
  273. return $this->proxy()->validationRequests;
  274. }
  275. /**
  276. * Magic getter to access properties
  277. *
  278. * @param string $name Property to access
  279. * @return mixed The requested property
  280. * @throws TwilioException For unknown properties
  281. */
  282. public function __get(string $name) {
  283. if (\array_key_exists($name, $this->properties)) {
  284. return $this->properties[$name];
  285. }
  286. if (\property_exists($this, '_' . $name)) {
  287. $method = 'get' . \ucfirst($name);
  288. return $this->$method();
  289. }
  290. throw new TwilioException('Unknown property: ' . $name);
  291. }
  292. /**
  293. * Provide a friendly representation
  294. *
  295. * @return string Machine friendly representation
  296. */
  297. public function __toString(): string {
  298. $context = [];
  299. foreach ($this->solution as $key => $value) {
  300. $context[] = "$key=$value";
  301. }
  302. return '[Twilio.Api.V2010.AccountInstance ' . \implode(' ', $context) . ']';
  303. }
  304. }