diff options
Diffstat (limited to 'Twilio/Rest/Preview/Wireless')
-rw-r--r-- | Twilio/Rest/Preview/Wireless/CommandContext.php | 68 | ||||
-rw-r--r-- | Twilio/Rest/Preview/Wireless/CommandInstance.php | 117 | ||||
-rw-r--r-- | Twilio/Rest/Preview/Wireless/CommandList.php | 161 | ||||
-rw-r--r-- | Twilio/Rest/Preview/Wireless/CommandPage.php | 37 | ||||
-rw-r--r-- | Twilio/Rest/Preview/Wireless/Device/UsageContext.php | 74 | ||||
-rw-r--r-- | Twilio/Rest/Preview/Wireless/Device/UsageInstance.php | 119 | ||||
-rw-r--r-- | Twilio/Rest/Preview/Wireless/Device/UsageList.php | 52 | ||||
-rw-r--r-- | Twilio/Rest/Preview/Wireless/Device/UsagePage.php | 38 | ||||
-rw-r--r-- | Twilio/Rest/Preview/Wireless/DeviceContext.php | 159 | ||||
-rw-r--r-- | Twilio/Rest/Preview/Wireless/DeviceInstance.php | 148 | ||||
-rw-r--r-- | Twilio/Rest/Preview/Wireless/DeviceList.php | 165 | ||||
-rw-r--r-- | Twilio/Rest/Preview/Wireless/DevicePage.php | 37 | ||||
-rw-r--r-- | Twilio/Rest/Preview/Wireless/RatePlanContext.php | 68 | ||||
-rw-r--r-- | Twilio/Rest/Preview/Wireless/RatePlanInstance.php | 129 | ||||
-rw-r--r-- | Twilio/Rest/Preview/Wireless/RatePlanList.php | 123 | ||||
-rw-r--r-- | Twilio/Rest/Preview/Wireless/RatePlanPage.php | 37 |
16 files changed, 1532 insertions, 0 deletions
diff --git a/Twilio/Rest/Preview/Wireless/CommandContext.php b/Twilio/Rest/Preview/Wireless/CommandContext.php new file mode 100644 index 0000000..4ff3b26 --- /dev/null +++ b/Twilio/Rest/Preview/Wireless/CommandContext.php @@ -0,0 +1,68 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Wireless; + +use Twilio\InstanceContext; +use Twilio\Values; +use Twilio\Version; + +class CommandContext extends InstanceContext { + /** + * Initialize the CommandContext + * + * @param \Twilio\Version $version Version that contains the resource + * @param string $sid The sid + * @return \Twilio\Rest\Preview\Wireless\CommandContext + */ + public function __construct(Version $version, $sid) { + parent::__construct($version); + + // Path Solution + $this->solution = array( + 'sid' => $sid, + ); + + $this->uri = '/Commands/' . $sid . ''; + } + + /** + * Fetch a CommandInstance + * + * @return CommandInstance Fetched CommandInstance + */ + public function fetch() { + $params = Values::of(array()); + + $payload = $this->version->fetch( + 'GET', + $this->uri, + $params + ); + + return new CommandInstance( + $this->version, + $payload, + $this->solution['sid'] + ); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + $context = array(); + foreach ($this->solution as $key => $value) { + $context[] = "$key=$value"; + } + return '[Twilio.Preview.Wireless.CommandContext ' . implode(' ', $context) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Wireless/CommandInstance.php b/Twilio/Rest/Preview/Wireless/CommandInstance.php new file mode 100644 index 0000000..597347a --- /dev/null +++ b/Twilio/Rest/Preview/Wireless/CommandInstance.php @@ -0,0 +1,117 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Wireless; + +use Twilio\Deserialize; +use Twilio\Exceptions\TwilioException; +use Twilio\InstanceResource; +use Twilio\Version; + +/** + * @property string sid + * @property string accountSid + * @property string deviceSid + * @property string command + * @property string status + * @property string direction + * @property \DateTime dateCreated + * @property \DateTime dateUpdated + * @property string url + */ +class CommandInstance extends InstanceResource { + /** + * Initialize the CommandInstance + * + * @param \Twilio\Version $version Version that contains the resource + * @param mixed[] $payload The response payload + * @param string $sid The sid + * @return \Twilio\Rest\Preview\Wireless\CommandInstance + */ + public function __construct(Version $version, array $payload, $sid = null) { + parent::__construct($version); + + // Marshaled Properties + $this->properties = array( + 'sid' => $payload['sid'], + 'accountSid' => $payload['account_sid'], + 'deviceSid' => $payload['device_sid'], + 'command' => $payload['command'], + 'status' => $payload['status'], + 'direction' => $payload['direction'], + 'dateCreated' => Deserialize::iso8601DateTime($payload['date_created']), + 'dateUpdated' => Deserialize::iso8601DateTime($payload['date_updated']), + 'url' => $payload['url'], + ); + + $this->solution = array( + 'sid' => $sid ?: $this->properties['sid'], + ); + } + + /** + * Generate an instance context for the instance, the context is capable of + * performing various actions. All instance actions are proxied to the context + * + * @return \Twilio\Rest\Preview\Wireless\CommandContext Context for this + * CommandInstance + */ + protected function proxy() { + if (!$this->context) { + $this->context = new CommandContext( + $this->version, + $this->solution['sid'] + ); + } + + return $this->context; + } + + /** + * Fetch a CommandInstance + * + * @return CommandInstance Fetched CommandInstance + */ + public function fetch() { + return $this->proxy()->fetch(); + } + + /** + * Magic getter to access properties + * + * @param string $name Property to access + * @return mixed The requested property + * @throws TwilioException For unknown properties + */ + public function __get($name) { + if (array_key_exists($name, $this->properties)) { + return $this->properties[$name]; + } + + if (property_exists($this, '_' . $name)) { + $method = 'get' . ucfirst($name); + return $this->$method(); + } + + throw new TwilioException('Unknown property: ' . $name); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + $context = array(); + foreach ($this->solution as $key => $value) { + $context[] = "$key=$value"; + } + return '[Twilio.Preview.Wireless.CommandInstance ' . implode(' ', $context) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Wireless/CommandList.php b/Twilio/Rest/Preview/Wireless/CommandList.php new file mode 100644 index 0000000..de60d86 --- /dev/null +++ b/Twilio/Rest/Preview/Wireless/CommandList.php @@ -0,0 +1,161 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Wireless; + +use Twilio\ListResource; +use Twilio\Values; +use Twilio\Version; + +class CommandList extends ListResource { + /** + * Construct the CommandList + * + * @param Version $version Version that contains the resource + * @return \Twilio\Rest\Preview\Wireless\CommandList + */ + public function __construct(Version $version) { + parent::__construct($version); + + // Path Solution + $this->solution = array(); + + $this->uri = '/Commands'; + } + + /** + * Streams CommandInstance records from the API as a generator stream. + * This operation lazily loads records as efficiently as possible until the + * limit + * is reached. + * The results are returned as a generator, so this operation is memory + * efficient. + * + * @param array $options Optional Arguments + * @param int $limit Upper limit for the number of records to return. stream() + * guarantees to never return more than limit. Default is no + * limit + * @param mixed $pageSize Number of records to fetch per request, when not set + * will use the default value of 50 records. If no + * page_size is defined but a limit is defined, stream() + * will attempt to read the limit with the most + * efficient page size, i.e. min(limit, 1000) + * @return \Twilio\Stream stream of results + */ + public function stream(array $options = array(), $limit = null, $pageSize = null) { + $limits = $this->version->readLimits($limit, $pageSize); + + $page = $this->page($options, $limits['pageSize']); + + return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); + } + + /** + * Reads CommandInstance records from the API as a list. + * Unlike stream(), this operation is eager and will load `limit` records into + * memory before returning. + * + * @param array $options Optional Arguments + * @param int $limit Upper limit for the number of records to return. read() + * guarantees to never return more than limit. Default is no + * limit + * @param mixed $pageSize Number of records to fetch per request, when not set + * will use the default value of 50 records. If no + * page_size is defined but a limit is defined, read() + * will attempt to read the limit with the most + * efficient page size, i.e. min(limit, 1000) + * @return CommandInstance[] Array of results + */ + public function read(array $options = array(), $limit = null, $pageSize = Values::NONE) { + return iterator_to_array($this->stream($options, $limit, $pageSize), false); + } + + /** + * Retrieve a single page of CommandInstance records from the API. + * Request is executed immediately + * + * @param array $options Optional Arguments + * @param mixed $pageSize Number of records to return, defaults to 50 + * @param string $pageToken PageToken provided by the API + * @param mixed $pageNumber Page Number, this value is simply for client state + * @return \Twilio\Page Page of CommandInstance + */ + public function page(array $options = array(), $pageSize = Values::NONE, $pageToken = Values::NONE, $pageNumber = Values::NONE) { + $options = new Values($options); + $params = Values::of(array( + 'Device' => $options['device'], + 'Status' => $options['status'], + 'Direction' => $options['direction'], + 'PageToken' => $pageToken, + 'Page' => $pageNumber, + 'PageSize' => $pageSize, + )); + + $response = $this->version->page( + 'GET', + $this->uri, + $params + ); + + return new CommandPage($this->version, $response, $this->solution); + } + + /** + * Create a new CommandInstance + * + * @param string $device The device + * @param string $command The command + * @param array $options Optional Arguments + * @return CommandInstance Newly created CommandInstance + */ + public function create($device, $command, array $options = array()) { + $options = new Values($options); + + $data = Values::of(array( + 'Device' => $device, + 'Command' => $command, + 'CallbackMethod' => $options['callbackMethod'], + 'CallbackUrl' => $options['callbackUrl'], + )); + + $payload = $this->version->create( + 'POST', + $this->uri, + array(), + $data + ); + + return new CommandInstance( + $this->version, + $payload + ); + } + + /** + * Constructs a CommandContext + * + * @param string $sid The sid + * @return \Twilio\Rest\Preview\Wireless\CommandContext + */ + public function getContext($sid) { + return new CommandContext( + $this->version, + $sid + ); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + return '[Twilio.Preview.Wireless.CommandList]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Wireless/CommandPage.php b/Twilio/Rest/Preview/Wireless/CommandPage.php new file mode 100644 index 0000000..b7e8b3d --- /dev/null +++ b/Twilio/Rest/Preview/Wireless/CommandPage.php @@ -0,0 +1,37 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Wireless; + +use Twilio\Page; + +class CommandPage extends Page { + public function __construct($version, $response, $solution) { + parent::__construct($version, $response); + + // Path Solution + $this->solution = $solution; + } + + public function buildInstance(array $payload) { + return new CommandInstance( + $this->version, + $payload + ); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + return '[Twilio.Preview.Wireless.CommandPage]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Wireless/Device/UsageContext.php b/Twilio/Rest/Preview/Wireless/Device/UsageContext.php new file mode 100644 index 0000000..14928f1 --- /dev/null +++ b/Twilio/Rest/Preview/Wireless/Device/UsageContext.php @@ -0,0 +1,74 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Wireless\Device; + +use Twilio\InstanceContext; +use Twilio\Values; +use Twilio\Version; + +class UsageContext extends InstanceContext { + /** + * Initialize the UsageContext + * + * @param \Twilio\Version $version Version that contains the resource + * @param string $deviceSid The device_sid + * @return \Twilio\Rest\Preview\Wireless\Device\UsageContext + */ + public function __construct(Version $version, $deviceSid) { + parent::__construct($version); + + // Path Solution + $this->solution = array( + 'deviceSid' => $deviceSid, + ); + + $this->uri = '/Devices/' . $deviceSid . '/Usage'; + } + + /** + * Fetch a UsageInstance + * + * @param array $options Optional Arguments + * @return UsageInstance Fetched UsageInstance + */ + public function fetch(array $options = array()) { + $options = new Values($options); + + $params = Values::of(array( + 'End' => $options['end'], + 'Start' => $options['start'], + )); + + $payload = $this->version->fetch( + 'GET', + $this->uri, + $params + ); + + return new UsageInstance( + $this->version, + $payload, + $this->solution['deviceSid'] + ); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + $context = array(); + foreach ($this->solution as $key => $value) { + $context[] = "$key=$value"; + } + return '[Twilio.Preview.Wireless.UsageContext ' . implode(' ', $context) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Wireless/Device/UsageInstance.php b/Twilio/Rest/Preview/Wireless/Device/UsageInstance.php new file mode 100644 index 0000000..25ebf1f --- /dev/null +++ b/Twilio/Rest/Preview/Wireless/Device/UsageInstance.php @@ -0,0 +1,119 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Wireless\Device; + +use Twilio\Exceptions\TwilioException; +use Twilio\InstanceResource; +use Twilio\Version; + +/** + * @property string deviceSid + * @property string deviceAlias + * @property string accountSid + * @property string period + * @property string commandsUsage + * @property string commandsCosts + * @property string dataUsage + * @property string dataCosts + * @property string url + */ +class UsageInstance extends InstanceResource { + /** + * Initialize the UsageInstance + * + * @param \Twilio\Version $version Version that contains the resource + * @param mixed[] $payload The response payload + * @param string $deviceSid The device_sid + * @return \Twilio\Rest\Preview\Wireless\Device\UsageInstance + */ + public function __construct(Version $version, array $payload, $deviceSid) { + parent::__construct($version); + + // Marshaled Properties + $this->properties = array( + 'deviceSid' => $payload['device_sid'], + 'deviceAlias' => $payload['device_alias'], + 'accountSid' => $payload['account_sid'], + 'period' => $payload['period'], + 'commandsUsage' => $payload['commands_usage'], + 'commandsCosts' => $payload['commands_costs'], + 'dataUsage' => $payload['data_usage'], + 'dataCosts' => $payload['data_costs'], + 'url' => $payload['url'], + ); + + $this->solution = array( + 'deviceSid' => $deviceSid, + ); + } + + /** + * Generate an instance context for the instance, the context is capable of + * performing various actions. All instance actions are proxied to the context + * + * @return \Twilio\Rest\Preview\Wireless\Device\UsageContext Context for this + * UsageInstance + */ + protected function proxy() { + if (!$this->context) { + $this->context = new UsageContext( + $this->version, + $this->solution['deviceSid'] + ); + } + + return $this->context; + } + + /** + * Fetch a UsageInstance + * + * @param array $options Optional Arguments + * @return UsageInstance Fetched UsageInstance + */ + public function fetch(array $options = array()) { + return $this->proxy()->fetch( + $options + ); + } + + /** + * Magic getter to access properties + * + * @param string $name Property to access + * @return mixed The requested property + * @throws TwilioException For unknown properties + */ + public function __get($name) { + if (array_key_exists($name, $this->properties)) { + return $this->properties[$name]; + } + + if (property_exists($this, '_' . $name)) { + $method = 'get' . ucfirst($name); + return $this->$method(); + } + + throw new TwilioException('Unknown property: ' . $name); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + $context = array(); + foreach ($this->solution as $key => $value) { + $context[] = "$key=$value"; + } + return '[Twilio.Preview.Wireless.UsageInstance ' . implode(' ', $context) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Wireless/Device/UsageList.php b/Twilio/Rest/Preview/Wireless/Device/UsageList.php new file mode 100644 index 0000000..59d25e6 --- /dev/null +++ b/Twilio/Rest/Preview/Wireless/Device/UsageList.php @@ -0,0 +1,52 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Wireless\Device; + +use Twilio\ListResource; +use Twilio\Version; + +class UsageList extends ListResource { + /** + * Construct the UsageList + * + * @param Version $version Version that contains the resource + * @param string $deviceSid The device_sid + * @return \Twilio\Rest\Preview\Wireless\Device\UsageList + */ + public function __construct(Version $version, $deviceSid) { + parent::__construct($version); + + // Path Solution + $this->solution = array( + 'deviceSid' => $deviceSid, + ); + } + + /** + * Constructs a UsageContext + * + * @return \Twilio\Rest\Preview\Wireless\Device\UsageContext + */ + public function getContext() { + return new UsageContext( + $this->version, + $this->solution['deviceSid'] + ); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + return '[Twilio.Preview.Wireless.UsageList]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Wireless/Device/UsagePage.php b/Twilio/Rest/Preview/Wireless/Device/UsagePage.php new file mode 100644 index 0000000..d35524f --- /dev/null +++ b/Twilio/Rest/Preview/Wireless/Device/UsagePage.php @@ -0,0 +1,38 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Wireless\Device; + +use Twilio\Page; + +class UsagePage extends Page { + public function __construct($version, $response, $solution) { + parent::__construct($version, $response); + + // Path Solution + $this->solution = $solution; + } + + public function buildInstance(array $payload) { + return new UsageInstance( + $this->version, + $payload, + $this->solution['deviceSid'] + ); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + return '[Twilio.Preview.Wireless.UsagePage]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Wireless/DeviceContext.php b/Twilio/Rest/Preview/Wireless/DeviceContext.php new file mode 100644 index 0000000..8509d72 --- /dev/null +++ b/Twilio/Rest/Preview/Wireless/DeviceContext.php @@ -0,0 +1,159 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Wireless; + +use Twilio\Exceptions\TwilioException; +use Twilio\InstanceContext; +use Twilio\Rest\Preview\Wireless\Device\UsageList; +use Twilio\Values; +use Twilio\Version; + +/** + * @property \Twilio\Rest\Preview\Wireless\Device\UsageList usage + * @method \Twilio\Rest\Preview\Wireless\Device\UsageContext usage() + */ +class DeviceContext extends InstanceContext { + protected $_usage = null; + + /** + * Initialize the DeviceContext + * + * @param \Twilio\Version $version Version that contains the resource + * @param string $sid The sid + * @return \Twilio\Rest\Preview\Wireless\DeviceContext + */ + public function __construct(Version $version, $sid) { + parent::__construct($version); + + // Path Solution + $this->solution = array( + 'sid' => $sid, + ); + + $this->uri = '/Devices/' . $sid . ''; + } + + /** + * Fetch a DeviceInstance + * + * @return DeviceInstance Fetched DeviceInstance + */ + public function fetch() { + $params = Values::of(array()); + + $payload = $this->version->fetch( + 'GET', + $this->uri, + $params + ); + + return new DeviceInstance( + $this->version, + $payload, + $this->solution['sid'] + ); + } + + /** + * Update the DeviceInstance + * + * @param array $options Optional Arguments + * @return DeviceInstance Updated DeviceInstance + */ + public function update(array $options = array()) { + $options = new Values($options); + + $data = Values::of(array( + 'Alias' => $options['alias'], + 'CallbackMethod' => $options['callbackMethod'], + 'CallbackUrl' => $options['callbackUrl'], + 'FriendlyName' => $options['friendlyName'], + 'SimIdentifier' => $options['simIdentifier'], + 'Status' => $options['status'], + 'CommandsCallbackMethod' => $options['commandsCallbackMethod'], + 'CommandsCallbackUrl' => $options['commandsCallbackUrl'], + )); + + $payload = $this->version->update( + 'POST', + $this->uri, + array(), + $data + ); + + return new DeviceInstance( + $this->version, + $payload, + $this->solution['sid'] + ); + } + + /** + * Access the usage + * + * @return \Twilio\Rest\Preview\Wireless\Device\UsageList + */ + protected function getUsage() { + if (!$this->_usage) { + $this->_usage = new UsageList( + $this->version, + $this->solution['sid'] + ); + } + + return $this->_usage; + } + + /** + * Magic getter to lazy load subresources + * + * @param string $name Subresource to return + * @return \Twilio\ListResource The requested subresource + * @throws \Twilio\Exceptions\TwilioException For unknown subresources + */ + public function __get($name) { + if (property_exists($this, '_' . $name)) { + $method = 'get' . ucfirst($name); + return $this->$method(); + } + + throw new TwilioException('Unknown subresource ' . $name); + } + + /** + * Magic caller to get resource contexts + * + * @param string $name Resource to return + * @param array $arguments Context parameters + * @return \Twilio\InstanceContext The requested resource context + * @throws \Twilio\Exceptions\TwilioException For unknown resource + */ + public function __call($name, $arguments) { + $property = $this->$name; + if (method_exists($property, 'getContext')) { + return call_user_func_array(array($property, 'getContext'), $arguments); + } + + throw new TwilioException('Resource does not have a context'); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + $context = array(); + foreach ($this->solution as $key => $value) { + $context[] = "$key=$value"; + } + return '[Twilio.Preview.Wireless.DeviceContext ' . implode(' ', $context) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Wireless/DeviceInstance.php b/Twilio/Rest/Preview/Wireless/DeviceInstance.php new file mode 100644 index 0000000..79257c2 --- /dev/null +++ b/Twilio/Rest/Preview/Wireless/DeviceInstance.php @@ -0,0 +1,148 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Wireless; + +use Twilio\Deserialize; +use Twilio\Exceptions\TwilioException; +use Twilio\InstanceResource; +use Twilio\Version; + +/** + * @property string sid + * @property string alias + * @property string accountSid + * @property string ratePlanSid + * @property string friendlyName + * @property string simIdentifier + * @property string status + * @property string commandsCallbackUrl + * @property string commandsCallbackMethod + * @property \DateTime dateCreated + * @property \DateTime dateUpdated + * @property string url + * @property string links + */ +class DeviceInstance extends InstanceResource { + protected $_usage = null; + + /** + * Initialize the DeviceInstance + * + * @param \Twilio\Version $version Version that contains the resource + * @param mixed[] $payload The response payload + * @param string $sid The sid + * @return \Twilio\Rest\Preview\Wireless\DeviceInstance + */ + public function __construct(Version $version, array $payload, $sid = null) { + parent::__construct($version); + + // Marshaled Properties + $this->properties = array( + 'sid' => $payload['sid'], + 'alias' => $payload['alias'], + 'accountSid' => $payload['account_sid'], + 'ratePlanSid' => $payload['rate_plan_sid'], + 'friendlyName' => $payload['friendly_name'], + 'simIdentifier' => $payload['sim_identifier'], + 'status' => $payload['status'], + 'commandsCallbackUrl' => $payload['commands_callback_url'], + 'commandsCallbackMethod' => $payload['commands_callback_method'], + 'dateCreated' => Deserialize::iso8601DateTime($payload['date_created']), + 'dateUpdated' => Deserialize::iso8601DateTime($payload['date_updated']), + 'url' => $payload['url'], + 'links' => $payload['links'], + ); + + $this->solution = array( + 'sid' => $sid ?: $this->properties['sid'], + ); + } + + /** + * Generate an instance context for the instance, the context is capable of + * performing various actions. All instance actions are proxied to the context + * + * @return \Twilio\Rest\Preview\Wireless\DeviceContext Context for this + * DeviceInstance + */ + protected function proxy() { + if (!$this->context) { + $this->context = new DeviceContext( + $this->version, + $this->solution['sid'] + ); + } + + return $this->context; + } + + /** + * Fetch a DeviceInstance + * + * @return DeviceInstance Fetched DeviceInstance + */ + public function fetch() { + return $this->proxy()->fetch(); + } + + /** + * Update the DeviceInstance + * + * @param array $options Optional Arguments + * @return DeviceInstance Updated DeviceInstance + */ + public function update(array $options = array()) { + return $this->proxy()->update( + $options + ); + } + + /** + * Access the usage + * + * @return \Twilio\Rest\Preview\Wireless\Device\UsageList + */ + protected function getUsage() { + return $this->proxy()->usage; + } + + /** + * Magic getter to access properties + * + * @param string $name Property to access + * @return mixed The requested property + * @throws TwilioException For unknown properties + */ + public function __get($name) { + if (array_key_exists($name, $this->properties)) { + return $this->properties[$name]; + } + + if (property_exists($this, '_' . $name)) { + $method = 'get' . ucfirst($name); + return $this->$method(); + } + + throw new TwilioException('Unknown property: ' . $name); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + $context = array(); + foreach ($this->solution as $key => $value) { + $context[] = "$key=$value"; + } + return '[Twilio.Preview.Wireless.DeviceInstance ' . implode(' ', $context) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Wireless/DeviceList.php b/Twilio/Rest/Preview/Wireless/DeviceList.php new file mode 100644 index 0000000..960bcbf --- /dev/null +++ b/Twilio/Rest/Preview/Wireless/DeviceList.php @@ -0,0 +1,165 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Wireless; + +use Twilio\ListResource; +use Twilio\Values; +use Twilio\Version; + +class DeviceList extends ListResource { + /** + * Construct the DeviceList + * + * @param Version $version Version that contains the resource + * @return \Twilio\Rest\Preview\Wireless\DeviceList + */ + public function __construct(Version $version) { + parent::__construct($version); + + // Path Solution + $this->solution = array(); + + $this->uri = '/Devices'; + } + + /** + * Streams DeviceInstance records from the API as a generator stream. + * This operation lazily loads records as efficiently as possible until the + * limit + * is reached. + * The results are returned as a generator, so this operation is memory + * efficient. + * + * @param array $options Optional Arguments + * @param int $limit Upper limit for the number of records to return. stream() + * guarantees to never return more than limit. Default is no + * limit + * @param mixed $pageSize Number of records to fetch per request, when not set + * will use the default value of 50 records. If no + * page_size is defined but a limit is defined, stream() + * will attempt to read the limit with the most + * efficient page size, i.e. min(limit, 1000) + * @return \Twilio\Stream stream of results + */ + public function stream(array $options = array(), $limit = null, $pageSize = null) { + $limits = $this->version->readLimits($limit, $pageSize); + + $page = $this->page($options, $limits['pageSize']); + + return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); + } + + /** + * Reads DeviceInstance records from the API as a list. + * Unlike stream(), this operation is eager and will load `limit` records into + * memory before returning. + * + * @param array $options Optional Arguments + * @param int $limit Upper limit for the number of records to return. read() + * guarantees to never return more than limit. Default is no + * limit + * @param mixed $pageSize Number of records to fetch per request, when not set + * will use the default value of 50 records. If no + * page_size is defined but a limit is defined, read() + * will attempt to read the limit with the most + * efficient page size, i.e. min(limit, 1000) + * @return DeviceInstance[] Array of results + */ + public function read(array $options = array(), $limit = null, $pageSize = Values::NONE) { + return iterator_to_array($this->stream($options, $limit, $pageSize), false); + } + + /** + * Retrieve a single page of DeviceInstance records from the API. + * Request is executed immediately + * + * @param array $options Optional Arguments + * @param mixed $pageSize Number of records to return, defaults to 50 + * @param string $pageToken PageToken provided by the API + * @param mixed $pageNumber Page Number, this value is simply for client state + * @return \Twilio\Page Page of DeviceInstance + */ + public function page(array $options = array(), $pageSize = Values::NONE, $pageToken = Values::NONE, $pageNumber = Values::NONE) { + $options = new Values($options); + $params = Values::of(array( + 'Status' => $options['status'], + 'SimIdentifier' => $options['simIdentifier'], + 'RatePlan' => $options['ratePlan'], + 'PageToken' => $pageToken, + 'Page' => $pageNumber, + 'PageSize' => $pageSize, + )); + + $response = $this->version->page( + 'GET', + $this->uri, + $params + ); + + return new DevicePage($this->version, $response, $this->solution); + } + + /** + * Create a new DeviceInstance + * + * @param string $ratePlan The rate_plan + * @param array $options Optional Arguments + * @return DeviceInstance Newly created DeviceInstance + */ + public function create($ratePlan, array $options = array()) { + $options = new Values($options); + + $data = Values::of(array( + 'RatePlan' => $ratePlan, + 'Alias' => $options['alias'], + 'CallbackMethod' => $options['callbackMethod'], + 'CallbackUrl' => $options['callbackUrl'], + 'FriendlyName' => $options['friendlyName'], + 'SimIdentifier' => $options['simIdentifier'], + 'Status' => $options['status'], + 'CommandsCallbackMethod' => $options['commandsCallbackMethod'], + 'CommandsCallbackUrl' => $options['commandsCallbackUrl'], + )); + + $payload = $this->version->create( + 'POST', + $this->uri, + array(), + $data + ); + + return new DeviceInstance( + $this->version, + $payload + ); + } + + /** + * Constructs a DeviceContext + * + * @param string $sid The sid + * @return \Twilio\Rest\Preview\Wireless\DeviceContext + */ + public function getContext($sid) { + return new DeviceContext( + $this->version, + $sid + ); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + return '[Twilio.Preview.Wireless.DeviceList]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Wireless/DevicePage.php b/Twilio/Rest/Preview/Wireless/DevicePage.php new file mode 100644 index 0000000..fb04329 --- /dev/null +++ b/Twilio/Rest/Preview/Wireless/DevicePage.php @@ -0,0 +1,37 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Wireless; + +use Twilio\Page; + +class DevicePage extends Page { + public function __construct($version, $response, $solution) { + parent::__construct($version, $response); + + // Path Solution + $this->solution = $solution; + } + + public function buildInstance(array $payload) { + return new DeviceInstance( + $this->version, + $payload + ); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + return '[Twilio.Preview.Wireless.DevicePage]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Wireless/RatePlanContext.php b/Twilio/Rest/Preview/Wireless/RatePlanContext.php new file mode 100644 index 0000000..30c6aa4 --- /dev/null +++ b/Twilio/Rest/Preview/Wireless/RatePlanContext.php @@ -0,0 +1,68 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Wireless; + +use Twilio\InstanceContext; +use Twilio\Values; +use Twilio\Version; + +class RatePlanContext extends InstanceContext { + /** + * Initialize the RatePlanContext + * + * @param \Twilio\Version $version Version that contains the resource + * @param string $sid The sid + * @return \Twilio\Rest\Preview\Wireless\RatePlanContext + */ + public function __construct(Version $version, $sid) { + parent::__construct($version); + + // Path Solution + $this->solution = array( + 'sid' => $sid, + ); + + $this->uri = '/RatePlans/' . $sid . ''; + } + + /** + * Fetch a RatePlanInstance + * + * @return RatePlanInstance Fetched RatePlanInstance + */ + public function fetch() { + $params = Values::of(array()); + + $payload = $this->version->fetch( + 'GET', + $this->uri, + $params + ); + + return new RatePlanInstance( + $this->version, + $payload, + $this->solution['sid'] + ); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + $context = array(); + foreach ($this->solution as $key => $value) { + $context[] = "$key=$value"; + } + return '[Twilio.Preview.Wireless.RatePlanContext ' . implode(' ', $context) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Wireless/RatePlanInstance.php b/Twilio/Rest/Preview/Wireless/RatePlanInstance.php new file mode 100644 index 0000000..d5212b8 --- /dev/null +++ b/Twilio/Rest/Preview/Wireless/RatePlanInstance.php @@ -0,0 +1,129 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Wireless; + +use Twilio\Deserialize; +use Twilio\Exceptions\TwilioException; +use Twilio\InstanceResource; +use Twilio\Version; + +/** + * @property string sid + * @property string alias + * @property string accountSid + * @property string friendlyName + * @property string dataMetering + * @property string capabilities + * @property string voiceCap + * @property string messagingCap + * @property string commandsCap + * @property string dataCap + * @property string capPeriod + * @property string capUnit + * @property \DateTime dateCreated + * @property \DateTime dateUpdated + * @property string url + */ +class RatePlanInstance extends InstanceResource { + /** + * Initialize the RatePlanInstance + * + * @param \Twilio\Version $version Version that contains the resource + * @param mixed[] $payload The response payload + * @param string $sid The sid + * @return \Twilio\Rest\Preview\Wireless\RatePlanInstance + */ + public function __construct(Version $version, array $payload, $sid = null) { + parent::__construct($version); + + // Marshaled Properties + $this->properties = array( + 'sid' => $payload['sid'], + 'alias' => $payload['alias'], + 'accountSid' => $payload['account_sid'], + 'friendlyName' => $payload['friendly_name'], + 'dataMetering' => $payload['data_metering'], + 'capabilities' => $payload['capabilities'], + 'voiceCap' => $payload['voice_cap'], + 'messagingCap' => $payload['messaging_cap'], + 'commandsCap' => $payload['commands_cap'], + 'dataCap' => $payload['data_cap'], + 'capPeriod' => $payload['cap_period'], + 'capUnit' => $payload['cap_unit'], + 'dateCreated' => Deserialize::iso8601DateTime($payload['date_created']), + 'dateUpdated' => Deserialize::iso8601DateTime($payload['date_updated']), + 'url' => $payload['url'], + ); + + $this->solution = array( + 'sid' => $sid ?: $this->properties['sid'], + ); + } + + /** + * Generate an instance context for the instance, the context is capable of + * performing various actions. All instance actions are proxied to the context + * + * @return \Twilio\Rest\Preview\Wireless\RatePlanContext Context for this + * RatePlanInstance + */ + protected function proxy() { + if (!$this->context) { + $this->context = new RatePlanContext( + $this->version, + $this->solution['sid'] + ); + } + + return $this->context; + } + + /** + * Fetch a RatePlanInstance + * + * @return RatePlanInstance Fetched RatePlanInstance + */ + public function fetch() { + return $this->proxy()->fetch(); + } + + /** + * Magic getter to access properties + * + * @param string $name Property to access + * @return mixed The requested property + * @throws TwilioException For unknown properties + */ + public function __get($name) { + if (array_key_exists($name, $this->properties)) { + return $this->properties[$name]; + } + + if (property_exists($this, '_' . $name)) { + $method = 'get' . ucfirst($name); + return $this->$method(); + } + + throw new TwilioException('Unknown property: ' . $name); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + $context = array(); + foreach ($this->solution as $key => $value) { + $context[] = "$key=$value"; + } + return '[Twilio.Preview.Wireless.RatePlanInstance ' . implode(' ', $context) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Wireless/RatePlanList.php b/Twilio/Rest/Preview/Wireless/RatePlanList.php new file mode 100644 index 0000000..6017b7d --- /dev/null +++ b/Twilio/Rest/Preview/Wireless/RatePlanList.php @@ -0,0 +1,123 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Wireless; + +use Twilio\ListResource; +use Twilio\Values; +use Twilio\Version; + +class RatePlanList extends ListResource { + /** + * Construct the RatePlanList + * + * @param Version $version Version that contains the resource + * @return \Twilio\Rest\Preview\Wireless\RatePlanList + */ + public function __construct(Version $version) { + parent::__construct($version); + + // Path Solution + $this->solution = array(); + + $this->uri = '/RatePlans'; + } + + /** + * Streams RatePlanInstance records from the API as a generator stream. + * This operation lazily loads records as efficiently as possible until the + * limit + * is reached. + * The results are returned as a generator, so this operation is memory + * efficient. + * + * @param int $limit Upper limit for the number of records to return. stream() + * guarantees to never return more than limit. Default is no + * limit + * @param mixed $pageSize Number of records to fetch per request, when not set + * will use the default value of 50 records. If no + * page_size is defined but a limit is defined, stream() + * will attempt to read the limit with the most + * efficient page size, i.e. min(limit, 1000) + * @return \Twilio\Stream stream of results + */ + public function stream($limit = null, $pageSize = null) { + $limits = $this->version->readLimits($limit, $pageSize); + + $page = $this->page($limits['pageSize']); + + return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); + } + + /** + * Reads RatePlanInstance records from the API as a list. + * Unlike stream(), this operation is eager and will load `limit` records into + * memory before returning. + * + * @param int $limit Upper limit for the number of records to return. read() + * guarantees to never return more than limit. Default is no + * limit + * @param mixed $pageSize Number of records to fetch per request, when not set + * will use the default value of 50 records. If no + * page_size is defined but a limit is defined, read() + * will attempt to read the limit with the most + * efficient page size, i.e. min(limit, 1000) + * @return RatePlanInstance[] Array of results + */ + public function read($limit = null, $pageSize = Values::NONE) { + return iterator_to_array($this->stream($limit, $pageSize), false); + } + + /** + * Retrieve a single page of RatePlanInstance records from the API. + * Request is executed immediately + * + * @param mixed $pageSize Number of records to return, defaults to 50 + * @param string $pageToken PageToken provided by the API + * @param mixed $pageNumber Page Number, this value is simply for client state + * @return \Twilio\Page Page of RatePlanInstance + */ + public function page($pageSize = Values::NONE, $pageToken = Values::NONE, $pageNumber = Values::NONE) { + $params = Values::of(array( + 'PageToken' => $pageToken, + 'Page' => $pageNumber, + 'PageSize' => $pageSize, + )); + + $response = $this->version->page( + 'GET', + $this->uri, + $params + ); + + return new RatePlanPage($this->version, $response, $this->solution); + } + + /** + * Constructs a RatePlanContext + * + * @param string $sid The sid + * @return \Twilio\Rest\Preview\Wireless\RatePlanContext + */ + public function getContext($sid) { + return new RatePlanContext( + $this->version, + $sid + ); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + return '[Twilio.Preview.Wireless.RatePlanList]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Wireless/RatePlanPage.php b/Twilio/Rest/Preview/Wireless/RatePlanPage.php new file mode 100644 index 0000000..ceb2fcc --- /dev/null +++ b/Twilio/Rest/Preview/Wireless/RatePlanPage.php @@ -0,0 +1,37 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Wireless; + +use Twilio\Page; + +class RatePlanPage extends Page { + public function __construct($version, $response, $solution) { + parent::__construct($version, $response); + + // Path Solution + $this->solution = $solution; + } + + public function buildInstance(array $payload) { + return new RatePlanInstance( + $this->version, + $payload + ); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + return '[Twilio.Preview.Wireless.RatePlanPage]'; + } +}
\ No newline at end of file |