diff options
92 files changed, 10328 insertions, 7 deletions
@@ -1,7 +1,6 @@ MIT License -Copyright (C) 2011, Twilio, Inc. <help at twilio dot com> -Copyright (C) 2011, Neuman Vong <neuman at twilio dot com> +Copyright (C) 2016, Twilio, Inc. <help at twilio dot com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in @@ -9,7 +9,7 @@ define LICENSE * * @category Services * @package Services_Twilio - * @author Neuman Vong <neuman@twilio.com> + * @author Twilio <help@twilio.com> * @license http://creativecommons.org/licenses/MIT/ MIT * @link http://pear.php.net/package/Services_Twilio */ diff --git a/Twilio/Rest/Client.php b/Twilio/Rest/Client.php index 37489df..34dd741 100644 --- a/Twilio/Rest/Client.php +++ b/Twilio/Rest/Client.php @@ -23,6 +23,8 @@ use Twilio\VersionInfo; * @property \Twilio\Rest\IpMessaging ipMessaging * @property \Twilio\Rest\Lookups lookups * @property \Twilio\Rest\Monitor monitor + * @property \Twilio\Rest\Notify notify + * @property \Twilio\Rest\Preview preview * @property \Twilio\Rest\Pricing pricing * @property \Twilio\Rest\Taskrouter taskrouter * @property \Twilio\Rest\Trunking trunking @@ -87,6 +89,8 @@ class Client { protected $_ipMessaging = null; protected $_lookups = null; protected $_monitor = null; + protected $_notify = null; + protected $_preview = null; protected $_pricing = null; protected $_taskrouter = null; protected $_trunking = null; @@ -638,6 +642,30 @@ class Client { } /** + * Access the Notify Twilio Domain + * + * @return \Twilio\Rest\Notify Notify Twilio Domain + */ + protected function getNotify() { + if (!$this->_notify) { + $this->_notify = new Notify($this); + } + return $this->_notify; + } + + /** + * Access the Preview Twilio Domain + * + * @return \Twilio\Rest\Preview Preview Twilio Domain + */ + protected function getPreview() { + if (!$this->_preview) { + $this->_preview = new Preview($this); + } + return $this->_preview; + } + + /** * Access the Pricing Twilio Domain * * @return \Twilio\Rest\Pricing Pricing Twilio Domain diff --git a/Twilio/Rest/Notify.php b/Twilio/Rest/Notify.php new file mode 100644 index 0000000..6138ae5 --- /dev/null +++ b/Twilio/Rest/Notify.php @@ -0,0 +1,120 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest; + +use Twilio\Domain; +use Twilio\Exceptions\TwilioException; +use Twilio\Rest\Notify\V1; + +/** + * @property \Twilio\Rest\Notify\V1 v1 + * @property \Twilio\Rest\Notify\V1\CredentialList credentials + * @property \Twilio\Rest\Notify\V1\ServiceList services + * @method \Twilio\Rest\Notify\V1\CredentialContext credentials(string $sid) + * @method \Twilio\Rest\Notify\V1\ServiceContext services(string $sid) + */ +class Notify extends Domain { + protected $_v1 = null; + + /** + * Construct the Notify Domain + * + * @param \Twilio\Rest\Client $client Twilio\Rest\Client to communicate with + * Twilio + * @return \Twilio\Rest\Notify Domain for Notify + */ + public function __construct(Client $client) { + parent::__construct($client); + + $this->baseUrl = 'https://notify.twilio.com'; + } + + /** + * @return \Twilio\Rest\Notify\V1 Version v1 of notify + */ + protected function getV1() { + if (!$this->_v1) { + $this->_v1 = new V1($this); + } + return $this->_v1; + } + + /** + * Magic getter to lazy load version + * + * @param string $name Version to return + * @return \Twilio\Version The requested version + * @throws \Twilio\Exceptions\TwilioException For unknown versions + */ + public function __get($name) { + $method = 'get' . ucfirst($name); + if (method_exists($this, $method)) { + return $this->$method(); + } + + throw new TwilioException('Unknown version ' . $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) { + $method = 'context' . ucfirst($name); + if (method_exists($this, $method)) { + return call_user_func_array(array($this, $method), $arguments); + } + + throw new TwilioException('Unknown context ' . $name); + } + + /** + * @return \Twilio\Rest\Notify\V1\CredentialList + */ + protected function getCredentials() { + return $this->v1->credentials; + } + + /** + * @param string $sid The sid + * @return \Twilio\Rest\Notify\V1\CredentialContext + */ + protected function contextCredentials($sid) { + return $this->v1->credentials($sid); + } + + /** + * @return \Twilio\Rest\Notify\V1\ServiceList + */ + protected function getServices() { + return $this->v1->services; + } + + /** + * @param string $sid The sid + * @return \Twilio\Rest\Notify\V1\ServiceContext + */ + protected function contextServices($sid) { + return $this->v1->services($sid); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + return '[Twilio.Notify]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Notify/V1.php b/Twilio/Rest/Notify/V1.php new file mode 100644 index 0000000..eb888fe --- /dev/null +++ b/Twilio/Rest/Notify/V1.php @@ -0,0 +1,100 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Notify; + +use Twilio\Domain; +use Twilio\Exceptions\TwilioException; +use Twilio\Rest\Notify\V1\CredentialList; +use Twilio\Rest\Notify\V1\ServiceList; +use Twilio\Version; + +/** + * @property \Twilio\Rest\Notify\V1\CredentialList credentials + * @property \Twilio\Rest\Notify\V1\ServiceList services + * @method \Twilio\Rest\Notify\V1\CredentialContext credentials(string $sid) + * @method \Twilio\Rest\Notify\V1\ServiceContext services(string $sid) + */ +class V1 extends Version { + protected $_credentials = null; + protected $_services = null; + + /** + * Construct the V1 version of Notify + * + * @param \Twilio\Domain $domain Domain that contains the version + * @return \Twilio\Rest\Notify\V1 V1 version of Notify + */ + public function __construct(Domain $domain) { + parent::__construct($domain); + $this->version = 'v1'; + } + + /** + * @return \Twilio\Rest\Notify\V1\CredentialList + */ + protected function getCredentials() { + if (!$this->_credentials) { + $this->_credentials = new CredentialList($this); + } + return $this->_credentials; + } + + /** + * @return \Twilio\Rest\Notify\V1\ServiceList + */ + protected function getServices() { + if (!$this->_services) { + $this->_services = new ServiceList($this); + } + return $this->_services; + } + + /** + * Magic getter to lazy load root resources + * + * @param string $name Resource to return + * @return \Twilio\ListResource The requested resource + * @throws \Twilio\Exceptions\TwilioException For unknown resource + */ + public function __get($name) { + $method = 'get' . ucfirst($name); + if (method_exists($this, $method)) { + return $this->$method(); + } + + throw new TwilioException('Unknown resource ' . $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() { + return '[Twilio.Notify.V1]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Notify/V1/CredentialContext.php b/Twilio/Rest/Notify/V1/CredentialContext.php new file mode 100644 index 0000000..7394ace --- /dev/null +++ b/Twilio/Rest/Notify/V1/CredentialContext.php @@ -0,0 +1,109 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Notify\V1; + +use Twilio\InstanceContext; +use Twilio\Options; +use Twilio\Values; +use Twilio\Version; + +class CredentialContext extends InstanceContext { + /** + * Initialize the CredentialContext + * + * @param \Twilio\Version $version Version that contains the resource + * @param string $sid The sid + * @return \Twilio\Rest\Notify\V1\CredentialContext + */ + public function __construct(Version $version, $sid) { + parent::__construct($version); + + // Path Solution + $this->solution = array( + 'sid' => $sid, + ); + + $this->uri = '/Credentials/' . rawurlencode($sid) . ''; + } + + /** + * Fetch a CredentialInstance + * + * @return CredentialInstance Fetched CredentialInstance + */ + public function fetch() { + $params = Values::of(array()); + + $payload = $this->version->fetch( + 'GET', + $this->uri, + $params + ); + + return new CredentialInstance( + $this->version, + $payload, + $this->solution['sid'] + ); + } + + /** + * Update the CredentialInstance + * + * @param array|Options $options Optional Arguments + * @return CredentialInstance Updated CredentialInstance + */ + public function update($options = array()) { + $options = new Values($options); + + $data = Values::of(array( + 'FriendlyName' => $options['friendlyName'], + 'Certificate' => $options['certificate'], + 'PrivateKey' => $options['privateKey'], + 'Sandbox' => $options['sandbox'], + 'ApiKey' => $options['apiKey'], + )); + + $payload = $this->version->update( + 'POST', + $this->uri, + array(), + $data + ); + + return new CredentialInstance( + $this->version, + $payload, + $this->solution['sid'] + ); + } + + /** + * Deletes the CredentialInstance + * + * @return boolean True if delete succeeds, false otherwise + */ + public function delete() { + return $this->version->delete('delete', $this->uri); + } + + /** + * 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.Notify.V1.CredentialContext ' . implode(' ', $context) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Notify/V1/CredentialInstance.php b/Twilio/Rest/Notify/V1/CredentialInstance.php new file mode 100644 index 0000000..284caf6 --- /dev/null +++ b/Twilio/Rest/Notify/V1/CredentialInstance.php @@ -0,0 +1,137 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Notify\V1; + +use Twilio\Deserialize; +use Twilio\Exceptions\TwilioException; +use Twilio\InstanceResource; +use Twilio\Options; +use Twilio\Version; + +/** + * @property string sid + * @property string accountSid + * @property string friendlyName + * @property string type + * @property string sandbox + * @property \DateTime dateCreated + * @property \DateTime dateUpdated + * @property string url + */ +class CredentialInstance extends InstanceResource { + /** + * Initialize the CredentialInstance + * + * @param \Twilio\Version $version Version that contains the resource + * @param mixed[] $payload The response payload + * @param string $sid The sid + * @return \Twilio\Rest\Notify\V1\CredentialInstance + */ + public function __construct(Version $version, array $payload, $sid = null) { + parent::__construct($version); + + // Marshaled Properties + $this->properties = array( + 'sid' => $payload['sid'], + 'accountSid' => $payload['account_sid'], + 'friendlyName' => $payload['friendly_name'], + 'type' => $payload['type'], + 'sandbox' => $payload['sandbox'], + '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\Notify\V1\CredentialContext Context for this + * CredentialInstance + */ + protected function proxy() { + if (!$this->context) { + $this->context = new CredentialContext( + $this->version, + $this->solution['sid'] + ); + } + + return $this->context; + } + + /** + * Fetch a CredentialInstance + * + * @return CredentialInstance Fetched CredentialInstance + */ + public function fetch() { + return $this->proxy()->fetch(); + } + + /** + * Update the CredentialInstance + * + * @param array|Options $options Optional Arguments + * @return CredentialInstance Updated CredentialInstance + */ + public function update($options = array()) { + return $this->proxy()->update( + $options + ); + } + + /** + * Deletes the CredentialInstance + * + * @return boolean True if delete succeeds, false otherwise + */ + public function delete() { + return $this->proxy()->delete(); + } + + /** + * 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.Notify.V1.CredentialInstance ' . implode(' ', $context) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Notify/V1/CredentialList.php b/Twilio/Rest/Notify/V1/CredentialList.php new file mode 100644 index 0000000..5a1d665 --- /dev/null +++ b/Twilio/Rest/Notify/V1/CredentialList.php @@ -0,0 +1,156 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Notify\V1; + +use Twilio\ListResource; +use Twilio\Options; +use Twilio\Values; +use Twilio\Version; + +class CredentialList extends ListResource { + /** + * Construct the CredentialList + * + * @param Version $version Version that contains the resource + * @return \Twilio\Rest\Notify\V1\CredentialList + */ + public function __construct(Version $version) { + parent::__construct($version); + + // Path Solution + $this->solution = array(); + + $this->uri = '/Credentials'; + } + + /** + * Streams CredentialInstance 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 CredentialInstance 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 CredentialInstance[] 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 CredentialInstance 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 CredentialInstance + */ + 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 CredentialPage($this->version, $response, $this->solution); + } + + /** + * Create a new CredentialInstance + * + * @param string $type The type + * @param array|Options $options Optional Arguments + * @return CredentialInstance Newly created CredentialInstance + */ + public function create($type, $options = array()) { + $options = new Values($options); + + $data = Values::of(array( + 'Type' => $type, + 'FriendlyName' => $options['friendlyName'], + 'Certificate' => $options['certificate'], + 'PrivateKey' => $options['privateKey'], + 'Sandbox' => $options['sandbox'], + 'ApiKey' => $options['apiKey'], + )); + + $payload = $this->version->create( + 'POST', + $this->uri, + array(), + $data + ); + + return new CredentialInstance( + $this->version, + $payload + ); + } + + /** + * Constructs a CredentialContext + * + * @param string $sid The sid + * @return \Twilio\Rest\Notify\V1\CredentialContext + */ + public function getContext($sid) { + return new CredentialContext( + $this->version, + $sid + ); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + return '[Twilio.Notify.V1.CredentialList]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Notify/V1/CredentialOptions.php b/Twilio/Rest/Notify/V1/CredentialOptions.php new file mode 100644 index 0000000..047f8d3 --- /dev/null +++ b/Twilio/Rest/Notify/V1/CredentialOptions.php @@ -0,0 +1,213 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Notify\V1; + +use Twilio\Options; +use Twilio\Values; + +abstract class CredentialOptions { + /** + * @param string $friendlyName The friendly_name + * @param string $certificate The certificate + * @param string $privateKey The private_key + * @param string $sandbox The sandbox + * @param string $apiKey The api_key + * @return CreateCredentialOptions Options builder + */ + public static function create($friendlyName = Values::NONE, $certificate = Values::NONE, $privateKey = Values::NONE, $sandbox = Values::NONE, $apiKey = Values::NONE) { + return new CreateCredentialOptions($friendlyName, $certificate, $privateKey, $sandbox, $apiKey); + } + + /** + * @param string $friendlyName The friendly_name + * @param string $certificate The certificate + * @param string $privateKey The private_key + * @param string $sandbox The sandbox + * @param string $apiKey The api_key + * @return UpdateCredentialOptions Options builder + */ + public static function update($friendlyName = Values::NONE, $certificate = Values::NONE, $privateKey = Values::NONE, $sandbox = Values::NONE, $apiKey = Values::NONE) { + return new UpdateCredentialOptions($friendlyName, $certificate, $privateKey, $sandbox, $apiKey); + } +} + +class CreateCredentialOptions extends Options { + /** + * @param string $friendlyName The friendly_name + * @param string $certificate The certificate + * @param string $privateKey The private_key + * @param string $sandbox The sandbox + * @param string $apiKey The api_key + */ + public function __construct($friendlyName = Values::NONE, $certificate = Values::NONE, $privateKey = Values::NONE, $sandbox = Values::NONE, $apiKey = Values::NONE) { + $this->options['friendlyName'] = $friendlyName; + $this->options['certificate'] = $certificate; + $this->options['privateKey'] = $privateKey; + $this->options['sandbox'] = $sandbox; + $this->options['apiKey'] = $apiKey; + } + + /** + * The friendly_name + * + * @param string $friendlyName The friendly_name + * @return $this Fluent Builder + */ + public function setFriendlyName($friendlyName) { + $this->options['friendlyName'] = $friendlyName; + return $this; + } + + /** + * The certificate + * + * @param string $certificate The certificate + * @return $this Fluent Builder + */ + public function setCertificate($certificate) { + $this->options['certificate'] = $certificate; + return $this; + } + + /** + * The private_key + * + * @param string $privateKey The private_key + * @return $this Fluent Builder + */ + public function setPrivateKey($privateKey) { + $this->options['privateKey'] = $privateKey; + return $this; + } + + /** + * The sandbox + * + * @param string $sandbox The sandbox + * @return $this Fluent Builder + */ + public function setSandbox($sandbox) { + $this->options['sandbox'] = $sandbox; + return $this; + } + + /** + * The api_key + * + * @param string $apiKey The api_key + * @return $this Fluent Builder + */ + public function setApiKey($apiKey) { + $this->options['apiKey'] = $apiKey; + return $this; + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + $options = array(); + foreach ($this->options as $key => $value) { + if ($value != Values::NONE) { + $options[] = "$key=$value"; + } + } + return '[Twilio.Notify.V1.CreateCredentialOptions ' . implode(' ', $options) . ']'; + } +} + +class UpdateCredentialOptions extends Options { + /** + * @param string $friendlyName The friendly_name + * @param string $certificate The certificate + * @param string $privateKey The private_key + * @param string $sandbox The sandbox + * @param string $apiKey The api_key + */ + public function __construct($friendlyName = Values::NONE, $certificate = Values::NONE, $privateKey = Values::NONE, $sandbox = Values::NONE, $apiKey = Values::NONE) { + $this->options['friendlyName'] = $friendlyName; + $this->options['certificate'] = $certificate; + $this->options['privateKey'] = $privateKey; + $this->options['sandbox'] = $sandbox; + $this->options['apiKey'] = $apiKey; + } + + /** + * The friendly_name + * + * @param string $friendlyName The friendly_name + * @return $this Fluent Builder + */ + public function setFriendlyName($friendlyName) { + $this->options['friendlyName'] = $friendlyName; + return $this; + } + + /** + * The certificate + * + * @param string $certificate The certificate + * @return $this Fluent Builder + */ + public function setCertificate($certificate) { + $this->options['certificate'] = $certificate; + return $this; + } + + /** + * The private_key + * + * @param string $privateKey The private_key + * @return $this Fluent Builder + */ + public function setPrivateKey($privateKey) { + $this->options['privateKey'] = $privateKey; + return $this; + } + + /** + * The sandbox + * + * @param string $sandbox The sandbox + * @return $this Fluent Builder + */ + public function setSandbox($sandbox) { + $this->options['sandbox'] = $sandbox; + return $this; + } + + /** + * The api_key + * + * @param string $apiKey The api_key + * @return $this Fluent Builder + */ + public function setApiKey($apiKey) { + $this->options['apiKey'] = $apiKey; + return $this; + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + $options = array(); + foreach ($this->options as $key => $value) { + if ($value != Values::NONE) { + $options[] = "$key=$value"; + } + } + return '[Twilio.Notify.V1.UpdateCredentialOptions ' . implode(' ', $options) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Notify/V1/CredentialPage.php b/Twilio/Rest/Notify/V1/CredentialPage.php new file mode 100644 index 0000000..56dfd46 --- /dev/null +++ b/Twilio/Rest/Notify/V1/CredentialPage.php @@ -0,0 +1,37 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Notify\V1; + +use Twilio\Page; + +class CredentialPage extends Page { + public function __construct($version, $response, $solution) { + parent::__construct($version, $response); + + // Path Solution + $this->solution = $solution; + } + + public function buildInstance(array $payload) { + return new CredentialInstance( + $this->version, + $payload + ); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + return '[Twilio.Notify.V1.CredentialPage]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Notify/V1/Service/BindingContext.php b/Twilio/Rest/Notify/V1/Service/BindingContext.php new file mode 100644 index 0000000..162e654 --- /dev/null +++ b/Twilio/Rest/Notify/V1/Service/BindingContext.php @@ -0,0 +1,80 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Notify\V1\Service; + +use Twilio\InstanceContext; +use Twilio\Values; +use Twilio\Version; + +class BindingContext extends InstanceContext { + /** + * Initialize the BindingContext + * + * @param \Twilio\Version $version Version that contains the resource + * @param string $serviceSid The service_sid + * @param string $sid The sid + * @return \Twilio\Rest\Notify\V1\Service\BindingContext + */ + public function __construct(Version $version, $serviceSid, $sid) { + parent::__construct($version); + + // Path Solution + $this->solution = array( + 'serviceSid' => $serviceSid, + 'sid' => $sid, + ); + + $this->uri = '/Services/' . rawurlencode($serviceSid) . '/Bindings/' . rawurlencode($sid) . ''; + } + + /** + * Fetch a BindingInstance + * + * @return BindingInstance Fetched BindingInstance + */ + public function fetch() { + $params = Values::of(array()); + + $payload = $this->version->fetch( + 'GET', + $this->uri, + $params + ); + + return new BindingInstance( + $this->version, + $payload, + $this->solution['serviceSid'], + $this->solution['sid'] + ); + } + + /** + * Deletes the BindingInstance + * + * @return boolean True if delete succeeds, false otherwise + */ + public function delete() { + return $this->version->delete('delete', $this->uri); + } + + /** + * 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.Notify.V1.BindingContext ' . implode(' ', $context) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Notify/V1/Service/BindingInstance.php b/Twilio/Rest/Notify/V1/Service/BindingInstance.php new file mode 100644 index 0000000..3a0d8a1 --- /dev/null +++ b/Twilio/Rest/Notify/V1/Service/BindingInstance.php @@ -0,0 +1,135 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Notify\V1\Service; + +use Twilio\Deserialize; +use Twilio\Exceptions\TwilioException; +use Twilio\InstanceResource; +use Twilio\Version; + +/** + * @property string sid + * @property string accountSid + * @property string serviceSid + * @property \DateTime dateCreated + * @property \DateTime dateUpdated + * @property string notificationProtocolVersion + * @property string endpoint + * @property string identity + * @property string bindingType + * @property string address + * @property string tags + * @property string url + */ +class BindingInstance extends InstanceResource { + /** + * Initialize the BindingInstance + * + * @param \Twilio\Version $version Version that contains the resource + * @param mixed[] $payload The response payload + * @param string $serviceSid The service_sid + * @param string $sid The sid + * @return \Twilio\Rest\Notify\V1\Service\BindingInstance + */ + public function __construct(Version $version, array $payload, $serviceSid, $sid = null) { + parent::__construct($version); + + // Marshaled Properties + $this->properties = array( + 'sid' => $payload['sid'], + 'accountSid' => $payload['account_sid'], + 'serviceSid' => $payload['service_sid'], + 'dateCreated' => Deserialize::iso8601DateTime($payload['date_created']), + 'dateUpdated' => Deserialize::iso8601DateTime($payload['date_updated']), + 'notificationProtocolVersion' => $payload['notification_protocol_version'], + 'endpoint' => $payload['endpoint'], + 'identity' => $payload['identity'], + 'bindingType' => $payload['binding_type'], + 'address' => $payload['address'], + 'tags' => $payload['tags'], + 'url' => $payload['url'], + ); + + $this->solution = array( + 'serviceSid' => $serviceSid, + '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\Notify\V1\Service\BindingContext Context for this + * BindingInstance + */ + protected function proxy() { + if (!$this->context) { + $this->context = new BindingContext( + $this->version, + $this->solution['serviceSid'], + $this->solution['sid'] + ); + } + + return $this->context; + } + + /** + * Fetch a BindingInstance + * + * @return BindingInstance Fetched BindingInstance + */ + public function fetch() { + return $this->proxy()->fetch(); + } + + /** + * Deletes the BindingInstance + * + * @return boolean True if delete succeeds, false otherwise + */ + public function delete() { + return $this->proxy()->delete(); + } + + /** + * 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.Notify.V1.BindingInstance ' . implode(' ', $context) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Notify/V1/Service/BindingList.php b/Twilio/Rest/Notify/V1/Service/BindingList.php new file mode 100644 index 0000000..2854fbe --- /dev/null +++ b/Twilio/Rest/Notify/V1/Service/BindingList.php @@ -0,0 +1,176 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Notify\V1\Service; + +use Twilio\ListResource; +use Twilio\Options; +use Twilio\Values; +use Twilio\Version; + +class BindingList extends ListResource { + /** + * Construct the BindingList + * + * @param Version $version Version that contains the resource + * @param string $serviceSid The service_sid + * @return \Twilio\Rest\Notify\V1\Service\BindingList + */ + public function __construct(Version $version, $serviceSid) { + parent::__construct($version); + + // Path Solution + $this->solution = array( + 'serviceSid' => $serviceSid, + ); + + $this->uri = '/Services/' . rawurlencode($serviceSid) . '/Bindings'; + } + + /** + * Create a new BindingInstance + * + * @param string $endpoint The endpoint + * @param string $identity The identity + * @param string $bindingType The binding_type + * @param string $address The address + * @param array|Options $options Optional Arguments + * @return BindingInstance Newly created BindingInstance + */ + public function create($endpoint, $identity, $bindingType, $address, $options = array()) { + $options = new Values($options); + + $data = Values::of(array( + 'Endpoint' => $endpoint, + 'Identity' => $identity, + 'BindingType' => $bindingType, + 'Address' => $address, + 'Tag' => $options['tag'], + 'NotificationProtocolVersion' => $options['notificationProtocolVersion'], + )); + + $payload = $this->version->create( + 'POST', + $this->uri, + array(), + $data + ); + + return new BindingInstance( + $this->version, + $payload, + $this->solution['serviceSid'] + ); + } + + /** + * Streams BindingInstance 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 $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($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 BindingInstance 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 $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 BindingInstance[] Array of results + */ + public function read($options = array(), $limit = null, $pageSize = Values::NONE) { + return iterator_to_array($this->stream($options, $limit, $pageSize), false); + } + + /** + * Retrieve a single page of BindingInstance records from the API. + * Request is executed immediately + * + * @param array|Options $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 BindingInstance + */ + public function page($options = array(), $pageSize = Values::NONE, $pageToken = Values::NONE, $pageNumber = Values::NONE) { + $options = new Values($options); + $params = Values::of(array( + 'StartDate<' => $options['startDateBefore'], + 'StartDate' => $options['startDate'], + 'StartDate>' => $options['startDateAfter'], + 'EndDate<' => $options['endDateBefore'], + 'EndDate' => $options['endDate'], + 'EndDate>' => $options['endDateAfter'], + 'Identity' => $options['identity'], + 'Tag' => $options['tag'], + 'PageToken' => $pageToken, + 'Page' => $pageNumber, + 'PageSize' => $pageSize, + )); + + $response = $this->version->page( + 'GET', + $this->uri, + $params + ); + + return new BindingPage($this->version, $response, $this->solution); + } + + /** + * Constructs a BindingContext + * + * @param string $sid The sid + * @return \Twilio\Rest\Notify\V1\Service\BindingContext + */ + public function getContext($sid) { + return new BindingContext( + $this->version, + $this->solution['serviceSid'], + $sid + ); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + return '[Twilio.Notify.V1.BindingList]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Notify/V1/Service/BindingOptions.php b/Twilio/Rest/Notify/V1/Service/BindingOptions.php new file mode 100644 index 0000000..7a5b1cc --- /dev/null +++ b/Twilio/Rest/Notify/V1/Service/BindingOptions.php @@ -0,0 +1,213 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Notify\V1\Service; + +use Twilio\Options; +use Twilio\Values; + +abstract class BindingOptions { + /** + * @param string $tag The tag + * @param string $notificationProtocolVersion The notification_protocol_version + * @return CreateBindingOptions Options builder + */ + public static function create($tag = Values::NONE, $notificationProtocolVersion = Values::NONE) { + return new CreateBindingOptions($tag, $notificationProtocolVersion); + } + + /** + * @param string $startDateBefore The start_date + * @param string $startDate The start_date + * @param string $startDateAfter The start_date + * @param string $endDateBefore The end_date + * @param string $endDate The end_date + * @param string $endDateAfter The end_date + * @param string $identity The identity + * @param string $tag The tag + * @return ReadBindingOptions Options builder + */ + public static function read($startDateBefore = Values::NONE, $startDate = Values::NONE, $startDateAfter = Values::NONE, $endDateBefore = Values::NONE, $endDate = Values::NONE, $endDateAfter = Values::NONE, $identity = Values::NONE, $tag = Values::NONE) { + return new ReadBindingOptions($startDateBefore, $startDate, $startDateAfter, $endDateBefore, $endDate, $endDateAfter, $identity, $tag); + } +} + +class CreateBindingOptions extends Options { + /** + * @param string $tag The tag + * @param string $notificationProtocolVersion The notification_protocol_version + */ + public function __construct($tag = Values::NONE, $notificationProtocolVersion = Values::NONE) { + $this->options['tag'] = $tag; + $this->options['notificationProtocolVersion'] = $notificationProtocolVersion; + } + + /** + * The tag + * + * @param string $tag The tag + * @return $this Fluent Builder + */ + public function setTag($tag) { + $this->options['tag'] = $tag; + return $this; + } + + /** + * The notification_protocol_version + * + * @param string $notificationProtocolVersion The notification_protocol_version + * @return $this Fluent Builder + */ + public function setNotificationProtocolVersion($notificationProtocolVersion) { + $this->options['notificationProtocolVersion'] = $notificationProtocolVersion; + return $this; + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + $options = array(); + foreach ($this->options as $key => $value) { + if ($value != Values::NONE) { + $options[] = "$key=$value"; + } + } + return '[Twilio.Notify.V1.CreateBindingOptions ' . implode(' ', $options) . ']'; + } +} + +class ReadBindingOptions extends Options { + /** + * @param string $startDateBefore The start_date + * @param string $startDate The start_date + * @param string $startDateAfter The start_date + * @param string $endDateBefore The end_date + * @param string $endDate The end_date + * @param string $endDateAfter The end_date + * @param string $identity The identity + * @param string $tag The tag + */ + public function __construct($startDateBefore = Values::NONE, $startDate = Values::NONE, $startDateAfter = Values::NONE, $endDateBefore = Values::NONE, $endDate = Values::NONE, $endDateAfter = Values::NONE, $identity = Values::NONE, $tag = Values::NONE) { + $this->options['startDateBefore'] = $startDateBefore; + $this->options['startDate'] = $startDate; + $this->options['startDateAfter'] = $startDateAfter; + $this->options['endDateBefore'] = $endDateBefore; + $this->options['endDate'] = $endDate; + $this->options['endDateAfter'] = $endDateAfter; + $this->options['identity'] = $identity; + $this->options['tag'] = $tag; + } + + /** + * The start_date + * + * @param string $startDateBefore The start_date + * @return $this Fluent Builder + */ + public function setStartDateBefore($startDateBefore) { + $this->options['startDateBefore'] = $startDateBefore; + return $this; + } + + /** + * The start_date + * + * @param string $startDate The start_date + * @return $this Fluent Builder + */ + public function setStartDate($startDate) { + $this->options['startDate'] = $startDate; + return $this; + } + + /** + * The start_date + * + * @param string $startDateAfter The start_date + * @return $this Fluent Builder + */ + public function setStartDateAfter($startDateAfter) { + $this->options['startDateAfter'] = $startDateAfter; + return $this; + } + + /** + * The end_date + * + * @param string $endDateBefore The end_date + * @return $this Fluent Builder + */ + public function setEndDateBefore($endDateBefore) { + $this->options['endDateBefore'] = $endDateBefore; + return $this; + } + + /** + * The end_date + * + * @param string $endDate The end_date + * @return $this Fluent Builder + */ + public function setEndDate($endDate) { + $this->options['endDate'] = $endDate; + return $this; + } + + /** + * The end_date + * + * @param string $endDateAfter The end_date + * @return $this Fluent Builder + */ + public function setEndDateAfter($endDateAfter) { + $this->options['endDateAfter'] = $endDateAfter; + return $this; + } + + /** + * The identity + * + * @param string $identity The identity + * @return $this Fluent Builder + */ + public function setIdentity($identity) { + $this->options['identity'] = $identity; + return $this; + } + + /** + * The tag + * + * @param string $tag The tag + * @return $this Fluent Builder + */ + public function setTag($tag) { + $this->options['tag'] = $tag; + return $this; + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + $options = array(); + foreach ($this->options as $key => $value) { + if ($value != Values::NONE) { + $options[] = "$key=$value"; + } + } + return '[Twilio.Notify.V1.ReadBindingOptions ' . implode(' ', $options) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Notify/V1/Service/BindingPage.php b/Twilio/Rest/Notify/V1/Service/BindingPage.php new file mode 100644 index 0000000..52abbac --- /dev/null +++ b/Twilio/Rest/Notify/V1/Service/BindingPage.php @@ -0,0 +1,38 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Notify\V1\Service; + +use Twilio\Page; + +class BindingPage extends Page { + public function __construct($version, $response, $solution) { + parent::__construct($version, $response); + + // Path Solution + $this->solution = $solution; + } + + public function buildInstance(array $payload) { + return new BindingInstance( + $this->version, + $payload, + $this->solution['serviceSid'] + ); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + return '[Twilio.Notify.V1.BindingPage]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Notify/V1/Service/NotificationInstance.php b/Twilio/Rest/Notify/V1/Service/NotificationInstance.php new file mode 100644 index 0000000..060a508 --- /dev/null +++ b/Twilio/Rest/Notify/V1/Service/NotificationInstance.php @@ -0,0 +1,102 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Notify\V1\Service; + +use Twilio\Deserialize; +use Twilio\Exceptions\TwilioException; +use Twilio\InstanceResource; +use Twilio\Version; + +/** + * @property string sid + * @property string accountSid + * @property string serviceSid + * @property \DateTime dateCreated + * @property string identities + * @property string tags + * @property string priority + * @property string ttl + * @property string title + * @property string body + * @property string sound + * @property string action + * @property string data + * @property string apn + * @property string gcm + * @property string sms + * @property string facebookMessenger + */ +class NotificationInstance extends InstanceResource { + /** + * Initialize the NotificationInstance + * + * @param \Twilio\Version $version Version that contains the resource + * @param mixed[] $payload The response payload + * @param string $serviceSid The service_sid + * @return \Twilio\Rest\Notify\V1\Service\NotificationInstance + */ + public function __construct(Version $version, array $payload, $serviceSid) { + parent::__construct($version); + + // Marshaled Properties + $this->properties = array( + 'sid' => $payload['sid'], + 'accountSid' => $payload['account_sid'], + 'serviceSid' => $payload['service_sid'], + 'dateCreated' => Deserialize::iso8601DateTime($payload['date_created']), + 'identities' => $payload['identities'], + 'tags' => $payload['tags'], + 'priority' => $payload['priority'], + 'ttl' => $payload['ttl'], + 'title' => $payload['title'], + 'body' => $payload['body'], + 'sound' => $payload['sound'], + 'action' => $payload['action'], + 'data' => $payload['data'], + 'apn' => $payload['apn'], + 'gcm' => $payload['gcm'], + 'sms' => $payload['sms'], + 'facebookMessenger' => $payload['facebook_messenger'], + ); + + $this->solution = array( + 'serviceSid' => $serviceSid, + ); + } + + /** + * 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() { + return '[Twilio.Notify.V1.NotificationInstance]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Notify/V1/Service/NotificationList.php b/Twilio/Rest/Notify/V1/Service/NotificationList.php new file mode 100644 index 0000000..3a7f424 --- /dev/null +++ b/Twilio/Rest/Notify/V1/Service/NotificationList.php @@ -0,0 +1,83 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Notify\V1\Service; + +use Twilio\ListResource; +use Twilio\Options; +use Twilio\Values; +use Twilio\Version; + +class NotificationList extends ListResource { + /** + * Construct the NotificationList + * + * @param Version $version Version that contains the resource + * @param string $serviceSid The service_sid + * @return \Twilio\Rest\Notify\V1\Service\NotificationList + */ + public function __construct(Version $version, $serviceSid) { + parent::__construct($version); + + // Path Solution + $this->solution = array( + 'serviceSid' => $serviceSid, + ); + + $this->uri = '/Services/' . rawurlencode($serviceSid) . '/Notifications'; + } + + /** + * Create a new NotificationInstance + * + * @param array|Options $options Optional Arguments + * @return NotificationInstance Newly created NotificationInstance + */ + public function create($options = array()) { + $options = new Values($options); + + $data = Values::of(array( + 'Identity' => $options['identity'], + 'Tag' => $options['tag'], + 'Body' => $options['body'], + 'Priority' => $options['priority'], + 'Ttl' => $options['ttl'], + 'Title' => $options['title'], + 'Sound' => $options['sound'], + 'Action' => $options['action'], + 'Data' => $options['data'], + 'Apn' => $options['apn'], + 'Gcm' => $options['gcm'], + 'Sms' => $options['sms'], + 'FacebookMessenger' => $options['facebookMessenger'], + )); + + $payload = $this->version->create( + 'POST', + $this->uri, + array(), + $data + ); + + return new NotificationInstance( + $this->version, + $payload, + $this->solution['serviceSid'] + ); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + return '[Twilio.Notify.V1.NotificationList]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Notify/V1/Service/NotificationOptions.php b/Twilio/Rest/Notify/V1/Service/NotificationOptions.php new file mode 100644 index 0000000..2751953 --- /dev/null +++ b/Twilio/Rest/Notify/V1/Service/NotificationOptions.php @@ -0,0 +1,226 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Notify\V1\Service; + +use Twilio\Options; +use Twilio\Values; + +abstract class NotificationOptions { + /** + * @param string $identity The identity + * @param string $tag The tag + * @param string $body The body + * @param string $priority The priority + * @param string $ttl The ttl + * @param string $title The title + * @param string $sound The sound + * @param string $action The action + * @param string $data The data + * @param string $apn The apn + * @param string $gcm The gcm + * @param string $sms The sms + * @param string $facebookMessenger The facebook_messenger + * @return CreateNotificationOptions Options builder + */ + public static function create($identity = Values::NONE, $tag = Values::NONE, $body = Values::NONE, $priority = Values::NONE, $ttl = Values::NONE, $title = Values::NONE, $sound = Values::NONE, $action = Values::NONE, $data = Values::NONE, $apn = Values::NONE, $gcm = Values::NONE, $sms = Values::NONE, $facebookMessenger = Values::NONE) { + return new CreateNotificationOptions($identity, $tag, $body, $priority, $ttl, $title, $sound, $action, $data, $apn, $gcm, $sms, $facebookMessenger); + } +} + +class CreateNotificationOptions extends Options { + /** + * @param string $identity The identity + * @param string $tag The tag + * @param string $body The body + * @param string $priority The priority + * @param string $ttl The ttl + * @param string $title The title + * @param string $sound The sound + * @param string $action The action + * @param string $data The data + * @param string $apn The apn + * @param string $gcm The gcm + * @param string $sms The sms + * @param string $facebookMessenger The facebook_messenger + */ + public function __construct($identity = Values::NONE, $tag = Values::NONE, $body = Values::NONE, $priority = Values::NONE, $ttl = Values::NONE, $title = Values::NONE, $sound = Values::NONE, $action = Values::NONE, $data = Values::NONE, $apn = Values::NONE, $gcm = Values::NONE, $sms = Values::NONE, $facebookMessenger = Values::NONE) { + $this->options['identity'] = $identity; + $this->options['tag'] = $tag; + $this->options['body'] = $body; + $this->options['priority'] = $priority; + $this->options['ttl'] = $ttl; + $this->options['title'] = $title; + $this->options['sound'] = $sound; + $this->options['action'] = $action; + $this->options['data'] = $data; + $this->options['apn'] = $apn; + $this->options['gcm'] = $gcm; + $this->options['sms'] = $sms; + $this->options['facebookMessenger'] = $facebookMessenger; + } + + /** + * The identity + * + * @param string $identity The identity + * @return $this Fluent Builder + */ + public function setIdentity($identity) { + $this->options['identity'] = $identity; + return $this; + } + + /** + * The tag + * + * @param string $tag The tag + * @return $this Fluent Builder + */ + public function setTag($tag) { + $this->options['tag'] = $tag; + return $this; + } + + /** + * The body + * + * @param string $body The body + * @return $this Fluent Builder + */ + public function setBody($body) { + $this->options['body'] = $body; + return $this; + } + + /** + * The priority + * + * @param string $priority The priority + * @return $this Fluent Builder + */ + public function setPriority($priority) { + $this->options['priority'] = $priority; + return $this; + } + + /** + * The ttl + * + * @param string $ttl The ttl + * @return $this Fluent Builder + */ + public function setTtl($ttl) { + $this->options['ttl'] = $ttl; + return $this; + } + + /** + * The title + * + * @param string $title The title + * @return $this Fluent Builder + */ + public function setTitle($title) { + $this->options['title'] = $title; + return $this; + } + + /** + * The sound + * + * @param string $sound The sound + * @return $this Fluent Builder + */ + public function setSound($sound) { + $this->options['sound'] = $sound; + return $this; + } + + /** + * The action + * + * @param string $action The action + * @return $this Fluent Builder + */ + public function setAction($action) { + $this->options['action'] = $action; + return $this; + } + + /** + * The data + * + * @param string $data The data + * @return $this Fluent Builder + */ + public function setData($data) { + $this->options['data'] = $data; + return $this; + } + + /** + * The apn + * + * @param string $apn The apn + * @return $this Fluent Builder + */ + public function setApn($apn) { + $this->options['apn'] = $apn; + return $this; + } + + /** + * The gcm + * + * @param string $gcm The gcm + * @return $this Fluent Builder + */ + public function setGcm($gcm) { + $this->options['gcm'] = $gcm; + return $this; + } + + /** + * The sms + * + * @param string $sms The sms + * @return $this Fluent Builder + */ + public function setSms($sms) { + $this->options['sms'] = $sms; + return $this; + } + + /** + * The facebook_messenger + * + * @param string $facebookMessenger The facebook_messenger + * @return $this Fluent Builder + */ + public function setFacebookMessenger($facebookMessenger) { + $this->options['facebookMessenger'] = $facebookMessenger; + return $this; + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + $options = array(); + foreach ($this->options as $key => $value) { + if ($value != Values::NONE) { + $options[] = "$key=$value"; + } + } + return '[Twilio.Notify.V1.CreateNotificationOptions ' . implode(' ', $options) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Notify/V1/Service/NotificationPage.php b/Twilio/Rest/Notify/V1/Service/NotificationPage.php new file mode 100644 index 0000000..e0e82c5 --- /dev/null +++ b/Twilio/Rest/Notify/V1/Service/NotificationPage.php @@ -0,0 +1,38 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Notify\V1\Service; + +use Twilio\Page; + +class NotificationPage extends Page { + public function __construct($version, $response, $solution) { + parent::__construct($version, $response); + + // Path Solution + $this->solution = $solution; + } + + public function buildInstance(array $payload) { + return new NotificationInstance( + $this->version, + $payload, + $this->solution['serviceSid'] + ); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + return '[Twilio.Notify.V1.NotificationPage]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Notify/V1/ServiceContext.php b/Twilio/Rest/Notify/V1/ServiceContext.php new file mode 100644 index 0000000..2b47b6c --- /dev/null +++ b/Twilio/Rest/Notify/V1/ServiceContext.php @@ -0,0 +1,187 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Notify\V1; + +use Twilio\Exceptions\TwilioException; +use Twilio\InstanceContext; +use Twilio\Options; +use Twilio\Rest\Notify\V1\Service\BindingList; +use Twilio\Rest\Notify\V1\Service\NotificationList; +use Twilio\Values; +use Twilio\Version; + +/** + * @property \Twilio\Rest\Notify\V1\Service\BindingList bindings + * @property \Twilio\Rest\Notify\V1\Service\NotificationList notifications + * @method \Twilio\Rest\Notify\V1\Service\BindingContext bindings(string $sid) + */ +class ServiceContext extends InstanceContext { + protected $_bindings = null; + protected $_notifications = null; + + /** + * Initialize the ServiceContext + * + * @param \Twilio\Version $version Version that contains the resource + * @param string $sid The sid + * @return \Twilio\Rest\Notify\V1\ServiceContext + */ + public function __construct(Version $version, $sid) { + parent::__construct($version); + + // Path Solution + $this->solution = array( + 'sid' => $sid, + ); + + $this->uri = '/Services/' . rawurlencode($sid) . ''; + } + + /** + * Deletes the ServiceInstance + * + * @return boolean True if delete succeeds, false otherwise + */ + public function delete() { + return $this->version->delete('delete', $this->uri); + } + + /** + * Fetch a ServiceInstance + * + * @return ServiceInstance Fetched ServiceInstance + */ + public function fetch() { + $params = Values::of(array()); + + $payload = $this->version->fetch( + 'GET', + $this->uri, + $params + ); + + return new ServiceInstance( + $this->version, + $payload, + $this->solution['sid'] + ); + } + + /** + * Update the ServiceInstance + * + * @param array|Options $options Optional Arguments + * @return ServiceInstance Updated ServiceInstance + */ + public function update($options = array()) { + $options = new Values($options); + + $data = Values::of(array( + 'FriendlyName' => $options['friendlyName'], + 'ApnCredentialSid' => $options['apnCredentialSid'], + 'GcmCredentialSid' => $options['gcmCredentialSid'], + 'MessagingServiceSid' => $options['messagingServiceSid'], + 'FacebookMessengerPageId' => $options['facebookMessengerPageId'], + 'DefaultApnNotificationProtocolVersion' => $options['defaultApnNotificationProtocolVersion'], + 'DefaultGcmNotificationProtocolVersion' => $options['defaultGcmNotificationProtocolVersion'], + )); + + $payload = $this->version->update( + 'POST', + $this->uri, + array(), + $data + ); + + return new ServiceInstance( + $this->version, + $payload, + $this->solution['sid'] + ); + } + + /** + * Access the bindings + * + * @return \Twilio\Rest\Notify\V1\Service\BindingList + */ + protected function getBindings() { + if (!$this->_bindings) { + $this->_bindings = new BindingList( + $this->version, + $this->solution['sid'] + ); + } + + return $this->_bindings; + } + + /** + * Access the notifications + * + * @return \Twilio\Rest\Notify\V1\Service\NotificationList + */ + protected function getNotifications() { + if (!$this->_notifications) { + $this->_notifications = new NotificationList( + $this->version, + $this->solution['sid'] + ); + } + + return $this->_notifications; + } + + /** + * 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.Notify.V1.ServiceContext ' . implode(' ', $context) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Notify/V1/ServiceInstance.php b/Twilio/Rest/Notify/V1/ServiceInstance.php new file mode 100644 index 0000000..f7a77c5 --- /dev/null +++ b/Twilio/Rest/Notify/V1/ServiceInstance.php @@ -0,0 +1,168 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Notify\V1; + +use Twilio\Deserialize; +use Twilio\Exceptions\TwilioException; +use Twilio\InstanceResource; +use Twilio\Options; +use Twilio\Version; + +/** + * @property string sid + * @property string accountSid + * @property string friendlyName + * @property \DateTime dateCreated + * @property \DateTime dateUpdated + * @property string apnCredentialSid + * @property string gcmCredentialSid + * @property string messagingServiceSid + * @property string facebookMessengerPageId + * @property string defaultApnNotificationProtocolVersion + * @property string defaultGcmNotificationProtocolVersion + * @property string url + * @property string links + */ +class ServiceInstance extends InstanceResource { + protected $_bindings = null; + protected $_notifications = null; + + /** + * Initialize the ServiceInstance + * + * @param \Twilio\Version $version Version that contains the resource + * @param mixed[] $payload The response payload + * @param string $sid The sid + * @return \Twilio\Rest\Notify\V1\ServiceInstance + */ + public function __construct(Version $version, array $payload, $sid = null) { + parent::__construct($version); + + // Marshaled Properties + $this->properties = array( + 'sid' => $payload['sid'], + 'accountSid' => $payload['account_sid'], + 'friendlyName' => $payload['friendly_name'], + 'dateCreated' => Deserialize::iso8601DateTime($payload['date_created']), + 'dateUpdated' => Deserialize::iso8601DateTime($payload['date_updated']), + 'apnCredentialSid' => $payload['apn_credential_sid'], + 'gcmCredentialSid' => $payload['gcm_credential_sid'], + 'messagingServiceSid' => $payload['messaging_service_sid'], + 'facebookMessengerPageId' => $payload['facebook_messenger_page_id'], + 'defaultApnNotificationProtocolVersion' => $payload['default_apn_notification_protocol_version'], + 'defaultGcmNotificationProtocolVersion' => $payload['default_gcm_notification_protocol_version'], + '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\Notify\V1\ServiceContext Context for this + * ServiceInstance + */ + protected function proxy() { + if (!$this->context) { + $this->context = new ServiceContext( + $this->version, + $this->solution['sid'] + ); + } + + return $this->context; + } + + /** + * Deletes the ServiceInstance + * + * @return boolean True if delete succeeds, false otherwise + */ + public function delete() { + return $this->proxy()->delete(); + } + + /** + * Fetch a ServiceInstance + * + * @return ServiceInstance Fetched ServiceInstance + */ + public function fetch() { + return $this->proxy()->fetch(); + } + + /** + * Update the ServiceInstance + * + * @param array|Options $options Optional Arguments + * @return ServiceInstance Updated ServiceInstance + */ + public function update($options = array()) { + return $this->proxy()->update( + $options + ); + } + + /** + * Access the bindings + * + * @return \Twilio\Rest\Notify\V1\Service\BindingList + */ + protected function getBindings() { + return $this->proxy()->bindings; + } + + /** + * Access the notifications + * + * @return \Twilio\Rest\Notify\V1\Service\NotificationList + */ + protected function getNotifications() { + return $this->proxy()->notifications; + } + + /** + * 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.Notify.V1.ServiceInstance ' . implode(' ', $context) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Notify/V1/ServiceList.php b/Twilio/Rest/Notify/V1/ServiceList.php new file mode 100644 index 0000000..f110de2 --- /dev/null +++ b/Twilio/Rest/Notify/V1/ServiceList.php @@ -0,0 +1,161 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Notify\V1; + +use Twilio\ListResource; +use Twilio\Options; +use Twilio\Values; +use Twilio\Version; + +class ServiceList extends ListResource { + /** + * Construct the ServiceList + * + * @param Version $version Version that contains the resource + * @return \Twilio\Rest\Notify\V1\ServiceList + */ + public function __construct(Version $version) { + parent::__construct($version); + + // Path Solution + $this->solution = array(); + + $this->uri = '/Services'; + } + + /** + * Create a new ServiceInstance + * + * @param array|Options $options Optional Arguments + * @return ServiceInstance Newly created ServiceInstance + */ + public function create($options = array()) { + $options = new Values($options); + + $data = Values::of(array( + 'FriendlyName' => $options['friendlyName'], + 'ApnCredentialSid' => $options['apnCredentialSid'], + 'GcmCredentialSid' => $options['gcmCredentialSid'], + 'MessagingServiceSid' => $options['messagingServiceSid'], + 'FacebookMessengerPageId' => $options['facebookMessengerPageId'], + 'DefaultApnNotificationProtocolVersion' => $options['defaultApnNotificationProtocolVersion'], + 'DefaultGcmNotificationProtocolVersion' => $options['defaultGcmNotificationProtocolVersion'], + )); + + $payload = $this->version->create( + 'POST', + $this->uri, + array(), + $data + ); + + return new ServiceInstance( + $this->version, + $payload + ); + } + + /** + * Streams ServiceInstance 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 $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($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 ServiceInstance 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 $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 ServiceInstance[] Array of results + */ + public function read($options = array(), $limit = null, $pageSize = Values::NONE) { + return iterator_to_array($this->stream($options, $limit, $pageSize), false); + } + + /** + * Retrieve a single page of ServiceInstance records from the API. + * Request is executed immediately + * + * @param array|Options $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 ServiceInstance + */ + public function page($options = array(), $pageSize = Values::NONE, $pageToken = Values::NONE, $pageNumber = Values::NONE) { + $options = new Values($options); + $params = Values::of(array( + 'FriendlyName' => $options['friendlyName'], + 'PageToken' => $pageToken, + 'Page' => $pageNumber, + 'PageSize' => $pageSize, + )); + + $response = $this->version->page( + 'GET', + $this->uri, + $params + ); + + return new ServicePage($this->version, $response, $this->solution); + } + + /** + * Constructs a ServiceContext + * + * @param string $sid The sid + * @return \Twilio\Rest\Notify\V1\ServiceContext + */ + public function getContext($sid) { + return new ServiceContext( + $this->version, + $sid + ); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + return '[Twilio.Notify.V1.ServiceList]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Notify/V1/ServiceOptions.php b/Twilio/Rest/Notify/V1/ServiceOptions.php new file mode 100644 index 0000000..44910d5 --- /dev/null +++ b/Twilio/Rest/Notify/V1/ServiceOptions.php @@ -0,0 +1,324 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Notify\V1; + +use Twilio\Options; +use Twilio\Values; + +abstract class ServiceOptions { + /** + * @param string $friendlyName The friendly_name + * @param string $apnCredentialSid The apn_credential_sid + * @param string $gcmCredentialSid The gcm_credential_sid + * @param string $messagingServiceSid The messaging_service_sid + * @param string $facebookMessengerPageId The facebook_messenger_page_id + * @param string $defaultApnNotificationProtocolVersion The + * default_apn_notification_protocol_version + * @param string $defaultGcmNotificationProtocolVersion The + * default_gcm_notification_protocol_version + * @return CreateServiceOptions Options builder + */ + public static function create($friendlyName = Values::NONE, $apnCredentialSid = Values::NONE, $gcmCredentialSid = Values::NONE, $messagingServiceSid = Values::NONE, $facebookMessengerPageId = Values::NONE, $defaultApnNotificationProtocolVersion = Values::NONE, $defaultGcmNotificationProtocolVersion = Values::NONE) { + return new CreateServiceOptions($friendlyName, $apnCredentialSid, $gcmCredentialSid, $messagingServiceSid, $facebookMessengerPageId, $defaultApnNotificationProtocolVersion, $defaultGcmNotificationProtocolVersion); + } + + /** + * @param string $friendlyName The friendly_name + * @return ReadServiceOptions Options builder + */ + public static function read($friendlyName = Values::NONE) { + return new ReadServiceOptions($friendlyName); + } + + /** + * @param string $friendlyName The friendly_name + * @param string $apnCredentialSid The apn_credential_sid + * @param string $gcmCredentialSid The gcm_credential_sid + * @param string $messagingServiceSid The messaging_service_sid + * @param string $facebookMessengerPageId The facebook_messenger_page_id + * @param string $defaultApnNotificationProtocolVersion The + * default_apn_notification_protocol_version + * @param string $defaultGcmNotificationProtocolVersion The + * default_gcm_notification_protocol_version + * @return UpdateServiceOptions Options builder + */ + public static function update($friendlyName = Values::NONE, $apnCredentialSid = Values::NONE, $gcmCredentialSid = Values::NONE, $messagingServiceSid = Values::NONE, $facebookMessengerPageId = Values::NONE, $defaultApnNotificationProtocolVersion = Values::NONE, $defaultGcmNotificationProtocolVersion = Values::NONE) { + return new UpdateServiceOptions($friendlyName, $apnCredentialSid, $gcmCredentialSid, $messagingServiceSid, $facebookMessengerPageId, $defaultApnNotificationProtocolVersion, $defaultGcmNotificationProtocolVersion); + } +} + +class CreateServiceOptions extends Options { + /** + * @param string $friendlyName The friendly_name + * @param string $apnCredentialSid The apn_credential_sid + * @param string $gcmCredentialSid The gcm_credential_sid + * @param string $messagingServiceSid The messaging_service_sid + * @param string $facebookMessengerPageId The facebook_messenger_page_id + * @param string $defaultApnNotificationProtocolVersion The + * default_apn_notification_protocol_version + * @param string $defaultGcmNotificationProtocolVersion The + * default_gcm_notification_protocol_version + */ + public function __construct($friendlyName = Values::NONE, $apnCredentialSid = Values::NONE, $gcmCredentialSid = Values::NONE, $messagingServiceSid = Values::NONE, $facebookMessengerPageId = Values::NONE, $defaultApnNotificationProtocolVersion = Values::NONE, $defaultGcmNotificationProtocolVersion = Values::NONE) { + $this->options['friendlyName'] = $friendlyName; + $this->options['apnCredentialSid'] = $apnCredentialSid; + $this->options['gcmCredentialSid'] = $gcmCredentialSid; + $this->options['messagingServiceSid'] = $messagingServiceSid; + $this->options['facebookMessengerPageId'] = $facebookMessengerPageId; + $this->options['defaultApnNotificationProtocolVersion'] = $defaultApnNotificationProtocolVersion; + $this->options['defaultGcmNotificationProtocolVersion'] = $defaultGcmNotificationProtocolVersion; + } + + /** + * The friendly_name + * + * @param string $friendlyName The friendly_name + * @return $this Fluent Builder + */ + public function setFriendlyName($friendlyName) { + $this->options['friendlyName'] = $friendlyName; + return $this; + } + + /** + * The apn_credential_sid + * + * @param string $apnCredentialSid The apn_credential_sid + * @return $this Fluent Builder + */ + public function setApnCredentialSid($apnCredentialSid) { + $this->options['apnCredentialSid'] = $apnCredentialSid; + return $this; + } + + /** + * The gcm_credential_sid + * + * @param string $gcmCredentialSid The gcm_credential_sid + * @return $this Fluent Builder + */ + public function setGcmCredentialSid($gcmCredentialSid) { + $this->options['gcmCredentialSid'] = $gcmCredentialSid; + return $this; + } + + /** + * The messaging_service_sid + * + * @param string $messagingServiceSid The messaging_service_sid + * @return $this Fluent Builder + */ + public function setMessagingServiceSid($messagingServiceSid) { + $this->options['messagingServiceSid'] = $messagingServiceSid; + return $this; + } + + /** + * The facebook_messenger_page_id + * + * @param string $facebookMessengerPageId The facebook_messenger_page_id + * @return $this Fluent Builder + */ + public function setFacebookMessengerPageId($facebookMessengerPageId) { + $this->options['facebookMessengerPageId'] = $facebookMessengerPageId; + return $this; + } + + /** + * The default_apn_notification_protocol_version + * + * @param string $defaultApnNotificationProtocolVersion The + * default_apn_notification_protocol_version + * @return $this Fluent Builder + */ + public function setDefaultApnNotificationProtocolVersion($defaultApnNotificationProtocolVersion) { + $this->options['defaultApnNotificationProtocolVersion'] = $defaultApnNotificationProtocolVersion; + return $this; + } + + /** + * The default_gcm_notification_protocol_version + * + * @param string $defaultGcmNotificationProtocolVersion The + * default_gcm_notification_protocol_version + * @return $this Fluent Builder + */ + public function setDefaultGcmNotificationProtocolVersion($defaultGcmNotificationProtocolVersion) { + $this->options['defaultGcmNotificationProtocolVersion'] = $defaultGcmNotificationProtocolVersion; + return $this; + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + $options = array(); + foreach ($this->options as $key => $value) { + if ($value != Values::NONE) { + $options[] = "$key=$value"; + } + } + return '[Twilio.Notify.V1.CreateServiceOptions ' . implode(' ', $options) . ']'; + } +} + +class ReadServiceOptions extends Options { + /** + * @param string $friendlyName The friendly_name + */ + public function __construct($friendlyName = Values::NONE) { + $this->options['friendlyName'] = $friendlyName; + } + + /** + * The friendly_name + * + * @param string $friendlyName The friendly_name + * @return $this Fluent Builder + */ + public function setFriendlyName($friendlyName) { + $this->options['friendlyName'] = $friendlyName; + return $this; + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + $options = array(); + foreach ($this->options as $key => $value) { + if ($value != Values::NONE) { + $options[] = "$key=$value"; + } + } + return '[Twilio.Notify.V1.ReadServiceOptions ' . implode(' ', $options) . ']'; + } +} + +class UpdateServiceOptions extends Options { + /** + * @param string $friendlyName The friendly_name + * @param string $apnCredentialSid The apn_credential_sid + * @param string $gcmCredentialSid The gcm_credential_sid + * @param string $messagingServiceSid The messaging_service_sid + * @param string $facebookMessengerPageId The facebook_messenger_page_id + * @param string $defaultApnNotificationProtocolVersion The + * default_apn_notification_protocol_version + * @param string $defaultGcmNotificationProtocolVersion The + * default_gcm_notification_protocol_version + */ + public function __construct($friendlyName = Values::NONE, $apnCredentialSid = Values::NONE, $gcmCredentialSid = Values::NONE, $messagingServiceSid = Values::NONE, $facebookMessengerPageId = Values::NONE, $defaultApnNotificationProtocolVersion = Values::NONE, $defaultGcmNotificationProtocolVersion = Values::NONE) { + $this->options['friendlyName'] = $friendlyName; + $this->options['apnCredentialSid'] = $apnCredentialSid; + $this->options['gcmCredentialSid'] = $gcmCredentialSid; + $this->options['messagingServiceSid'] = $messagingServiceSid; + $this->options['facebookMessengerPageId'] = $facebookMessengerPageId; + $this->options['defaultApnNotificationProtocolVersion'] = $defaultApnNotificationProtocolVersion; + $this->options['defaultGcmNotificationProtocolVersion'] = $defaultGcmNotificationProtocolVersion; + } + + /** + * The friendly_name + * + * @param string $friendlyName The friendly_name + * @return $this Fluent Builder + */ + public function setFriendlyName($friendlyName) { + $this->options['friendlyName'] = $friendlyName; + return $this; + } + + /** + * The apn_credential_sid + * + * @param string $apnCredentialSid The apn_credential_sid + * @return $this Fluent Builder + */ + public function setApnCredentialSid($apnCredentialSid) { + $this->options['apnCredentialSid'] = $apnCredentialSid; + return $this; + } + + /** + * The gcm_credential_sid + * + * @param string $gcmCredentialSid The gcm_credential_sid + * @return $this Fluent Builder + */ + public function setGcmCredentialSid($gcmCredentialSid) { + $this->options['gcmCredentialSid'] = $gcmCredentialSid; + return $this; + } + + /** + * The messaging_service_sid + * + * @param string $messagingServiceSid The messaging_service_sid + * @return $this Fluent Builder + */ + public function setMessagingServiceSid($messagingServiceSid) { + $this->options['messagingServiceSid'] = $messagingServiceSid; + return $this; + } + + /** + * The facebook_messenger_page_id + * + * @param string $facebookMessengerPageId The facebook_messenger_page_id + * @return $this Fluent Builder + */ + public function setFacebookMessengerPageId($facebookMessengerPageId) { + $this->options['facebookMessengerPageId'] = $facebookMessengerPageId; + return $this; + } + + /** + * The default_apn_notification_protocol_version + * + * @param string $defaultApnNotificationProtocolVersion The + * default_apn_notification_protocol_version + * @return $this Fluent Builder + */ + public function setDefaultApnNotificationProtocolVersion($defaultApnNotificationProtocolVersion) { + $this->options['defaultApnNotificationProtocolVersion'] = $defaultApnNotificationProtocolVersion; + return $this; + } + + /** + * The default_gcm_notification_protocol_version + * + * @param string $defaultGcmNotificationProtocolVersion The + * default_gcm_notification_protocol_version + * @return $this Fluent Builder + */ + public function setDefaultGcmNotificationProtocolVersion($defaultGcmNotificationProtocolVersion) { + $this->options['defaultGcmNotificationProtocolVersion'] = $defaultGcmNotificationProtocolVersion; + return $this; + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + $options = array(); + foreach ($this->options as $key => $value) { + if ($value != Values::NONE) { + $options[] = "$key=$value"; + } + } + return '[Twilio.Notify.V1.UpdateServiceOptions ' . implode(' ', $options) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Notify/V1/ServicePage.php b/Twilio/Rest/Notify/V1/ServicePage.php new file mode 100644 index 0000000..8293086 --- /dev/null +++ b/Twilio/Rest/Notify/V1/ServicePage.php @@ -0,0 +1,37 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Notify\V1; + +use Twilio\Page; + +class ServicePage extends Page { + public function __construct($version, $response, $solution) { + parent::__construct($version, $response); + + // Path Solution + $this->solution = $solution; + } + + public function buildInstance(array $payload) { + return new ServiceInstance( + $this->version, + $payload + ); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + return '[Twilio.Notify.V1.ServicePage]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview.php b/Twilio/Rest/Preview.php new file mode 100644 index 0000000..8898155 --- /dev/null +++ b/Twilio/Rest/Preview.php @@ -0,0 +1,167 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest; + +use Twilio\Domain; +use Twilio\Exceptions\TwilioException; +use Twilio\Rest\Preview\Sync; +use Twilio\Rest\Preview\Wireless; + +/** + * @property \Twilio\Rest\Preview\Sync sync + * @property \Twilio\Rest\Preview\Wireless wireless + * @property \Twilio\Rest\Preview\Sync\ServiceList services + * @property \Twilio\Rest\Preview\Wireless\CommandList commands + * @property \Twilio\Rest\Preview\Wireless\DeviceList devices + * @property \Twilio\Rest\Preview\Wireless\RatePlanList ratePlans + * @method \Twilio\Rest\Preview\Sync\ServiceContext services(string $sid) + * @method \Twilio\Rest\Preview\Wireless\CommandContext commands(string $sid) + * @method \Twilio\Rest\Preview\Wireless\DeviceContext devices(string $sid) + * @method \Twilio\Rest\Preview\Wireless\RatePlanContext ratePlans(string $sid) + */ +class Preview extends Domain { + protected $_sync = null; + protected $_wireless = null; + + /** + * Construct the Preview Domain + * + * @param \Twilio\Rest\Client $client Twilio\Rest\Client to communicate with + * Twilio + * @return \Twilio\Rest\Preview Domain for Preview + */ + public function __construct(Client $client) { + parent::__construct($client); + + $this->baseUrl = 'https://preview.twilio.com'; + } + + /** + * @return \Twilio\Rest\Preview\Sync Version sync of preview + */ + protected function getSync() { + if (!$this->_sync) { + $this->_sync = new Sync($this); + } + return $this->_sync; + } + + /** + * @return \Twilio\Rest\Preview\Wireless Version wireless of preview + */ + protected function getWireless() { + if (!$this->_wireless) { + $this->_wireless = new Wireless($this); + } + return $this->_wireless; + } + + /** + * Magic getter to lazy load version + * + * @param string $name Version to return + * @return \Twilio\Version The requested version + * @throws \Twilio\Exceptions\TwilioException For unknown versions + */ + public function __get($name) { + $method = 'get' . ucfirst($name); + if (method_exists($this, $method)) { + return $this->$method(); + } + + throw new TwilioException('Unknown version ' . $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) { + $method = 'context' . ucfirst($name); + if (method_exists($this, $method)) { + return call_user_func_array(array($this, $method), $arguments); + } + + throw new TwilioException('Unknown context ' . $name); + } + + /** + * @return \Twilio\Rest\Preview\Sync\ServiceList + */ + protected function getServices() { + return $this->sync->services; + } + + /** + * @param string $sid The sid + * @return \Twilio\Rest\Preview\Sync\ServiceContext + */ + protected function contextServices($sid) { + return $this->sync->services($sid); + } + + /** + * @return \Twilio\Rest\Preview\Wireless\CommandList + */ + protected function getCommands() { + return $this->wireless->commands; + } + + /** + * @param string $sid The sid + * @return \Twilio\Rest\Preview\Wireless\CommandContext + */ + protected function contextCommands($sid) { + return $this->wireless->commands($sid); + } + + /** + * @return \Twilio\Rest\Preview\Wireless\DeviceList + */ + protected function getDevices() { + return $this->wireless->devices; + } + + /** + * @param string $sid The sid + * @return \Twilio\Rest\Preview\Wireless\DeviceContext + */ + protected function contextDevices($sid) { + return $this->wireless->devices($sid); + } + + /** + * @return \Twilio\Rest\Preview\Wireless\RatePlanList + */ + protected function getRatePlans() { + return $this->wireless->ratePlans; + } + + /** + * @param string $sid The sid + * @return \Twilio\Rest\Preview\Wireless\RatePlanContext + */ + protected function contextRatePlans($sid) { + return $this->wireless->ratePlans($sid); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + return '[Twilio.Preview]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Sync.php b/Twilio/Rest/Preview/Sync.php new file mode 100644 index 0000000..d12db13 --- /dev/null +++ b/Twilio/Rest/Preview/Sync.php @@ -0,0 +1,86 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview; + +use Twilio\Domain; +use Twilio\Exceptions\TwilioException; +use Twilio\Rest\Preview\Sync\ServiceList; +use Twilio\Version; + +/** + * @property \Twilio\Rest\Preview\Sync\ServiceList services + * @method \Twilio\Rest\Preview\Sync\ServiceContext services(string $sid) + */ +class Sync extends Version { + protected $_services = null; + + /** + * Construct the Sync version of Preview + * + * @param \Twilio\Domain $domain Domain that contains the version + * @return \Twilio\Rest\Preview\Sync Sync version of Preview + */ + public function __construct(Domain $domain) { + parent::__construct($domain); + $this->version = 'Sync'; + } + + /** + * @return \Twilio\Rest\Preview\Sync\ServiceList + */ + protected function getServices() { + if (!$this->_services) { + $this->_services = new ServiceList($this); + } + return $this->_services; + } + + /** + * Magic getter to lazy load root resources + * + * @param string $name Resource to return + * @return \Twilio\ListResource The requested resource + * @throws \Twilio\Exceptions\TwilioException For unknown resource + */ + public function __get($name) { + $method = 'get' . ucfirst($name); + if (method_exists($this, $method)) { + return $this->$method(); + } + + throw new TwilioException('Unknown resource ' . $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() { + return '[Twilio.Preview.Sync]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Sync/Service/DocumentContext.php b/Twilio/Rest/Preview/Sync/Service/DocumentContext.php new file mode 100644 index 0000000..41dde49 --- /dev/null +++ b/Twilio/Rest/Preview/Sync/Service/DocumentContext.php @@ -0,0 +1,106 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Sync\Service; + +use Twilio\InstanceContext; +use Twilio\Values; +use Twilio\Version; + +class DocumentContext extends InstanceContext { + /** + * Initialize the DocumentContext + * + * @param \Twilio\Version $version Version that contains the resource + * @param string $serviceSid The service_sid + * @param string $sid The sid + * @return \Twilio\Rest\Preview\Sync\Service\DocumentContext + */ + public function __construct(Version $version, $serviceSid, $sid) { + parent::__construct($version); + + // Path Solution + $this->solution = array( + 'serviceSid' => $serviceSid, + 'sid' => $sid, + ); + + $this->uri = '/Services/' . rawurlencode($serviceSid) . '/Documents/' . rawurlencode($sid) . ''; + } + + /** + * Fetch a DocumentInstance + * + * @return DocumentInstance Fetched DocumentInstance + */ + public function fetch() { + $params = Values::of(array()); + + $payload = $this->version->fetch( + 'GET', + $this->uri, + $params + ); + + return new DocumentInstance( + $this->version, + $payload, + $this->solution['serviceSid'], + $this->solution['sid'] + ); + } + + /** + * Deletes the DocumentInstance + * + * @return boolean True if delete succeeds, false otherwise + */ + public function delete() { + return $this->version->delete('delete', $this->uri); + } + + /** + * Update the DocumentInstance + * + * @param string $data The data + * @return DocumentInstance Updated DocumentInstance + */ + public function update($data) { + $data = Values::of(array( + 'Data' => $data, + )); + + $payload = $this->version->update( + 'POST', + $this->uri, + array(), + $data + ); + + return new DocumentInstance( + $this->version, + $payload, + $this->solution['serviceSid'], + $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.Sync.DocumentContext ' . implode(' ', $context) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Sync/Service/DocumentInstance.php b/Twilio/Rest/Preview/Sync/Service/DocumentInstance.php new file mode 100644 index 0000000..78ff906 --- /dev/null +++ b/Twilio/Rest/Preview/Sync/Service/DocumentInstance.php @@ -0,0 +1,143 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Sync\Service; + +use Twilio\Deserialize; +use Twilio\Exceptions\TwilioException; +use Twilio\InstanceResource; +use Twilio\Version; + +/** + * @property string sid + * @property string uniqueName + * @property string accountSid + * @property string serviceSid + * @property string url + * @property string revision + * @property string data + * @property \DateTime dateCreated + * @property \DateTime dateUpdated + * @property string createdBy + */ +class DocumentInstance extends InstanceResource { + /** + * Initialize the DocumentInstance + * + * @param \Twilio\Version $version Version that contains the resource + * @param mixed[] $payload The response payload + * @param string $serviceSid The service_sid + * @param string $sid The sid + * @return \Twilio\Rest\Preview\Sync\Service\DocumentInstance + */ + public function __construct(Version $version, array $payload, $serviceSid, $sid = null) { + parent::__construct($version); + + // Marshaled Properties + $this->properties = array( + 'sid' => $payload['sid'], + 'uniqueName' => $payload['unique_name'], + 'accountSid' => $payload['account_sid'], + 'serviceSid' => $payload['service_sid'], + 'url' => $payload['url'], + 'revision' => $payload['revision'], + 'data' => $payload['data'], + 'dateCreated' => Deserialize::iso8601DateTime($payload['date_created']), + 'dateUpdated' => Deserialize::iso8601DateTime($payload['date_updated']), + 'createdBy' => $payload['created_by'], + ); + + $this->solution = array( + 'serviceSid' => $serviceSid, + '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\Sync\Service\DocumentContext Context for this + * DocumentInstance + */ + protected function proxy() { + if (!$this->context) { + $this->context = new DocumentContext( + $this->version, + $this->solution['serviceSid'], + $this->solution['sid'] + ); + } + + return $this->context; + } + + /** + * Fetch a DocumentInstance + * + * @return DocumentInstance Fetched DocumentInstance + */ + public function fetch() { + return $this->proxy()->fetch(); + } + + /** + * Deletes the DocumentInstance + * + * @return boolean True if delete succeeds, false otherwise + */ + public function delete() { + return $this->proxy()->delete(); + } + + /** + * Update the DocumentInstance + * + * @param string $data The data + * @return DocumentInstance Updated DocumentInstance + */ + public function update($data) { + return $this->proxy()->update( + $data + ); + } + + /** + * 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.Sync.DocumentInstance ' . implode(' ', $context) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Sync/Service/DocumentList.php b/Twilio/Rest/Preview/Sync/Service/DocumentList.php new file mode 100644 index 0000000..ca3c245 --- /dev/null +++ b/Twilio/Rest/Preview/Sync/Service/DocumentList.php @@ -0,0 +1,156 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Sync\Service; + +use Twilio\ListResource; +use Twilio\Options; +use Twilio\Values; +use Twilio\Version; + +class DocumentList extends ListResource { + /** + * Construct the DocumentList + * + * @param Version $version Version that contains the resource + * @param string $serviceSid The service_sid + * @return \Twilio\Rest\Preview\Sync\Service\DocumentList + */ + public function __construct(Version $version, $serviceSid) { + parent::__construct($version); + + // Path Solution + $this->solution = array( + 'serviceSid' => $serviceSid, + ); + + $this->uri = '/Services/' . rawurlencode($serviceSid) . '/Documents'; + } + + /** + * Create a new DocumentInstance + * + * @param array|Options $options Optional Arguments + * @return DocumentInstance Newly created DocumentInstance + */ + public function create($options = array()) { + $options = new Values($options); + + $data = Values::of(array( + 'UniqueName' => $options['uniqueName'], + 'Data' => $options['data'], + )); + + $payload = $this->version->create( + 'POST', + $this->uri, + array(), + $data + ); + + return new DocumentInstance( + $this->version, + $payload, + $this->solution['serviceSid'] + ); + } + + /** + * Streams DocumentInstance 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 DocumentInstance 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 DocumentInstance[] 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 DocumentInstance 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 DocumentInstance + */ + 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 DocumentPage($this->version, $response, $this->solution); + } + + /** + * Constructs a DocumentContext + * + * @param string $sid The sid + * @return \Twilio\Rest\Preview\Sync\Service\DocumentContext + */ + public function getContext($sid) { + return new DocumentContext( + $this->version, + $this->solution['serviceSid'], + $sid + ); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + return '[Twilio.Preview.Sync.DocumentList]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Sync/Service/DocumentOptions.php b/Twilio/Rest/Preview/Sync/Service/DocumentOptions.php new file mode 100644 index 0000000..0589d93 --- /dev/null +++ b/Twilio/Rest/Preview/Sync/Service/DocumentOptions.php @@ -0,0 +1,72 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Sync\Service; + +use Twilio\Options; +use Twilio\Values; + +abstract class DocumentOptions { + /** + * @param string $uniqueName The unique_name + * @param string $data The data + * @return CreateDocumentOptions Options builder + */ + public static function create($uniqueName = Values::NONE, $data = Values::NONE) { + return new CreateDocumentOptions($uniqueName, $data); + } +} + +class CreateDocumentOptions extends Options { + /** + * @param string $uniqueName The unique_name + * @param string $data The data + */ + public function __construct($uniqueName = Values::NONE, $data = Values::NONE) { + $this->options['uniqueName'] = $uniqueName; + $this->options['data'] = $data; + } + + /** + * The unique_name + * + * @param string $uniqueName The unique_name + * @return $this Fluent Builder + */ + public function setUniqueName($uniqueName) { + $this->options['uniqueName'] = $uniqueName; + return $this; + } + + /** + * The data + * + * @param string $data The data + * @return $this Fluent Builder + */ + public function setData($data) { + $this->options['data'] = $data; + return $this; + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + $options = array(); + foreach ($this->options as $key => $value) { + if ($value != Values::NONE) { + $options[] = "$key=$value"; + } + } + return '[Twilio.Preview.Sync.CreateDocumentOptions ' . implode(' ', $options) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Sync/Service/DocumentPage.php b/Twilio/Rest/Preview/Sync/Service/DocumentPage.php new file mode 100644 index 0000000..063f822 --- /dev/null +++ b/Twilio/Rest/Preview/Sync/Service/DocumentPage.php @@ -0,0 +1,38 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Sync\Service; + +use Twilio\Page; + +class DocumentPage extends Page { + public function __construct($version, $response, $solution) { + parent::__construct($version, $response); + + // Path Solution + $this->solution = $solution; + } + + public function buildInstance(array $payload) { + return new DocumentInstance( + $this->version, + $payload, + $this->solution['serviceSid'] + ); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + return '[Twilio.Preview.Sync.DocumentPage]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListItemContext.php b/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListItemContext.php new file mode 100644 index 0000000..aff78be --- /dev/null +++ b/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListItemContext.php @@ -0,0 +1,110 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Sync\Service\SyncList; + +use Twilio\InstanceContext; +use Twilio\Values; +use Twilio\Version; + +class SyncListItemContext extends InstanceContext { + /** + * Initialize the SyncListItemContext + * + * @param \Twilio\Version $version Version that contains the resource + * @param string $serviceSid The service_sid + * @param string $listSid The list_sid + * @param string $index The index + * @return \Twilio\Rest\Preview\Sync\Service\SyncList\SyncListItemContext + */ + public function __construct(Version $version, $serviceSid, $listSid, $index) { + parent::__construct($version); + + // Path Solution + $this->solution = array( + 'serviceSid' => $serviceSid, + 'listSid' => $listSid, + 'index' => $index, + ); + + $this->uri = '/Services/' . rawurlencode($serviceSid) . '/Lists/' . rawurlencode($listSid) . '/Items/' . rawurlencode($index) . ''; + } + + /** + * Fetch a SyncListItemInstance + * + * @return SyncListItemInstance Fetched SyncListItemInstance + */ + public function fetch() { + $params = Values::of(array()); + + $payload = $this->version->fetch( + 'GET', + $this->uri, + $params + ); + + return new SyncListItemInstance( + $this->version, + $payload, + $this->solution['serviceSid'], + $this->solution['listSid'], + $this->solution['index'] + ); + } + + /** + * Deletes the SyncListItemInstance + * + * @return boolean True if delete succeeds, false otherwise + */ + public function delete() { + return $this->version->delete('delete', $this->uri); + } + + /** + * Update the SyncListItemInstance + * + * @param string $data The data + * @return SyncListItemInstance Updated SyncListItemInstance + */ + public function update($data) { + $data = Values::of(array( + 'Data' => $data, + )); + + $payload = $this->version->update( + 'POST', + $this->uri, + array(), + $data + ); + + return new SyncListItemInstance( + $this->version, + $payload, + $this->solution['serviceSid'], + $this->solution['listSid'], + $this->solution['index'] + ); + } + + /** + * 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.Sync.SyncListItemContext ' . implode(' ', $context) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListItemInstance.php b/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListItemInstance.php new file mode 100644 index 0000000..3da03f1 --- /dev/null +++ b/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListItemInstance.php @@ -0,0 +1,145 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Sync\Service\SyncList; + +use Twilio\Deserialize; +use Twilio\Exceptions\TwilioException; +use Twilio\InstanceResource; +use Twilio\Version; + +/** + * @property string index + * @property string accountSid + * @property string serviceSid + * @property string listSid + * @property string url + * @property string revision + * @property string data + * @property \DateTime dateCreated + * @property \DateTime dateUpdated + * @property string createdBy + */ +class SyncListItemInstance extends InstanceResource { + /** + * Initialize the SyncListItemInstance + * + * @param \Twilio\Version $version Version that contains the resource + * @param mixed[] $payload The response payload + * @param string $serviceSid The service_sid + * @param string $listSid The list_sid + * @param string $index The index + * @return \Twilio\Rest\Preview\Sync\Service\SyncList\SyncListItemInstance + */ + public function __construct(Version $version, array $payload, $serviceSid, $listSid, $index = null) { + parent::__construct($version); + + // Marshaled Properties + $this->properties = array( + 'index' => $payload['index'], + 'accountSid' => $payload['account_sid'], + 'serviceSid' => $payload['service_sid'], + 'listSid' => $payload['list_sid'], + 'url' => $payload['url'], + 'revision' => $payload['revision'], + 'data' => $payload['data'], + 'dateCreated' => Deserialize::iso8601DateTime($payload['date_created']), + 'dateUpdated' => Deserialize::iso8601DateTime($payload['date_updated']), + 'createdBy' => $payload['created_by'], + ); + + $this->solution = array( + 'serviceSid' => $serviceSid, + 'listSid' => $listSid, + 'index' => $index ?: $this->properties['index'], + ); + } + + /** + * 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\Sync\Service\SyncList\SyncListItemContext Context for this SyncListItemInstance + */ + protected function proxy() { + if (!$this->context) { + $this->context = new SyncListItemContext( + $this->version, + $this->solution['serviceSid'], + $this->solution['listSid'], + $this->solution['index'] + ); + } + + return $this->context; + } + + /** + * Fetch a SyncListItemInstance + * + * @return SyncListItemInstance Fetched SyncListItemInstance + */ + public function fetch() { + return $this->proxy()->fetch(); + } + + /** + * Deletes the SyncListItemInstance + * + * @return boolean True if delete succeeds, false otherwise + */ + public function delete() { + return $this->proxy()->delete(); + } + + /** + * Update the SyncListItemInstance + * + * @param string $data The data + * @return SyncListItemInstance Updated SyncListItemInstance + */ + public function update($data) { + return $this->proxy()->update( + $data + ); + } + + /** + * 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.Sync.SyncListItemInstance ' . implode(' ', $context) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListItemList.php b/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListItemList.php new file mode 100644 index 0000000..44c6cd3 --- /dev/null +++ b/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListItemList.php @@ -0,0 +1,164 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Sync\Service\SyncList; + +use Twilio\ListResource; +use Twilio\Options; +use Twilio\Values; +use Twilio\Version; + +class SyncListItemList extends ListResource { + /** + * Construct the SyncListItemList + * + * @param Version $version Version that contains the resource + * @param string $serviceSid The service_sid + * @param string $listSid The list_sid + * @return \Twilio\Rest\Preview\Sync\Service\SyncList\SyncListItemList + */ + public function __construct(Version $version, $serviceSid, $listSid) { + parent::__construct($version); + + // Path Solution + $this->solution = array( + 'serviceSid' => $serviceSid, + 'listSid' => $listSid, + ); + + $this->uri = '/Services/' . rawurlencode($serviceSid) . '/Lists/' . rawurlencode($listSid) . '/Items'; + } + + /** + * Create a new SyncListItemInstance + * + * @param string $data The data + * @return SyncListItemInstance Newly created SyncListItemInstance + */ + public function create($data) { + $data = Values::of(array( + 'Data' => $data, + )); + + $payload = $this->version->create( + 'POST', + $this->uri, + array(), + $data + ); + + return new SyncListItemInstance( + $this->version, + $payload, + $this->solution['serviceSid'], + $this->solution['listSid'] + ); + } + + /** + * Streams SyncListItemInstance 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 $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($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 SyncListItemInstance 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 $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 SyncListItemInstance[] Array of results + */ + public function read($options = array(), $limit = null, $pageSize = Values::NONE) { + return iterator_to_array($this->stream($options, $limit, $pageSize), false); + } + + /** + * Retrieve a single page of SyncListItemInstance records from the API. + * Request is executed immediately + * + * @param array|Options $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 SyncListItemInstance + */ + public function page($options = array(), $pageSize = Values::NONE, $pageToken = Values::NONE, $pageNumber = Values::NONE) { + $options = new Values($options); + $params = Values::of(array( + 'Order' => $options['order'], + 'From' => $options['from'], + 'Bounds' => $options['bounds'], + 'PageToken' => $pageToken, + 'Page' => $pageNumber, + 'PageSize' => $pageSize, + )); + + $response = $this->version->page( + 'GET', + $this->uri, + $params + ); + + return new SyncListItemPage($this->version, $response, $this->solution); + } + + /** + * Constructs a SyncListItemContext + * + * @param string $index The index + * @return \Twilio\Rest\Preview\Sync\Service\SyncList\SyncListItemContext + */ + public function getContext($index) { + return new SyncListItemContext( + $this->version, + $this->solution['serviceSid'], + $this->solution['listSid'], + $index + ); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + return '[Twilio.Preview.Sync.SyncListItemList]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListItemOptions.php b/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListItemOptions.php new file mode 100644 index 0000000..e3ddb32 --- /dev/null +++ b/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListItemOptions.php @@ -0,0 +1,86 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Sync\Service\SyncList; + +use Twilio\Options; +use Twilio\Values; + +abstract class SyncListItemOptions { + /** + * @param string $order The order + * @param string $from The from + * @param string $bounds The bounds + * @return ReadSyncListItemOptions Options builder + */ + public static function read($order = Values::NONE, $from = Values::NONE, $bounds = Values::NONE) { + return new ReadSyncListItemOptions($order, $from, $bounds); + } +} + +class ReadSyncListItemOptions extends Options { + /** + * @param string $order The order + * @param string $from The from + * @param string $bounds The bounds + */ + public function __construct($order = Values::NONE, $from = Values::NONE, $bounds = Values::NONE) { + $this->options['order'] = $order; + $this->options['from'] = $from; + $this->options['bounds'] = $bounds; + } + + /** + * The order + * + * @param string $order The order + * @return $this Fluent Builder + */ + public function setOrder($order) { + $this->options['order'] = $order; + return $this; + } + + /** + * The from + * + * @param string $from The from + * @return $this Fluent Builder + */ + public function setFrom($from) { + $this->options['from'] = $from; + return $this; + } + + /** + * The bounds + * + * @param string $bounds The bounds + * @return $this Fluent Builder + */ + public function setBounds($bounds) { + $this->options['bounds'] = $bounds; + return $this; + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + $options = array(); + foreach ($this->options as $key => $value) { + if ($value != Values::NONE) { + $options[] = "$key=$value"; + } + } + return '[Twilio.Preview.Sync.ReadSyncListItemOptions ' . implode(' ', $options) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListItemPage.php b/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListItemPage.php new file mode 100644 index 0000000..0e5941a --- /dev/null +++ b/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListItemPage.php @@ -0,0 +1,39 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Sync\Service\SyncList; + +use Twilio\Page; + +class SyncListItemPage extends Page { + public function __construct($version, $response, $solution) { + parent::__construct($version, $response); + + // Path Solution + $this->solution = $solution; + } + + public function buildInstance(array $payload) { + return new SyncListItemInstance( + $this->version, + $payload, + $this->solution['serviceSid'], + $this->solution['listSid'] + ); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + return '[Twilio.Preview.Sync.SyncListItemPage]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Sync/Service/SyncListContext.php b/Twilio/Rest/Preview/Sync/Service/SyncListContext.php new file mode 100644 index 0000000..dfc04c9 --- /dev/null +++ b/Twilio/Rest/Preview/Sync/Service/SyncListContext.php @@ -0,0 +1,138 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Sync\Service; + +use Twilio\Exceptions\TwilioException; +use Twilio\InstanceContext; +use Twilio\Rest\Preview\Sync\Service\SyncList\SyncListItemList; +use Twilio\Values; +use Twilio\Version; + +/** + * @property \Twilio\Rest\Preview\Sync\Service\SyncList\SyncListItemList syncListItems + * @method \Twilio\Rest\Preview\Sync\Service\SyncList\SyncListItemContext syncListItems(string $index) + */ +class SyncListContext extends InstanceContext { + protected $_syncListItems = null; + + /** + * Initialize the SyncListContext + * + * @param \Twilio\Version $version Version that contains the resource + * @param string $serviceSid The service_sid + * @param string $sid The sid + * @return \Twilio\Rest\Preview\Sync\Service\SyncListContext + */ + public function __construct(Version $version, $serviceSid, $sid) { + parent::__construct($version); + + // Path Solution + $this->solution = array( + 'serviceSid' => $serviceSid, + 'sid' => $sid, + ); + + $this->uri = '/Services/' . rawurlencode($serviceSid) . '/Lists/' . rawurlencode($sid) . ''; + } + + /** + * Fetch a SyncListInstance + * + * @return SyncListInstance Fetched SyncListInstance + */ + public function fetch() { + $params = Values::of(array()); + + $payload = $this->version->fetch( + 'GET', + $this->uri, + $params + ); + + return new SyncListInstance( + $this->version, + $payload, + $this->solution['serviceSid'], + $this->solution['sid'] + ); + } + + /** + * Deletes the SyncListInstance + * + * @return boolean True if delete succeeds, false otherwise + */ + public function delete() { + return $this->version->delete('delete', $this->uri); + } + + /** + * Access the syncListItems + * + * @return \Twilio\Rest\Preview\Sync\Service\SyncList\SyncListItemList + */ + protected function getSyncListItems() { + if (!$this->_syncListItems) { + $this->_syncListItems = new SyncListItemList( + $this->version, + $this->solution['serviceSid'], + $this->solution['sid'] + ); + } + + return $this->_syncListItems; + } + + /** + * 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.Sync.SyncListContext ' . implode(' ', $context) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Sync/Service/SyncListInstance.php b/Twilio/Rest/Preview/Sync/Service/SyncListInstance.php new file mode 100644 index 0000000..6df7bd3 --- /dev/null +++ b/Twilio/Rest/Preview/Sync/Service/SyncListInstance.php @@ -0,0 +1,142 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Sync\Service; + +use Twilio\Deserialize; +use Twilio\Exceptions\TwilioException; +use Twilio\InstanceResource; +use Twilio\Version; + +/** + * @property string sid + * @property string uniqueName + * @property string accountSid + * @property string serviceSid + * @property string url + * @property string links + * @property string revision + * @property \DateTime dateCreated + * @property \DateTime dateUpdated + * @property string createdBy + */ +class SyncListInstance extends InstanceResource { + protected $_syncListItems = null; + + /** + * Initialize the SyncListInstance + * + * @param \Twilio\Version $version Version that contains the resource + * @param mixed[] $payload The response payload + * @param string $serviceSid The service_sid + * @param string $sid The sid + * @return \Twilio\Rest\Preview\Sync\Service\SyncListInstance + */ + public function __construct(Version $version, array $payload, $serviceSid, $sid = null) { + parent::__construct($version); + + // Marshaled Properties + $this->properties = array( + 'sid' => $payload['sid'], + 'uniqueName' => $payload['unique_name'], + 'accountSid' => $payload['account_sid'], + 'serviceSid' => $payload['service_sid'], + 'url' => $payload['url'], + 'links' => $payload['links'], + 'revision' => $payload['revision'], + 'dateCreated' => Deserialize::iso8601DateTime($payload['date_created']), + 'dateUpdated' => Deserialize::iso8601DateTime($payload['date_updated']), + 'createdBy' => $payload['created_by'], + ); + + $this->solution = array( + 'serviceSid' => $serviceSid, + '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\Sync\Service\SyncListContext Context for this + * SyncListInstance + */ + protected function proxy() { + if (!$this->context) { + $this->context = new SyncListContext( + $this->version, + $this->solution['serviceSid'], + $this->solution['sid'] + ); + } + + return $this->context; + } + + /** + * Fetch a SyncListInstance + * + * @return SyncListInstance Fetched SyncListInstance + */ + public function fetch() { + return $this->proxy()->fetch(); + } + + /** + * Deletes the SyncListInstance + * + * @return boolean True if delete succeeds, false otherwise + */ + public function delete() { + return $this->proxy()->delete(); + } + + /** + * Access the syncListItems + * + * @return \Twilio\Rest\Preview\Sync\Service\SyncList\SyncListItemList + */ + protected function getSyncListItems() { + return $this->proxy()->syncListItems; + } + + /** + * 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.Sync.SyncListInstance ' . implode(' ', $context) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Sync/Service/SyncListList.php b/Twilio/Rest/Preview/Sync/Service/SyncListList.php new file mode 100644 index 0000000..32ed8d9 --- /dev/null +++ b/Twilio/Rest/Preview/Sync/Service/SyncListList.php @@ -0,0 +1,155 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Sync\Service; + +use Twilio\ListResource; +use Twilio\Options; +use Twilio\Values; +use Twilio\Version; + +class SyncListList extends ListResource { + /** + * Construct the SyncListList + * + * @param Version $version Version that contains the resource + * @param string $serviceSid The service_sid + * @return \Twilio\Rest\Preview\Sync\Service\SyncListList + */ + public function __construct(Version $version, $serviceSid) { + parent::__construct($version); + + // Path Solution + $this->solution = array( + 'serviceSid' => $serviceSid, + ); + + $this->uri = '/Services/' . rawurlencode($serviceSid) . '/Lists'; + } + + /** + * Create a new SyncListInstance + * + * @param array|Options $options Optional Arguments + * @return SyncListInstance Newly created SyncListInstance + */ + public function create($options = array()) { + $options = new Values($options); + + $data = Values::of(array( + 'UniqueName' => $options['uniqueName'], + )); + + $payload = $this->version->create( + 'POST', + $this->uri, + array(), + $data + ); + + return new SyncListInstance( + $this->version, + $payload, + $this->solution['serviceSid'] + ); + } + + /** + * Streams SyncListInstance 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 SyncListInstance 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 SyncListInstance[] 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 SyncListInstance 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 SyncListInstance + */ + 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 SyncListPage($this->version, $response, $this->solution); + } + + /** + * Constructs a SyncListContext + * + * @param string $sid The sid + * @return \Twilio\Rest\Preview\Sync\Service\SyncListContext + */ + public function getContext($sid) { + return new SyncListContext( + $this->version, + $this->solution['serviceSid'], + $sid + ); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + return '[Twilio.Preview.Sync.SyncListList]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Sync/Service/SyncListOptions.php b/Twilio/Rest/Preview/Sync/Service/SyncListOptions.php new file mode 100644 index 0000000..da57a22 --- /dev/null +++ b/Twilio/Rest/Preview/Sync/Service/SyncListOptions.php @@ -0,0 +1,58 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Sync\Service; + +use Twilio\Options; +use Twilio\Values; + +abstract class SyncListOptions { + /** + * @param string $uniqueName The unique_name + * @return CreateSyncListOptions Options builder + */ + public static function create($uniqueName = Values::NONE) { + return new CreateSyncListOptions($uniqueName); + } +} + +class CreateSyncListOptions extends Options { + /** + * @param string $uniqueName The unique_name + */ + public function __construct($uniqueName = Values::NONE) { + $this->options['uniqueName'] = $uniqueName; + } + + /** + * The unique_name + * + * @param string $uniqueName The unique_name + * @return $this Fluent Builder + */ + public function setUniqueName($uniqueName) { + $this->options['uniqueName'] = $uniqueName; + return $this; + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + $options = array(); + foreach ($this->options as $key => $value) { + if ($value != Values::NONE) { + $options[] = "$key=$value"; + } + } + return '[Twilio.Preview.Sync.CreateSyncListOptions ' . implode(' ', $options) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Sync/Service/SyncListPage.php b/Twilio/Rest/Preview/Sync/Service/SyncListPage.php new file mode 100644 index 0000000..20d3029 --- /dev/null +++ b/Twilio/Rest/Preview/Sync/Service/SyncListPage.php @@ -0,0 +1,38 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Sync\Service; + +use Twilio\Page; + +class SyncListPage extends Page { + public function __construct($version, $response, $solution) { + parent::__construct($version, $response); + + // Path Solution + $this->solution = $solution; + } + + public function buildInstance(array $payload) { + return new SyncListInstance( + $this->version, + $payload, + $this->solution['serviceSid'] + ); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + return '[Twilio.Preview.Sync.SyncListPage]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapItemContext.php b/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapItemContext.php new file mode 100644 index 0000000..d8f4b51 --- /dev/null +++ b/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapItemContext.php @@ -0,0 +1,110 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Sync\Service\SyncMap; + +use Twilio\InstanceContext; +use Twilio\Values; +use Twilio\Version; + +class SyncMapItemContext extends InstanceContext { + /** + * Initialize the SyncMapItemContext + * + * @param \Twilio\Version $version Version that contains the resource + * @param string $serviceSid The service_sid + * @param string $mapSid The map_sid + * @param string $key The key + * @return \Twilio\Rest\Preview\Sync\Service\SyncMap\SyncMapItemContext + */ + public function __construct(Version $version, $serviceSid, $mapSid, $key) { + parent::__construct($version); + + // Path Solution + $this->solution = array( + 'serviceSid' => $serviceSid, + 'mapSid' => $mapSid, + 'key' => $key, + ); + + $this->uri = '/Services/' . rawurlencode($serviceSid) . '/Maps/' . rawurlencode($mapSid) . '/Items/' . rawurlencode($key) . ''; + } + + /** + * Fetch a SyncMapItemInstance + * + * @return SyncMapItemInstance Fetched SyncMapItemInstance + */ + public function fetch() { + $params = Values::of(array()); + + $payload = $this->version->fetch( + 'GET', + $this->uri, + $params + ); + + return new SyncMapItemInstance( + $this->version, + $payload, + $this->solution['serviceSid'], + $this->solution['mapSid'], + $this->solution['key'] + ); + } + + /** + * Deletes the SyncMapItemInstance + * + * @return boolean True if delete succeeds, false otherwise + */ + public function delete() { + return $this->version->delete('delete', $this->uri); + } + + /** + * Update the SyncMapItemInstance + * + * @param string $data The data + * @return SyncMapItemInstance Updated SyncMapItemInstance + */ + public function update($data) { + $data = Values::of(array( + 'Data' => $data, + )); + + $payload = $this->version->update( + 'POST', + $this->uri, + array(), + $data + ); + + return new SyncMapItemInstance( + $this->version, + $payload, + $this->solution['serviceSid'], + $this->solution['mapSid'], + $this->solution['key'] + ); + } + + /** + * 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.Sync.SyncMapItemContext ' . implode(' ', $context) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapItemInstance.php b/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapItemInstance.php new file mode 100644 index 0000000..f603f0a --- /dev/null +++ b/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapItemInstance.php @@ -0,0 +1,148 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Sync\Service\SyncMap; + +use Twilio\Deserialize; +use Twilio\Exceptions\TwilioException; +use Twilio\InstanceResource; +use Twilio\Version; + +/** + * @property string key + * @property string accountSid + * @property string serviceSid + * @property string mapSid + * @property string url + * @property string revision + * @property string data + * @property \DateTime dateCreated + * @property \DateTime dateUpdated + * @property string createdBy + */ +class SyncMapItemInstance extends InstanceResource { + /** + * Initialize the SyncMapItemInstance + * + * @param \Twilio\Version $version Version that contains the resource + * @param mixed[] $payload The response payload + * @param string $serviceSid The service_sid + * @param string $mapSid The map_sid + * @param string $key The key + * @return \Twilio\Rest\Preview\Sync\Service\SyncMap\SyncMapItemInstance + */ + public function __construct(Version $version, array $payload, $serviceSid, $mapSid, $key = null) { + parent::__construct($version); + + // Marshaled Properties + $this->properties = array( + 'key' => $payload['key'], + 'accountSid' => $payload['account_sid'], + 'serviceSid' => $payload['service_sid'], + 'mapSid' => $payload['map_sid'], + 'url' => $payload['url'], + 'revision' => $payload['revision'], + 'data' => $payload['data'], + 'dateCreated' => Deserialize::iso8601DateTime($payload['date_created']), + 'dateUpdated' => Deserialize::iso8601DateTime($payload['date_updated']), + 'createdBy' => $payload['created_by'], + ); + + $this->solution = array( + 'serviceSid' => $serviceSid, + 'mapSid' => $mapSid, + 'key' => $key ?: $this->properties['key'], + ); + } + + /** + * 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\Sync\Service\SyncMap\SyncMapItemContext Context + * for + * this + * SyncMapItemInstance + */ + protected function proxy() { + if (!$this->context) { + $this->context = new SyncMapItemContext( + $this->version, + $this->solution['serviceSid'], + $this->solution['mapSid'], + $this->solution['key'] + ); + } + + return $this->context; + } + + /** + * Fetch a SyncMapItemInstance + * + * @return SyncMapItemInstance Fetched SyncMapItemInstance + */ + public function fetch() { + return $this->proxy()->fetch(); + } + + /** + * Deletes the SyncMapItemInstance + * + * @return boolean True if delete succeeds, false otherwise + */ + public function delete() { + return $this->proxy()->delete(); + } + + /** + * Update the SyncMapItemInstance + * + * @param string $data The data + * @return SyncMapItemInstance Updated SyncMapItemInstance + */ + public function update($data) { + return $this->proxy()->update( + $data + ); + } + + /** + * 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.Sync.SyncMapItemInstance ' . implode(' ', $context) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapItemList.php b/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapItemList.php new file mode 100644 index 0000000..4192eeb --- /dev/null +++ b/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapItemList.php @@ -0,0 +1,166 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Sync\Service\SyncMap; + +use Twilio\ListResource; +use Twilio\Options; +use Twilio\Values; +use Twilio\Version; + +class SyncMapItemList extends ListResource { + /** + * Construct the SyncMapItemList + * + * @param Version $version Version that contains the resource + * @param string $serviceSid The service_sid + * @param string $mapSid The map_sid + * @return \Twilio\Rest\Preview\Sync\Service\SyncMap\SyncMapItemList + */ + public function __construct(Version $version, $serviceSid, $mapSid) { + parent::__construct($version); + + // Path Solution + $this->solution = array( + 'serviceSid' => $serviceSid, + 'mapSid' => $mapSid, + ); + + $this->uri = '/Services/' . rawurlencode($serviceSid) . '/Maps/' . rawurlencode($mapSid) . '/Items'; + } + + /** + * Create a new SyncMapItemInstance + * + * @param string $key The key + * @param string $data The data + * @return SyncMapItemInstance Newly created SyncMapItemInstance + */ + public function create($key, $data) { + $data = Values::of(array( + 'Key' => $key, + 'Data' => $data, + )); + + $payload = $this->version->create( + 'POST', + $this->uri, + array(), + $data + ); + + return new SyncMapItemInstance( + $this->version, + $payload, + $this->solution['serviceSid'], + $this->solution['mapSid'] + ); + } + + /** + * Streams SyncMapItemInstance 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 $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($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 SyncMapItemInstance 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 $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 SyncMapItemInstance[] Array of results + */ + public function read($options = array(), $limit = null, $pageSize = Values::NONE) { + return iterator_to_array($this->stream($options, $limit, $pageSize), false); + } + + /** + * Retrieve a single page of SyncMapItemInstance records from the API. + * Request is executed immediately + * + * @param array|Options $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 SyncMapItemInstance + */ + public function page($options = array(), $pageSize = Values::NONE, $pageToken = Values::NONE, $pageNumber = Values::NONE) { + $options = new Values($options); + $params = Values::of(array( + 'Order' => $options['order'], + 'From' => $options['from'], + 'Bounds' => $options['bounds'], + 'PageToken' => $pageToken, + 'Page' => $pageNumber, + 'PageSize' => $pageSize, + )); + + $response = $this->version->page( + 'GET', + $this->uri, + $params + ); + + return new SyncMapItemPage($this->version, $response, $this->solution); + } + + /** + * Constructs a SyncMapItemContext + * + * @param string $key The key + * @return \Twilio\Rest\Preview\Sync\Service\SyncMap\SyncMapItemContext + */ + public function getContext($key) { + return new SyncMapItemContext( + $this->version, + $this->solution['serviceSid'], + $this->solution['mapSid'], + $key + ); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + return '[Twilio.Preview.Sync.SyncMapItemList]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapItemOptions.php b/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapItemOptions.php new file mode 100644 index 0000000..44f91bb --- /dev/null +++ b/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapItemOptions.php @@ -0,0 +1,86 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Sync\Service\SyncMap; + +use Twilio\Options; +use Twilio\Values; + +abstract class SyncMapItemOptions { + /** + * @param string $order The order + * @param string $from The from + * @param string $bounds The bounds + * @return ReadSyncMapItemOptions Options builder + */ + public static function read($order = Values::NONE, $from = Values::NONE, $bounds = Values::NONE) { + return new ReadSyncMapItemOptions($order, $from, $bounds); + } +} + +class ReadSyncMapItemOptions extends Options { + /** + * @param string $order The order + * @param string $from The from + * @param string $bounds The bounds + */ + public function __construct($order = Values::NONE, $from = Values::NONE, $bounds = Values::NONE) { + $this->options['order'] = $order; + $this->options['from'] = $from; + $this->options['bounds'] = $bounds; + } + + /** + * The order + * + * @param string $order The order + * @return $this Fluent Builder + */ + public function setOrder($order) { + $this->options['order'] = $order; + return $this; + } + + /** + * The from + * + * @param string $from The from + * @return $this Fluent Builder + */ + public function setFrom($from) { + $this->options['from'] = $from; + return $this; + } + + /** + * The bounds + * + * @param string $bounds The bounds + * @return $this Fluent Builder + */ + public function setBounds($bounds) { + $this->options['bounds'] = $bounds; + return $this; + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + $options = array(); + foreach ($this->options as $key => $value) { + if ($value != Values::NONE) { + $options[] = "$key=$value"; + } + } + return '[Twilio.Preview.Sync.ReadSyncMapItemOptions ' . implode(' ', $options) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapItemPage.php b/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapItemPage.php new file mode 100644 index 0000000..2654de8 --- /dev/null +++ b/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapItemPage.php @@ -0,0 +1,39 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Sync\Service\SyncMap; + +use Twilio\Page; + +class SyncMapItemPage extends Page { + public function __construct($version, $response, $solution) { + parent::__construct($version, $response); + + // Path Solution + $this->solution = $solution; + } + + public function buildInstance(array $payload) { + return new SyncMapItemInstance( + $this->version, + $payload, + $this->solution['serviceSid'], + $this->solution['mapSid'] + ); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + return '[Twilio.Preview.Sync.SyncMapItemPage]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Sync/Service/SyncMapContext.php b/Twilio/Rest/Preview/Sync/Service/SyncMapContext.php new file mode 100644 index 0000000..b1a589d --- /dev/null +++ b/Twilio/Rest/Preview/Sync/Service/SyncMapContext.php @@ -0,0 +1,138 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Sync\Service; + +use Twilio\Exceptions\TwilioException; +use Twilio\InstanceContext; +use Twilio\Rest\Preview\Sync\Service\SyncMap\SyncMapItemList; +use Twilio\Values; +use Twilio\Version; + +/** + * @property \Twilio\Rest\Preview\Sync\Service\SyncMap\SyncMapItemList syncMapItems + * @method \Twilio\Rest\Preview\Sync\Service\SyncMap\SyncMapItemContext syncMapItems(string $key) + */ +class SyncMapContext extends InstanceContext { + protected $_syncMapItems = null; + + /** + * Initialize the SyncMapContext + * + * @param \Twilio\Version $version Version that contains the resource + * @param string $serviceSid The service_sid + * @param string $sid The sid + * @return \Twilio\Rest\Preview\Sync\Service\SyncMapContext + */ + public function __construct(Version $version, $serviceSid, $sid) { + parent::__construct($version); + + // Path Solution + $this->solution = array( + 'serviceSid' => $serviceSid, + 'sid' => $sid, + ); + + $this->uri = '/Services/' . rawurlencode($serviceSid) . '/Maps/' . rawurlencode($sid) . ''; + } + + /** + * Fetch a SyncMapInstance + * + * @return SyncMapInstance Fetched SyncMapInstance + */ + public function fetch() { + $params = Values::of(array()); + + $payload = $this->version->fetch( + 'GET', + $this->uri, + $params + ); + + return new SyncMapInstance( + $this->version, + $payload, + $this->solution['serviceSid'], + $this->solution['sid'] + ); + } + + /** + * Deletes the SyncMapInstance + * + * @return boolean True if delete succeeds, false otherwise + */ + public function delete() { + return $this->version->delete('delete', $this->uri); + } + + /** + * Access the syncMapItems + * + * @return \Twilio\Rest\Preview\Sync\Service\SyncMap\SyncMapItemList + */ + protected function getSyncMapItems() { + if (!$this->_syncMapItems) { + $this->_syncMapItems = new SyncMapItemList( + $this->version, + $this->solution['serviceSid'], + $this->solution['sid'] + ); + } + + return $this->_syncMapItems; + } + + /** + * 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.Sync.SyncMapContext ' . implode(' ', $context) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Sync/Service/SyncMapInstance.php b/Twilio/Rest/Preview/Sync/Service/SyncMapInstance.php new file mode 100644 index 0000000..fa2fdcf --- /dev/null +++ b/Twilio/Rest/Preview/Sync/Service/SyncMapInstance.php @@ -0,0 +1,142 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Sync\Service; + +use Twilio\Deserialize; +use Twilio\Exceptions\TwilioException; +use Twilio\InstanceResource; +use Twilio\Version; + +/** + * @property string sid + * @property string uniqueName + * @property string accountSid + * @property string serviceSid + * @property string url + * @property string links + * @property string revision + * @property \DateTime dateCreated + * @property \DateTime dateUpdated + * @property string createdBy + */ +class SyncMapInstance extends InstanceResource { + protected $_syncMapItems = null; + + /** + * Initialize the SyncMapInstance + * + * @param \Twilio\Version $version Version that contains the resource + * @param mixed[] $payload The response payload + * @param string $serviceSid The service_sid + * @param string $sid The sid + * @return \Twilio\Rest\Preview\Sync\Service\SyncMapInstance + */ + public function __construct(Version $version, array $payload, $serviceSid, $sid = null) { + parent::__construct($version); + + // Marshaled Properties + $this->properties = array( + 'sid' => $payload['sid'], + 'uniqueName' => $payload['unique_name'], + 'accountSid' => $payload['account_sid'], + 'serviceSid' => $payload['service_sid'], + 'url' => $payload['url'], + 'links' => $payload['links'], + 'revision' => $payload['revision'], + 'dateCreated' => Deserialize::iso8601DateTime($payload['date_created']), + 'dateUpdated' => Deserialize::iso8601DateTime($payload['date_updated']), + 'createdBy' => $payload['created_by'], + ); + + $this->solution = array( + 'serviceSid' => $serviceSid, + '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\Sync\Service\SyncMapContext Context for this + * SyncMapInstance + */ + protected function proxy() { + if (!$this->context) { + $this->context = new SyncMapContext( + $this->version, + $this->solution['serviceSid'], + $this->solution['sid'] + ); + } + + return $this->context; + } + + /** + * Fetch a SyncMapInstance + * + * @return SyncMapInstance Fetched SyncMapInstance + */ + public function fetch() { + return $this->proxy()->fetch(); + } + + /** + * Deletes the SyncMapInstance + * + * @return boolean True if delete succeeds, false otherwise + */ + public function delete() { + return $this->proxy()->delete(); + } + + /** + * Access the syncMapItems + * + * @return \Twilio\Rest\Preview\Sync\Service\SyncMap\SyncMapItemList + */ + protected function getSyncMapItems() { + return $this->proxy()->syncMapItems; + } + + /** + * 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.Sync.SyncMapInstance ' . implode(' ', $context) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Sync/Service/SyncMapList.php b/Twilio/Rest/Preview/Sync/Service/SyncMapList.php new file mode 100644 index 0000000..2c6d4e9 --- /dev/null +++ b/Twilio/Rest/Preview/Sync/Service/SyncMapList.php @@ -0,0 +1,155 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Sync\Service; + +use Twilio\ListResource; +use Twilio\Options; +use Twilio\Values; +use Twilio\Version; + +class SyncMapList extends ListResource { + /** + * Construct the SyncMapList + * + * @param Version $version Version that contains the resource + * @param string $serviceSid The service_sid + * @return \Twilio\Rest\Preview\Sync\Service\SyncMapList + */ + public function __construct(Version $version, $serviceSid) { + parent::__construct($version); + + // Path Solution + $this->solution = array( + 'serviceSid' => $serviceSid, + ); + + $this->uri = '/Services/' . rawurlencode($serviceSid) . '/Maps'; + } + + /** + * Create a new SyncMapInstance + * + * @param array|Options $options Optional Arguments + * @return SyncMapInstance Newly created SyncMapInstance + */ + public function create($options = array()) { + $options = new Values($options); + + $data = Values::of(array( + 'UniqueName' => $options['uniqueName'], + )); + + $payload = $this->version->create( + 'POST', + $this->uri, + array(), + $data + ); + + return new SyncMapInstance( + $this->version, + $payload, + $this->solution['serviceSid'] + ); + } + + /** + * Streams SyncMapInstance 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 SyncMapInstance 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 SyncMapInstance[] 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 SyncMapInstance 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 SyncMapInstance + */ + 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 SyncMapPage($this->version, $response, $this->solution); + } + + /** + * Constructs a SyncMapContext + * + * @param string $sid The sid + * @return \Twilio\Rest\Preview\Sync\Service\SyncMapContext + */ + public function getContext($sid) { + return new SyncMapContext( + $this->version, + $this->solution['serviceSid'], + $sid + ); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + return '[Twilio.Preview.Sync.SyncMapList]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Sync/Service/SyncMapOptions.php b/Twilio/Rest/Preview/Sync/Service/SyncMapOptions.php new file mode 100644 index 0000000..c3ea0f8 --- /dev/null +++ b/Twilio/Rest/Preview/Sync/Service/SyncMapOptions.php @@ -0,0 +1,58 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Sync\Service; + +use Twilio\Options; +use Twilio\Values; + +abstract class SyncMapOptions { + /** + * @param string $uniqueName The unique_name + * @return CreateSyncMapOptions Options builder + */ + public static function create($uniqueName = Values::NONE) { + return new CreateSyncMapOptions($uniqueName); + } +} + +class CreateSyncMapOptions extends Options { + /** + * @param string $uniqueName The unique_name + */ + public function __construct($uniqueName = Values::NONE) { + $this->options['uniqueName'] = $uniqueName; + } + + /** + * The unique_name + * + * @param string $uniqueName The unique_name + * @return $this Fluent Builder + */ + public function setUniqueName($uniqueName) { + $this->options['uniqueName'] = $uniqueName; + return $this; + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + $options = array(); + foreach ($this->options as $key => $value) { + if ($value != Values::NONE) { + $options[] = "$key=$value"; + } + } + return '[Twilio.Preview.Sync.CreateSyncMapOptions ' . implode(' ', $options) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Sync/Service/SyncMapPage.php b/Twilio/Rest/Preview/Sync/Service/SyncMapPage.php new file mode 100644 index 0000000..553cde9 --- /dev/null +++ b/Twilio/Rest/Preview/Sync/Service/SyncMapPage.php @@ -0,0 +1,38 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Sync\Service; + +use Twilio\Page; + +class SyncMapPage extends Page { + public function __construct($version, $response, $solution) { + parent::__construct($version, $response); + + // Path Solution + $this->solution = $solution; + } + + public function buildInstance(array $payload) { + return new SyncMapInstance( + $this->version, + $payload, + $this->solution['serviceSid'] + ); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + return '[Twilio.Preview.Sync.SyncMapPage]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Sync/ServiceContext.php b/Twilio/Rest/Preview/Sync/ServiceContext.php new file mode 100644 index 0000000..be9e62f --- /dev/null +++ b/Twilio/Rest/Preview/Sync/ServiceContext.php @@ -0,0 +1,204 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Sync; + +use Twilio\Exceptions\TwilioException; +use Twilio\InstanceContext; +use Twilio\Options; +use Twilio\Rest\Preview\Sync\Service\DocumentList; +use Twilio\Rest\Preview\Sync\Service\SyncListList; +use Twilio\Rest\Preview\Sync\Service\SyncMapList; +use Twilio\Values; +use Twilio\Version; + +/** + * @property \Twilio\Rest\Preview\Sync\Service\DocumentList documents + * @property \Twilio\Rest\Preview\Sync\Service\SyncListList syncLists + * @property \Twilio\Rest\Preview\Sync\Service\SyncMapList syncMaps + * @method \Twilio\Rest\Preview\Sync\Service\DocumentContext documents(string $sid) + * @method \Twilio\Rest\Preview\Sync\Service\SyncListContext syncLists(string $sid) + * @method \Twilio\Rest\Preview\Sync\Service\SyncMapContext syncMaps(string $sid) + */ +class ServiceContext extends InstanceContext { + protected $_documents = null; + protected $_syncLists = null; + protected $_syncMaps = null; + + /** + * Initialize the ServiceContext + * + * @param \Twilio\Version $version Version that contains the resource + * @param string $sid The sid + * @return \Twilio\Rest\Preview\Sync\ServiceContext + */ + public function __construct(Version $version, $sid) { + parent::__construct($version); + + // Path Solution + $this->solution = array( + 'sid' => $sid, + ); + + $this->uri = '/Services/' . rawurlencode($sid) . ''; + } + + /** + * Fetch a ServiceInstance + * + * @return ServiceInstance Fetched ServiceInstance + */ + public function fetch() { + $params = Values::of(array()); + + $payload = $this->version->fetch( + 'GET', + $this->uri, + $params + ); + + return new ServiceInstance( + $this->version, + $payload, + $this->solution['sid'] + ); + } + + /** + * Deletes the ServiceInstance + * + * @return boolean True if delete succeeds, false otherwise + */ + public function delete() { + return $this->version->delete('delete', $this->uri); + } + + /** + * Update the ServiceInstance + * + * @param array|Options $options Optional Arguments + * @return ServiceInstance Updated ServiceInstance + */ + public function update($options = array()) { + $options = new Values($options); + + $data = Values::of(array( + 'WebhookUrl' => $options['webhookUrl'], + 'FriendlyName' => $options['friendlyName'], + 'ReachabilityWebhooksEnabled' => $options['reachabilityWebhooksEnabled'], + )); + + $payload = $this->version->update( + 'POST', + $this->uri, + array(), + $data + ); + + return new ServiceInstance( + $this->version, + $payload, + $this->solution['sid'] + ); + } + + /** + * Access the documents + * + * @return \Twilio\Rest\Preview\Sync\Service\DocumentList + */ + protected function getDocuments() { + if (!$this->_documents) { + $this->_documents = new DocumentList( + $this->version, + $this->solution['sid'] + ); + } + + return $this->_documents; + } + + /** + * Access the syncLists + * + * @return \Twilio\Rest\Preview\Sync\Service\SyncListList + */ + protected function getSyncLists() { + if (!$this->_syncLists) { + $this->_syncLists = new SyncListList( + $this->version, + $this->solution['sid'] + ); + } + + return $this->_syncLists; + } + + /** + * Access the syncMaps + * + * @return \Twilio\Rest\Preview\Sync\Service\SyncMapList + */ + protected function getSyncMaps() { + if (!$this->_syncMaps) { + $this->_syncMaps = new SyncMapList( + $this->version, + $this->solution['sid'] + ); + } + + return $this->_syncMaps; + } + + /** + * 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.Sync.ServiceContext ' . implode(' ', $context) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Sync/ServiceInstance.php b/Twilio/Rest/Preview/Sync/ServiceInstance.php new file mode 100644 index 0000000..a4049b6 --- /dev/null +++ b/Twilio/Rest/Preview/Sync/ServiceInstance.php @@ -0,0 +1,170 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Sync; + +use Twilio\Deserialize; +use Twilio\Exceptions\TwilioException; +use Twilio\InstanceResource; +use Twilio\Options; +use Twilio\Version; + +/** + * @property string sid + * @property string accountSid + * @property string friendlyName + * @property \DateTime dateCreated + * @property \DateTime dateUpdated + * @property string url + * @property string webhookUrl + * @property string reachabilityWebhooksEnabled + * @property string links + */ +class ServiceInstance extends InstanceResource { + protected $_documents = null; + protected $_syncLists = null; + protected $_syncMaps = null; + + /** + * Initialize the ServiceInstance + * + * @param \Twilio\Version $version Version that contains the resource + * @param mixed[] $payload The response payload + * @param string $sid The sid + * @return \Twilio\Rest\Preview\Sync\ServiceInstance + */ + public function __construct(Version $version, array $payload, $sid = null) { + parent::__construct($version); + + // Marshaled Properties + $this->properties = array( + 'sid' => $payload['sid'], + 'accountSid' => $payload['account_sid'], + 'friendlyName' => $payload['friendly_name'], + 'dateCreated' => Deserialize::iso8601DateTime($payload['date_created']), + 'dateUpdated' => Deserialize::iso8601DateTime($payload['date_updated']), + 'url' => $payload['url'], + 'webhookUrl' => $payload['webhook_url'], + 'reachabilityWebhooksEnabled' => $payload['reachability_webhooks_enabled'], + '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\Sync\ServiceContext Context for this + * ServiceInstance + */ + protected function proxy() { + if (!$this->context) { + $this->context = new ServiceContext( + $this->version, + $this->solution['sid'] + ); + } + + return $this->context; + } + + /** + * Fetch a ServiceInstance + * + * @return ServiceInstance Fetched ServiceInstance + */ + public function fetch() { + return $this->proxy()->fetch(); + } + + /** + * Deletes the ServiceInstance + * + * @return boolean True if delete succeeds, false otherwise + */ + public function delete() { + return $this->proxy()->delete(); + } + + /** + * Update the ServiceInstance + * + * @param array|Options $options Optional Arguments + * @return ServiceInstance Updated ServiceInstance + */ + public function update($options = array()) { + return $this->proxy()->update( + $options + ); + } + + /** + * Access the documents + * + * @return \Twilio\Rest\Preview\Sync\Service\DocumentList + */ + protected function getDocuments() { + return $this->proxy()->documents; + } + + /** + * Access the syncLists + * + * @return \Twilio\Rest\Preview\Sync\Service\SyncListList + */ + protected function getSyncLists() { + return $this->proxy()->syncLists; + } + + /** + * Access the syncMaps + * + * @return \Twilio\Rest\Preview\Sync\Service\SyncMapList + */ + protected function getSyncMaps() { + return $this->proxy()->syncMaps; + } + + /** + * 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.Sync.ServiceInstance ' . implode(' ', $context) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Sync/ServiceList.php b/Twilio/Rest/Preview/Sync/ServiceList.php new file mode 100644 index 0000000..6a40711 --- /dev/null +++ b/Twilio/Rest/Preview/Sync/ServiceList.php @@ -0,0 +1,152 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Sync; + +use Twilio\ListResource; +use Twilio\Options; +use Twilio\Values; +use Twilio\Version; + +class ServiceList extends ListResource { + /** + * Construct the ServiceList + * + * @param Version $version Version that contains the resource + * @return \Twilio\Rest\Preview\Sync\ServiceList + */ + public function __construct(Version $version) { + parent::__construct($version); + + // Path Solution + $this->solution = array(); + + $this->uri = '/Services'; + } + + /** + * Create a new ServiceInstance + * + * @param array|Options $options Optional Arguments + * @return ServiceInstance Newly created ServiceInstance + */ + public function create($options = array()) { + $options = new Values($options); + + $data = Values::of(array( + 'FriendlyName' => $options['friendlyName'], + 'WebhookUrl' => $options['webhookUrl'], + 'ReachabilityWebhooksEnabled' => $options['reachabilityWebhooksEnabled'], + )); + + $payload = $this->version->create( + 'POST', + $this->uri, + array(), + $data + ); + + return new ServiceInstance( + $this->version, + $payload + ); + } + + /** + * Streams ServiceInstance 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 ServiceInstance 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 ServiceInstance[] 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 ServiceInstance 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 ServiceInstance + */ + 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 ServicePage($this->version, $response, $this->solution); + } + + /** + * Constructs a ServiceContext + * + * @param string $sid The sid + * @return \Twilio\Rest\Preview\Sync\ServiceContext + */ + public function getContext($sid) { + return new ServiceContext( + $this->version, + $sid + ); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + return '[Twilio.Preview.Sync.ServiceList]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Sync/ServiceOptions.php b/Twilio/Rest/Preview/Sync/ServiceOptions.php new file mode 100644 index 0000000..d4c7eb7 --- /dev/null +++ b/Twilio/Rest/Preview/Sync/ServiceOptions.php @@ -0,0 +1,157 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Sync; + +use Twilio\Options; +use Twilio\Values; + +abstract class ServiceOptions { + /** + * @param string $friendlyName The friendly_name + * @param string $webhookUrl The webhook_url + * @param string $reachabilityWebhooksEnabled The reachability_webhooks_enabled + * @return CreateServiceOptions Options builder + */ + public static function create($friendlyName = Values::NONE, $webhookUrl = Values::NONE, $reachabilityWebhooksEnabled = Values::NONE) { + return new CreateServiceOptions($friendlyName, $webhookUrl, $reachabilityWebhooksEnabled); + } + + /** + * @param string $webhookUrl The webhook_url + * @param string $friendlyName The friendly_name + * @param string $reachabilityWebhooksEnabled The reachability_webhooks_enabled + * @return UpdateServiceOptions Options builder + */ + public static function update($webhookUrl = Values::NONE, $friendlyName = Values::NONE, $reachabilityWebhooksEnabled = Values::NONE) { + return new UpdateServiceOptions($webhookUrl, $friendlyName, $reachabilityWebhooksEnabled); + } +} + +class CreateServiceOptions extends Options { + /** + * @param string $friendlyName The friendly_name + * @param string $webhookUrl The webhook_url + * @param string $reachabilityWebhooksEnabled The reachability_webhooks_enabled + */ + public function __construct($friendlyName = Values::NONE, $webhookUrl = Values::NONE, $reachabilityWebhooksEnabled = Values::NONE) { + $this->options['friendlyName'] = $friendlyName; + $this->options['webhookUrl'] = $webhookUrl; + $this->options['reachabilityWebhooksEnabled'] = $reachabilityWebhooksEnabled; + } + + /** + * The friendly_name + * + * @param string $friendlyName The friendly_name + * @return $this Fluent Builder + */ + public function setFriendlyName($friendlyName) { + $this->options['friendlyName'] = $friendlyName; + return $this; + } + + /** + * The webhook_url + * + * @param string $webhookUrl The webhook_url + * @return $this Fluent Builder + */ + public function setWebhookUrl($webhookUrl) { + $this->options['webhookUrl'] = $webhookUrl; + return $this; + } + + /** + * The reachability_webhooks_enabled + * + * @param string $reachabilityWebhooksEnabled The reachability_webhooks_enabled + * @return $this Fluent Builder + */ + public function setReachabilityWebhooksEnabled($reachabilityWebhooksEnabled) { + $this->options['reachabilityWebhooksEnabled'] = $reachabilityWebhooksEnabled; + return $this; + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + $options = array(); + foreach ($this->options as $key => $value) { + if ($value != Values::NONE) { + $options[] = "$key=$value"; + } + } + return '[Twilio.Preview.Sync.CreateServiceOptions ' . implode(' ', $options) . ']'; + } +} + +class UpdateServiceOptions extends Options { + /** + * @param string $webhookUrl The webhook_url + * @param string $friendlyName The friendly_name + * @param string $reachabilityWebhooksEnabled The reachability_webhooks_enabled + */ + public function __construct($webhookUrl = Values::NONE, $friendlyName = Values::NONE, $reachabilityWebhooksEnabled = Values::NONE) { + $this->options['webhookUrl'] = $webhookUrl; + $this->options['friendlyName'] = $friendlyName; + $this->options['reachabilityWebhooksEnabled'] = $reachabilityWebhooksEnabled; + } + + /** + * The webhook_url + * + * @param string $webhookUrl The webhook_url + * @return $this Fluent Builder + */ + public function setWebhookUrl($webhookUrl) { + $this->options['webhookUrl'] = $webhookUrl; + return $this; + } + + /** + * The friendly_name + * + * @param string $friendlyName The friendly_name + * @return $this Fluent Builder + */ + public function setFriendlyName($friendlyName) { + $this->options['friendlyName'] = $friendlyName; + return $this; + } + + /** + * The reachability_webhooks_enabled + * + * @param string $reachabilityWebhooksEnabled The reachability_webhooks_enabled + * @return $this Fluent Builder + */ + public function setReachabilityWebhooksEnabled($reachabilityWebhooksEnabled) { + $this->options['reachabilityWebhooksEnabled'] = $reachabilityWebhooksEnabled; + return $this; + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + $options = array(); + foreach ($this->options as $key => $value) { + if ($value != Values::NONE) { + $options[] = "$key=$value"; + } + } + return '[Twilio.Preview.Sync.UpdateServiceOptions ' . implode(' ', $options) . ']'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Sync/ServicePage.php b/Twilio/Rest/Preview/Sync/ServicePage.php new file mode 100644 index 0000000..41adf9b --- /dev/null +++ b/Twilio/Rest/Preview/Sync/ServicePage.php @@ -0,0 +1,37 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Sync; + +use Twilio\Page; + +class ServicePage extends Page { + public function __construct($version, $response, $solution) { + parent::__construct($version, $response); + + // Path Solution + $this->solution = $solution; + } + + public function buildInstance(array $payload) { + return new ServiceInstance( + $this->version, + $payload + ); + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + return '[Twilio.Preview.Sync.ServicePage]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Wireless.php b/Twilio/Rest/Preview/Wireless.php new file mode 100644 index 0000000..9e85b64 --- /dev/null +++ b/Twilio/Rest/Preview/Wireless.php @@ -0,0 +1,114 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview; + +use Twilio\Domain; +use Twilio\Exceptions\TwilioException; +use Twilio\Rest\Preview\Wireless\CommandList; +use Twilio\Rest\Preview\Wireless\DeviceList; +use Twilio\Rest\Preview\Wireless\RatePlanList; +use Twilio\Version; + +/** + * @property \Twilio\Rest\Preview\Wireless\CommandList commands + * @property \Twilio\Rest\Preview\Wireless\DeviceList devices + * @property \Twilio\Rest\Preview\Wireless\RatePlanList ratePlans + * @method \Twilio\Rest\Preview\Wireless\CommandContext commands(string $sid) + * @method \Twilio\Rest\Preview\Wireless\DeviceContext devices(string $sid) + * @method \Twilio\Rest\Preview\Wireless\RatePlanContext ratePlans(string $sid) + */ +class Wireless extends Version { + protected $_commands = null; + protected $_devices = null; + protected $_ratePlans = null; + + /** + * Construct the Wireless version of Preview + * + * @param \Twilio\Domain $domain Domain that contains the version + * @return \Twilio\Rest\Preview\Wireless Wireless version of Preview + */ + public function __construct(Domain $domain) { + parent::__construct($domain); + $this->version = 'wireless'; + } + + /** + * @return \Twilio\Rest\Preview\Wireless\CommandList + */ + protected function getCommands() { + if (!$this->_commands) { + $this->_commands = new CommandList($this); + } + return $this->_commands; + } + + /** + * @return \Twilio\Rest\Preview\Wireless\DeviceList + */ + protected function getDevices() { + if (!$this->_devices) { + $this->_devices = new DeviceList($this); + } + return $this->_devices; + } + + /** + * @return \Twilio\Rest\Preview\Wireless\RatePlanList + */ + protected function getRatePlans() { + if (!$this->_ratePlans) { + $this->_ratePlans = new RatePlanList($this); + } + return $this->_ratePlans; + } + + /** + * Magic getter to lazy load root resources + * + * @param string $name Resource to return + * @return \Twilio\ListResource The requested resource + * @throws \Twilio\Exceptions\TwilioException For unknown resource + */ + public function __get($name) { + $method = 'get' . ucfirst($name); + if (method_exists($this, $method)) { + return $this->$method(); + } + + throw new TwilioException('Unknown resource ' . $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() { + return '[Twilio.Preview.Wireless]'; + } +}
\ No newline at end of file diff --git a/Twilio/Rest/Preview/Wireless/CommandContext.php b/Twilio/Rest/Preview/Wireless/CommandContext.php new file mode 100644 index 0000000..20984d0 --- /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/' . rawurlencode($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..1d19be3 --- /dev/null +++ b/Twilio/Rest/Preview/Wireless/CommandList.php @@ -0,0 +1,162 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Wireless; + +use Twilio\ListResource; +use Twilio\Options; +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 $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($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 $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($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 $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($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 $options Optional Arguments + * @return CommandInstance Newly created CommandInstance + */ + public function create($device, $command, $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/CommandOptions.php b/Twilio/Rest/Preview/Wireless/CommandOptions.php new file mode 100644 index 0000000..eb0eea6 --- /dev/null +++ b/Twilio/Rest/Preview/Wireless/CommandOptions.php @@ -0,0 +1,143 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Wireless; + +use Twilio\Options; +use Twilio\Values; + +abstract class CommandOptions { + /** + * @param string $device The device + * @param string $status The status + * @param string $direction The direction + * @return ReadCommandOptions Options builder + */ + public static function read($device = Values::NONE, $status = Values::NONE, $direction = Values::NONE) { + return new ReadCommandOptions($device, $status, $direction); + } + + /** + * @param string $callbackMethod The callback_method + * @param string $callbackUrl The callback_url + * @return CreateCommandOptions Options builder + */ + public static function create($callbackMethod = Values::NONE, $callbackUrl = Values::NONE) { + return new CreateCommandOptions($callbackMethod, $callbackUrl); + } +} + +class ReadCommandOptions extends Options { + /** + * @param string $device The device + * @param string $status The status + * @param string $direction The direction + */ + public function __construct($device = Values::NONE, $status = Values::NONE, $direction = Values::NONE) { + $this->options['device'] = $device; + $this->options['status'] = $status; + $this->options['direction'] = $direction; + } + + /** + * The device + * + * @param string $device The device + * @return $this Fluent Builder + */ + public function setDevice($device) { + $this->options['device'] = $device; + return $this; + } + + /** + * The status + * + * @param string $status The status + * @return $this Fluent Builder + */ + public function setStatus($status) { + $this->options['status'] = $status; + return $this; + } + + /** + * The direction + * + * @param string $direction The direction + * @return $this Fluent Builder + */ + public function setDirection($direction) { + $this->options['direction'] = $direction; + return $this; + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + $options = array(); + foreach ($this->options as $key => $value) { + if ($value != Values::NONE) { + $options[] = "$key=$value"; + } + } + return '[Twilio.Preview.Wireless.ReadCommandOptions ' . implode(' ', $options) . ']'; + } +} + +class CreateCommandOptions extends Options { + /** + * @param string $callbackMethod The callback_method + * @param string $callbackUrl The callback_url + */ + public function __construct($callbackMethod = Values::NONE, $callbackUrl = Values::NONE) { + $this->options['callbackMethod'] = $callbackMethod; + $this->options['callbackUrl'] = $callbackUrl; + } + + /** + * The callback_method + * + * @param string $callbackMethod The callback_method + * @return $this Fluent Builder + */ + public function setCallbackMethod($callbackMethod) { + $this->options['callbackMethod'] = $callbackMethod; + return $this; + } + + /** + * The callback_url + * + * @param string $callbackUrl The callback_url + * @return $this Fluent Builder + */ + public function setCallbackUrl($callbackUrl) { + $this->options['callbackUrl'] = $callbackUrl; + return $this; + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + $options = array(); + foreach ($this->options as $key => $value) { + if ($value != Values::NONE) { + $options[] = "$key=$value"; + } + } + return '[Twilio.Preview.Wireless.CreateCommandOptions ' . implode(' ', $options) . ']'; + } +}
\ 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..38a8b22 --- /dev/null +++ b/Twilio/Rest/Preview/Wireless/Device/UsageContext.php @@ -0,0 +1,75 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Wireless\Device; + +use Twilio\InstanceContext; +use Twilio\Options; +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/' . rawurlencode($deviceSid) . '/Usage'; + } + + /** + * Fetch a UsageInstance + * + * @param array|Options $options Optional Arguments + * @return UsageInstance Fetched UsageInstance + */ + public function fetch($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..9fdbea3 --- /dev/null +++ b/Twilio/Rest/Preview/Wireless/Device/UsageInstance.php @@ -0,0 +1,120 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Wireless\Device; + +use Twilio\Exceptions\TwilioException; +use Twilio\InstanceResource; +use Twilio\Options; +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 $options Optional Arguments + * @return UsageInstance Fetched UsageInstance + */ + public function fetch($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/UsageOptions.php b/Twilio/Rest/Preview/Wireless/Device/UsageOptions.php new file mode 100644 index 0000000..34e6f68 --- /dev/null +++ b/Twilio/Rest/Preview/Wireless/Device/UsageOptions.php @@ -0,0 +1,72 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Wireless\Device; + +use Twilio\Options; +use Twilio\Values; + +abstract class UsageOptions { + /** + * @param string $end The end + * @param string $start The start + * @return FetchUsageOptions Options builder + */ + public static function fetch($end = Values::NONE, $start = Values::NONE) { + return new FetchUsageOptions($end, $start); + } +} + +class FetchUsageOptions extends Options { + /** + * @param string $end The end + * @param string $start The start + */ + public function __construct($end = Values::NONE, $start = Values::NONE) { + $this->options['end'] = $end; + $this->options['start'] = $start; + } + + /** + * The end + * + * @param string $end The end + * @return $this Fluent Builder + */ + public function setEnd($end) { + $this->options['end'] = $end; + return $this; + } + + /** + * The start + * + * @param string $start The start + * @return $this Fluent Builder + */ + public function setStart($start) { + $this->options['start'] = $start; + return $this; + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + $options = array(); + foreach ($this->options as $key => $value) { + if ($value != Values::NONE) { + $options[] = "$key=$value"; + } + } + return '[Twilio.Preview.Wireless.FetchUsageOptions ' . implode(' ', $options) . ']'; + } +}
\ 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..2552293 --- /dev/null +++ b/Twilio/Rest/Preview/Wireless/DeviceContext.php @@ -0,0 +1,161 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Wireless; + +use Twilio\Exceptions\TwilioException; +use Twilio\InstanceContext; +use Twilio\Options; +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/' . rawurlencode($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 $options Optional Arguments + * @return DeviceInstance Updated DeviceInstance + */ + public function update($options = array()) { + $options = new Values($options); + + $data = Values::of(array( + 'Alias' => $options['alias'], + 'CallbackMethod' => $options['callbackMethod'], + 'CallbackUrl' => $options['callbackUrl'], + 'FriendlyName' => $options['friendlyName'], + 'RatePlan' => $options['ratePlan'], + '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..d32aa87 --- /dev/null +++ b/Twilio/Rest/Preview/Wireless/DeviceInstance.php @@ -0,0 +1,149 @@ +<?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\Options; +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 $options Optional Arguments + * @return DeviceInstance Updated DeviceInstance + */ + public function update($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..6cd4bbd --- /dev/null +++ b/Twilio/Rest/Preview/Wireless/DeviceList.php @@ -0,0 +1,166 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Wireless; + +use Twilio\ListResource; +use Twilio\Options; +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 $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($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 $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($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 $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($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 $options Optional Arguments + * @return DeviceInstance Newly created DeviceInstance + */ + public function create($ratePlan, $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/DeviceOptions.php b/Twilio/Rest/Preview/Wireless/DeviceOptions.php new file mode 100644 index 0000000..7030eae --- /dev/null +++ b/Twilio/Rest/Preview/Wireless/DeviceOptions.php @@ -0,0 +1,382 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Rest\Preview\Wireless; + +use Twilio\Options; +use Twilio\Values; + +abstract class DeviceOptions { + /** + * @param string $status The status + * @param string $simIdentifier The sim_identifier + * @param string $ratePlan The rate_plan + * @return ReadDeviceOptions Options builder + */ + public static function read($status = Values::NONE, $simIdentifier = Values::NONE, $ratePlan = Values::NONE) { + return new ReadDeviceOptions($status, $simIdentifier, $ratePlan); + } + + /** + * @param string $alias The alias + * @param string $callbackMethod The callback_method + * @param string $callbackUrl The callback_url + * @param string $friendlyName The friendly_name + * @param string $simIdentifier The sim_identifier + * @param string $status The status + * @param string $commandsCallbackMethod The commands_callback_method + * @param string $commandsCallbackUrl The commands_callback_url + * @return CreateDeviceOptions Options builder + */ + public static function create($alias = Values::NONE, $callbackMethod = Values::NONE, $callbackUrl = Values::NONE, $friendlyName = Values::NONE, $simIdentifier = Values::NONE, $status = Values::NONE, $commandsCallbackMethod = Values::NONE, $commandsCallbackUrl = Values::NONE) { + return new CreateDeviceOptions($alias, $callbackMethod, $callbackUrl, $friendlyName, $simIdentifier, $status, $commandsCallbackMethod, $commandsCallbackUrl); + } + + /** + * @param string $alias The alias + * @param string $callbackMethod The callback_method + * @param string $callbackUrl The callback_url + * @param string $friendlyName The friendly_name + * @param string $ratePlan The rate_plan + * @param string $simIdentifier The sim_identifier + * @param string $status The status + * @param string $commandsCallbackMethod The commands_callback_method + * @param string $commandsCallbackUrl The commands_callback_url + * @return UpdateDeviceOptions Options builder + */ + public static function update($alias = Values::NONE, $callbackMethod = Values::NONE, $callbackUrl = Values::NONE, $friendlyName = Values::NONE, $ratePlan = Values::NONE, $simIdentifier = Values::NONE, $status = Values::NONE, $commandsCallbackMethod = Values::NONE, $commandsCallbackUrl = Values::NONE) { + return new UpdateDeviceOptions($alias, $callbackMethod, $callbackUrl, $friendlyName, $ratePlan, $simIdentifier, $status, $commandsCallbackMethod, $commandsCallbackUrl); + } +} + +class ReadDeviceOptions extends Options { + /** + * @param string $status The status + * @param string $simIdentifier The sim_identifier + * @param string $ratePlan The rate_plan + */ + public function __construct($status = Values::NONE, $simIdentifier = Values::NONE, $ratePlan = Values::NONE) { + $this->options['status'] = $status; + $this->options['simIdentifier'] = $simIdentifier; + $this->options['ratePlan'] = $ratePlan; + } + + /** + * The status + * + * @param string $status The status + * @return $this Fluent Builder + */ + public function setStatus($status) { + $this->options['status'] = $status; + return $this; + } + + /** + * The sim_identifier + * + * @param string $simIdentifier The sim_identifier + * @return $this Fluent Builder + */ + public function setSimIdentifier($simIdentifier) { + $this->options['simIdentifier'] = $simIdentifier; + return $this; + } + + /** + * The rate_plan + * + * @param string $ratePlan The rate_plan + * @return $this Fluent Builder + */ + public function setRatePlan($ratePlan) { + $this->options['ratePlan'] = $ratePlan; + return $this; + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + $options = array(); + foreach ($this->options as $key => $value) { + if ($value != Values::NONE) { + $options[] = "$key=$value"; + } + } + return '[Twilio.Preview.Wireless.ReadDeviceOptions ' . implode(' ', $options) . ']'; + } +} + +class CreateDeviceOptions extends Options { + /** + * @param string $alias The alias + * @param string $callbackMethod The callback_method + * @param string $callbackUrl The callback_url + * @param string $friendlyName The friendly_name + * @param string $simIdentifier The sim_identifier + * @param string $status The status + * @param string $commandsCallbackMethod The commands_callback_method + * @param string $commandsCallbackUrl The commands_callback_url + */ + public function __construct($alias = Values::NONE, $callbackMethod = Values::NONE, $callbackUrl = Values::NONE, $friendlyName = Values::NONE, $simIdentifier = Values::NONE, $status = Values::NONE, $commandsCallbackMethod = Values::NONE, $commandsCallbackUrl = Values::NONE) { + $this->options['alias'] = $alias; + $this->options['callbackMethod'] = $callbackMethod; + $this->options['callbackUrl'] = $callbackUrl; + $this->options['friendlyName'] = $friendlyName; + $this->options['simIdentifier'] = $simIdentifier; + $this->options['status'] = $status; + $this->options['commandsCallbackMethod'] = $commandsCallbackMethod; + $this->options['commandsCallbackUrl'] = $commandsCallbackUrl; + } + + /** + * The alias + * + * @param string $alias The alias + * @return $this Fluent Builder + */ + public function setAlias($alias) { + $this->options['alias'] = $alias; + return $this; + } + + /** + * The callback_method + * + * @param string $callbackMethod The callback_method + * @return $this Fluent Builder + */ + public function setCallbackMethod($callbackMethod) { + $this->options['callbackMethod'] = $callbackMethod; + return $this; + } + + /** + * The callback_url + * + * @param string $callbackUrl The callback_url + * @return $this Fluent Builder + */ + public function setCallbackUrl($callbackUrl) { + $this->options['callbackUrl'] = $callbackUrl; + return $this; + } + + /** + * The friendly_name + * + * @param string $friendlyName The friendly_name + * @return $this Fluent Builder + */ + public function setFriendlyName($friendlyName) { + $this->options['friendlyName'] = $friendlyName; + return $this; + } + + /** + * The sim_identifier + * + * @param string $simIdentifier The sim_identifier + * @return $this Fluent Builder + */ + public function setSimIdentifier($simIdentifier) { + $this->options['simIdentifier'] = $simIdentifier; + return $this; + } + + /** + * The status + * + * @param string $status The status + * @return $this Fluent Builder + */ + public function setStatus($status) { + $this->options['status'] = $status; + return $this; + } + + /** + * The commands_callback_method + * + * @param string $commandsCallbackMethod The commands_callback_method + * @return $this Fluent Builder + */ + public function setCommandsCallbackMethod($commandsCallbackMethod) { + $this->options['commandsCallbackMethod'] = $commandsCallbackMethod; + return $this; + } + + /** + * The commands_callback_url + * + * @param string $commandsCallbackUrl The commands_callback_url + * @return $this Fluent Builder + */ + public function setCommandsCallbackUrl($commandsCallbackUrl) { + $this->options['commandsCallbackUrl'] = $commandsCallbackUrl; + return $this; + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + $options = array(); + foreach ($this->options as $key => $value) { + if ($value != Values::NONE) { + $options[] = "$key=$value"; + } + } + return '[Twilio.Preview.Wireless.CreateDeviceOptions ' . implode(' ', $options) . ']'; + } +} + +class UpdateDeviceOptions extends Options { + /** + * @param string $alias The alias + * @param string $callbackMethod The callback_method + * @param string $callbackUrl The callback_url + * @param string $friendlyName The friendly_name + * @param string $ratePlan The rate_plan + * @param string $simIdentifier The sim_identifier + * @param string $status The status + * @param string $commandsCallbackMethod The commands_callback_method + * @param string $commandsCallbackUrl The commands_callback_url + */ + public function __construct($alias = Values::NONE, $callbackMethod = Values::NONE, $callbackUrl = Values::NONE, $friendlyName = Values::NONE, $ratePlan = Values::NONE, $simIdentifier = Values::NONE, $status = Values::NONE, $commandsCallbackMethod = Values::NONE, $commandsCallbackUrl = Values::NONE) { + $this->options['alias'] = $alias; + $this->options['callbackMethod'] = $callbackMethod; + $this->options['callbackUrl'] = $callbackUrl; + $this->options['friendlyName'] = $friendlyName; + $this->options['ratePlan'] = $ratePlan; + $this->options['simIdentifier'] = $simIdentifier; + $this->options['status'] = $status; + $this->options['commandsCallbackMethod'] = $commandsCallbackMethod; + $this->options['commandsCallbackUrl'] = $commandsCallbackUrl; + } + + /** + * The alias + * + * @param string $alias The alias + * @return $this Fluent Builder + */ + public function setAlias($alias) { + $this->options['alias'] = $alias; + return $this; + } + + /** + * The callback_method + * + * @param string $callbackMethod The callback_method + * @return $this Fluent Builder + */ + public function setCallbackMethod($callbackMethod) { + $this->options['callbackMethod'] = $callbackMethod; + return $this; + } + + /** + * The callback_url + * + * @param string $callbackUrl The callback_url + * @return $this Fluent Builder + */ + public function setCallbackUrl($callbackUrl) { + $this->options['callbackUrl'] = $callbackUrl; + return $this; + } + + /** + * The friendly_name + * + * @param string $friendlyName The friendly_name + * @return $this Fluent Builder + */ + public function setFriendlyName($friendlyName) { + $this->options['friendlyName'] = $friendlyName; + return $this; + } + + /** + * The rate_plan + * + * @param string $ratePlan The rate_plan + * @return $this Fluent Builder + */ + public function setRatePlan($ratePlan) { + $this->options['ratePlan'] = $ratePlan; + return $this; + } + + /** + * The sim_identifier + * + * @param string $simIdentifier The sim_identifier + * @return $this Fluent Builder + */ + public function setSimIdentifier($simIdentifier) { + $this->options['simIdentifier'] = $simIdentifier; + return $this; + } + + /** + * The status + * + * @param string $status The status + * @return $this Fluent Builder + */ + public function setStatus($status) { + $this->options['status'] = $status; + return $this; + } + + /** + * The commands_callback_method + * + * @param string $commandsCallbackMethod The commands_callback_method + * @return $this Fluent Builder + */ + public function setCommandsCallbackMethod($commandsCallbackMethod) { + $this->options['commandsCallbackMethod'] = $commandsCallbackMethod; + return $this; + } + + /** + * The commands_callback_url + * + * @param string $commandsCallbackUrl The commands_callback_url + * @return $this Fluent Builder + */ + public function setCommandsCallbackUrl($commandsCallbackUrl) { + $this->options['commandsCallbackUrl'] = $commandsCallbackUrl; + return $this; + } + + /** + * Provide a friendly representation + * + * @return string Machine friendly representation + */ + public function __toString() { + $options = array(); + foreach ($this->options as $key => $value) { + if ($value != Values::NONE) { + $options[] = "$key=$value"; + } + } + return '[Twilio.Preview.Wireless.UpdateDeviceOptions ' . implode(' ', $options) . ']'; + } +}
\ 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..382a6a2 --- /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/' . rawurlencode($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 diff --git a/Twilio/Tests/Integration/Notify/V1/CredentialTest.php b/Twilio/Tests/Integration/Notify/V1/CredentialTest.php new file mode 100644 index 0000000..16922a3 --- /dev/null +++ b/Twilio/Tests/Integration/Notify/V1/CredentialTest.php @@ -0,0 +1,230 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Tests\Integration\Notify\V1; + +use Twilio\Exceptions\DeserializeException; +use Twilio\Exceptions\TwilioException; +use Twilio\Http\Response; +use Twilio\Tests\HolodeckTestCase; +use Twilio\Tests\Request; + +class CredentialTest extends HolodeckTestCase { + public function testReadRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->notify->v1->credentials->read(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'get', + 'https://notify.twilio.com/v1/Credentials' + )); + } + + public function testReadFullResponse() { + $this->holodeck->mock(new Response( + 200, + ' + { + "credentials": [ + { + "sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "friendly_name": "Test slow create", + "type": "apn", + "sandbox": "False", + "date_created": "2015-10-07T17:50:01Z", + "date_updated": "2015-10-07T17:50:01Z", + "url": "https://notify.twilio.com/v1/Credentials/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + } + ], + "meta": { + "page": 0, + "page_size": 1, + "first_page_url": "https://notify.twilio.com/v1/Credentials?PageSize=1&Page=0", + "previous_page_url": null, + "url": "https://notify.twilio.com/v1/Credentials?PageSize=1&Page=0", + "next_page_url": null, + "key": "credentials" + } + } + ' + )); + + $actual = $this->twilio->notify->v1->credentials->read(); + + $this->assertGreaterThan(0, count($actual)); + } + + public function testReadEmptyResponse() { + $this->holodeck->mock(new Response( + 200, + ' + { + "credentials": [], + "meta": { + "page": 0, + "page_size": 1, + "first_page_url": "https://notify.twilio.com/v1/Credentials?PageSize=1&Page=0", + "previous_page_url": null, + "url": "https://notify.twilio.com/v1/Credentials?PageSize=1&Page=0", + "next_page_url": null, + "key": "credentials" + } + } + ' + )); + + $actual = $this->twilio->notify->v1->credentials->read(); + + $this->assertNotNull($actual); + } + + public function testCreateRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->notify->v1->credentials->create("gcm"); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $values = array( + 'Type' => "gcm", + ); + + $this->assertRequest(new Request( + 'post', + 'https://notify.twilio.com/v1/Credentials', + null, + $values + )); + } + + public function testCreateResponse() { + $this->holodeck->mock(new Response( + 201, + ' + { + "sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "friendly_name": "Test slow create", + "type": "apn", + "sandbox": "False", + "date_created": "2015-10-07T17:50:01Z", + "date_updated": "2015-10-07T17:50:01Z", + "url": "https://notify.twilio.com/v1/Credentials/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + } + ' + )); + + $actual = $this->twilio->notify->v1->credentials->create("gcm"); + + $this->assertNotNull($actual); + } + + public function testFetchRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->notify->v1->credentials("CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->fetch(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'get', + 'https://notify.twilio.com/v1/Credentials/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + )); + } + + public function testFetchResponse() { + $this->holodeck->mock(new Response( + 200, + ' + { + "sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "friendly_name": "Test slow create", + "type": "apn", + "sandbox": "False", + "date_created": "2015-10-07T17:50:01Z", + "date_updated": "2015-10-07T17:50:01Z", + "url": "https://notify.twilio.com/v1/Credentials/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + } + ' + )); + + $actual = $this->twilio->notify->v1->credentials("CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->fetch(); + + $this->assertNotNull($actual); + } + + public function testUpdateRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->notify->v1->credentials("CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->update(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'post', + 'https://notify.twilio.com/v1/Credentials/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + )); + } + + public function testUpdateResponse() { + $this->holodeck->mock(new Response( + 200, + ' + { + "sid": "CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "friendly_name": "Test slow create", + "type": "apn", + "sandbox": "False", + "date_created": "2015-10-07T17:50:01Z", + "date_updated": "2015-10-07T17:50:01Z", + "url": "https://notify.twilio.com/v1/Credentials/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + } + ' + )); + + $actual = $this->twilio->notify->v1->credentials("CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->update(); + + $this->assertNotNull($actual); + } + + public function testDeleteRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->notify->v1->credentials("CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->delete(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'delete', + 'https://notify.twilio.com/v1/Credentials/CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + )); + } + + public function testDeleteResponse() { + $this->holodeck->mock(new Response( + 204, + null + )); + + $actual = $this->twilio->notify->v1->credentials("CRaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->delete(); + + $this->assertTrue($actual); + } +}
\ No newline at end of file diff --git a/Twilio/Tests/Integration/Notify/V1/Service/BindingTest.php b/Twilio/Tests/Integration/Notify/V1/Service/BindingTest.php new file mode 100644 index 0000000..9749c10 --- /dev/null +++ b/Twilio/Tests/Integration/Notify/V1/Service/BindingTest.php @@ -0,0 +1,218 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Tests\Integration\Notify\V1\Service; + +use Twilio\Exceptions\DeserializeException; +use Twilio\Exceptions\TwilioException; +use Twilio\Http\Response; +use Twilio\Tests\HolodeckTestCase; +use Twilio\Tests\Request; + +class BindingTest extends HolodeckTestCase { + public function testFetchRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->notify->v1->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->bindings("BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->fetch(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'get', + 'https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings/BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + )); + } + + public function testFetchResponse() { + $this->holodeck->mock(new Response( + 200, + ' + { + "sid": "BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "date_created": "2016-03-24T23:24:45Z", + "date_updated": "2016-03-24T23:24:45Z", + "notification_protocol_version": "3", + "endpoint": "abcd", + "identity": "jing", + "binding_type": "apn", + "address": "1234", + "tags": [], + "url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings/BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + } + ' + )); + + $actual = $this->twilio->notify->v1->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->bindings("BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->fetch(); + + $this->assertNotNull($actual); + } + + public function testDeleteRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->notify->v1->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->bindings("BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->delete(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'delete', + 'https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings/BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + )); + } + + public function testDeleteResponse() { + $this->holodeck->mock(new Response( + 204, + null + )); + + $actual = $this->twilio->notify->v1->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->bindings("BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->delete(); + + $this->assertTrue($actual); + } + + public function testCreateRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->notify->v1->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->bindings->create("endpoint", "identity", "apn", "address"); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $values = array( + 'Endpoint' => "endpoint", + 'Identity' => "identity", + 'BindingType' => "apn", + 'Address' => "address", + ); + + $this->assertRequest(new Request( + 'post', + 'https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings', + null, + $values + )); + } + + public function testCreateResponse() { + $this->holodeck->mock(new Response( + 201, + ' + { + "sid": "BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "date_created": "2016-03-24T23:24:45Z", + "date_updated": "2016-03-24T23:24:45Z", + "notification_protocol_version": "3", + "endpoint": "abcd", + "identity": "jing", + "binding_type": "apn", + "address": "1234", + "tags": [], + "url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings/BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + } + ' + )); + + $actual = $this->twilio->notify->v1->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->bindings->create("endpoint", "identity", "apn", "address"); + + $this->assertNotNull($actual); + } + + public function testReadRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->notify->v1->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->bindings->read(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'get', + 'https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings' + )); + } + + public function testReadFullResponse() { + $this->holodeck->mock(new Response( + 200, + ' + { + "meta": { + "page": 0, + "page_size": 1, + "first_page_url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings?PageSize=1&Page=0", + "previous_page_url": null, + "url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings?PageSize=1&Page=0", + "next_page_url": null, + "key": "bindings" + }, + "bindings": [ + { + "sid": "BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "date_created": "2016-03-24T23:24:45Z", + "date_updated": "2016-03-24T23:24:45Z", + "notification_protocol_version": "3", + "endpoint": "abcd", + "identity": "jing", + "binding_type": "apn", + "address": "1234", + "tags": [], + "url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings/BSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + } + ] + } + ' + )); + + $actual = $this->twilio->notify->v1->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->bindings->read(); + + $this->assertGreaterThan(0, count($actual)); + } + + public function testReadEmptyResponse() { + $this->holodeck->mock(new Response( + 200, + ' + { + "meta": { + "page": 0, + "page_size": 1, + "first_page_url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings?PageSize=1&Page=0", + "previous_page_url": null, + "url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings?PageSize=1&Page=0", + "next_page_url": null, + "key": "bindings" + }, + "bindings": [] + } + ' + )); + + $actual = $this->twilio->notify->v1->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->bindings->read(); + + $this->assertNotNull($actual); + } +}
\ No newline at end of file diff --git a/Twilio/Tests/Integration/Notify/V1/Service/NotificationTest.php b/Twilio/Tests/Integration/Notify/V1/Service/NotificationTest.php new file mode 100644 index 0000000..51362c1 --- /dev/null +++ b/Twilio/Tests/Integration/Notify/V1/Service/NotificationTest.php @@ -0,0 +1,67 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Tests\Integration\Notify\V1\Service; + +use Twilio\Exceptions\DeserializeException; +use Twilio\Exceptions\TwilioException; +use Twilio\Http\Response; +use Twilio\Tests\HolodeckTestCase; +use Twilio\Tests\Request; + +class NotificationTest extends HolodeckTestCase { + public function testCreateRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->notify->v1->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->notifications->create(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'post', + 'https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications' + )); + } + + public function testCreateResponse() { + $this->holodeck->mock(new Response( + 201, + ' + { + "sid": "NOb8021351170b4e1286adaac3fdd6d082", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "service_sid": "IS699b53e02da45a1ba9d13b7d7d2766af", + "date_created": "2016-03-24T23:42:28Z", + "identities": [ + "jing" + ], + "tags": [], + "priority": "high", + "ttl": 2419200, + "title": "test", + "body": "body", + "sound": null, + "action": null, + "data": null, + "apn": null, + "gcm": null, + "sms": null, + "facebook_messenger": null + } + ' + )); + + $actual = $this->twilio->notify->v1->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->notifications->create(); + + $this->assertNotNull($actual); + } +}
\ No newline at end of file diff --git a/Twilio/Tests/Integration/Notify/V1/ServiceTest.php b/Twilio/Tests/Integration/Notify/V1/ServiceTest.php new file mode 100644 index 0000000..8a35615 --- /dev/null +++ b/Twilio/Tests/Integration/Notify/V1/ServiceTest.php @@ -0,0 +1,256 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Tests\Integration\Notify\V1; + +use Twilio\Exceptions\DeserializeException; +use Twilio\Exceptions\TwilioException; +use Twilio\Http\Response; +use Twilio\Tests\HolodeckTestCase; +use Twilio\Tests\Request; + +class ServiceTest extends HolodeckTestCase { + public function testCreateRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->notify->v1->services->create(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'post', + 'https://notify.twilio.com/v1/Services' + )); + } + + public function testCreateResponse() { + $this->holodeck->mock(new Response( + 201, + ' + { + "sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "friendly_name": "733c7f0f-6541-42ec-84ce-e2ae1cac588c", + "date_created": "2016-03-09T20:22:31Z", + "date_updated": "2016-03-09T20:22:31Z", + "apn_credential_sid": null, + "gcm_credential_sid": null, + "messaging_service_sid": null, + "facebook_messenger_page_id": "4", + "default_apn_notification_protocol_version": "3", + "default_gcm_notification_protocol_version": "3", + "url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "links": { + "bindings": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings", + "notifications": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications" + } + } + ' + )); + + $actual = $this->twilio->notify->v1->services->create(); + + $this->assertNotNull($actual); + } + + public function testDeleteRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->notify->v1->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->delete(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'delete', + 'https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + )); + } + + public function testDeleteResponse() { + $this->holodeck->mock(new Response( + 204, + null + )); + + $actual = $this->twilio->notify->v1->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->delete(); + + $this->assertTrue($actual); + } + + public function testFetchRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->notify->v1->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->fetch(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'get', + 'https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + )); + } + + public function testFetchResponse() { + $this->holodeck->mock(new Response( + 200, + ' + { + "sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "friendly_name": "733c7f0f-6541-42ec-84ce-e2ae1cac588c", + "date_created": "2016-03-09T20:22:31Z", + "date_updated": "2016-03-09T20:22:31Z", + "apn_credential_sid": null, + "gcm_credential_sid": null, + "messaging_service_sid": null, + "facebook_messenger_page_id": "4", + "default_apn_notification_protocol_version": "3", + "default_gcm_notification_protocol_version": "3", + "url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "links": { + "bindings": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings", + "notifications": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications" + } + } + ' + )); + + $actual = $this->twilio->notify->v1->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->fetch(); + + $this->assertNotNull($actual); + } + + public function testReadRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->notify->v1->services->read(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'get', + 'https://notify.twilio.com/v1/Services' + )); + } + + public function testReadFullResponse() { + $this->holodeck->mock(new Response( + 200, + ' + { + "meta": { + "page": 0, + "page_size": 1, + "first_page_url": "https://notify.twilio.com/v1/Services?PageSize=1&Page=0", + "previous_page_url": null, + "url": "https://notify.twilio.com/v1/Services?PageSize=1&Page=0", + "next_page_url": null, + "key": "services" + }, + "services": [ + { + "sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "friendly_name": "733c7f0f-6541-42ec-84ce-e2ae1cac588c", + "date_created": "2016-03-09T20:22:31Z", + "date_updated": "2016-03-09T20:22:31Z", + "apn_credential_sid": null, + "gcm_credential_sid": null, + "messaging_service_sid": null, + "facebook_messenger_page_id": "4", + "default_apn_notification_protocol_version": "3", + "default_gcm_notification_protocol_version": "3", + "url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "links": { + "bindings": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings", + "notifications": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications" + } + } + ] + } + ' + )); + + $actual = $this->twilio->notify->v1->services->read(); + + $this->assertGreaterThan(0, count($actual)); + } + + public function testReadEmptyResponse() { + $this->holodeck->mock(new Response( + 200, + ' + { + "meta": { + "page": 0, + "page_size": 50, + "first_page_url": "https://notify.twilio.com/v1/Services?PageSize=50&Page=0", + "previous_page_url": null, + "url": "https://notify.twilio.com/v1/Services?PageSize=50&Page=0", + "next_page_url": null, + "key": "services" + }, + "services": [] + } + ' + )); + + $actual = $this->twilio->notify->v1->services->read(); + + $this->assertNotNull($actual); + } + + public function testUpdateRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->notify->v1->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->update(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'post', + 'https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + )); + } + + public function testUpdateResponse() { + $this->holodeck->mock(new Response( + 200, + ' + { + "sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "friendly_name": "733c7f0f-6541-42ec-84ce-e2ae1cac588c", + "date_created": "2016-03-09T20:22:31Z", + "date_updated": "2016-03-09T20:22:31Z", + "apn_credential_sid": null, + "gcm_credential_sid": null, + "default_apn_notification_protocol_version": "3", + "default_gcm_notification_protocol_version": "3", + "messaging_service_sid": null, + "facebook_messenger_page_id": "4", + "url": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "links": { + "bindings": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings", + "notifications": "https://notify.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications" + } + } + ' + )); + + $actual = $this->twilio->notify->v1->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->update(); + + $this->assertNotNull($actual); + } +}
\ No newline at end of file diff --git a/Twilio/Tests/Integration/Preview/Sync/Service/DocumentTest.php b/Twilio/Tests/Integration/Preview/Sync/Service/DocumentTest.php new file mode 100644 index 0000000..476b66d --- /dev/null +++ b/Twilio/Tests/Integration/Preview/Sync/Service/DocumentTest.php @@ -0,0 +1,99 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Tests\Integration\Preview\Sync\Service; + +use Twilio\Exceptions\DeserializeException; +use Twilio\Exceptions\TwilioException; +use Twilio\Http\Response; +use Twilio\Tests\HolodeckTestCase; +use Twilio\Tests\Request; + +class DocumentTest extends HolodeckTestCase { + public function testFetchRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->sync->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->documents("sid")->fetch(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'get', + 'https://preview.twilio.com/Sync/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Documents/sid' + )); + } + + public function testDeleteRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->sync->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->documents("sid")->delete(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'delete', + 'https://preview.twilio.com/Sync/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Documents/sid' + )); + } + + public function testCreateRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->sync->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->documents->create(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'post', + 'https://preview.twilio.com/Sync/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Documents' + )); + } + + public function testReadRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->sync->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->documents->read(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'get', + 'https://preview.twilio.com/Sync/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Documents' + )); + } + + public function testUpdateRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->sync->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->documents("sid")->update("{}"); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $values = array( + 'Data' => "{}", + ); + + $this->assertRequest(new Request( + 'post', + 'https://preview.twilio.com/Sync/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Documents/sid', + null, + $values + )); + } +}
\ No newline at end of file diff --git a/Twilio/Tests/Integration/Preview/Sync/Service/SyncList/SyncListItemTest.php b/Twilio/Tests/Integration/Preview/Sync/Service/SyncList/SyncListItemTest.php new file mode 100644 index 0000000..437bb0f --- /dev/null +++ b/Twilio/Tests/Integration/Preview/Sync/Service/SyncList/SyncListItemTest.php @@ -0,0 +1,110 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Tests\Integration\Preview\Sync\Service\SyncList; + +use Twilio\Exceptions\DeserializeException; +use Twilio\Exceptions\TwilioException; +use Twilio\Http\Response; +use Twilio\Tests\HolodeckTestCase; +use Twilio\Tests\Request; + +class SyncListItemTest extends HolodeckTestCase { + public function testFetchRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->sync->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->syncLists("ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->syncListItems(1)->fetch(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'get', + 'https://preview.twilio.com/Sync/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Lists/ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Items/1' + )); + } + + public function testDeleteRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->sync->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->syncLists("ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->syncListItems(1)->delete(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'delete', + 'https://preview.twilio.com/Sync/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Lists/ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Items/1' + )); + } + + public function testCreateRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->sync->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->syncLists("ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->syncListItems->create("{}"); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $values = array( + 'Data' => "{}", + ); + + $this->assertRequest(new Request( + 'post', + 'https://preview.twilio.com/Sync/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Lists/ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Items', + null, + $values + )); + } + + public function testReadRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->sync->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->syncLists("ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->syncListItems->read(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'get', + 'https://preview.twilio.com/Sync/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Lists/ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Items' + )); + } + + public function testUpdateRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->sync->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->syncLists("ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->syncListItems(1)->update("{}"); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $values = array( + 'Data' => "{}", + ); + + $this->assertRequest(new Request( + 'post', + 'https://preview.twilio.com/Sync/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Lists/ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Items/1', + null, + $values + )); + } +}
\ No newline at end of file diff --git a/Twilio/Tests/Integration/Preview/Sync/Service/SyncListTest.php b/Twilio/Tests/Integration/Preview/Sync/Service/SyncListTest.php new file mode 100644 index 0000000..16a99a7 --- /dev/null +++ b/Twilio/Tests/Integration/Preview/Sync/Service/SyncListTest.php @@ -0,0 +1,78 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Tests\Integration\Preview\Sync\Service; + +use Twilio\Exceptions\DeserializeException; +use Twilio\Exceptions\TwilioException; +use Twilio\Http\Response; +use Twilio\Tests\HolodeckTestCase; +use Twilio\Tests\Request; + +class SyncListTest extends HolodeckTestCase { + public function testFetchRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->sync->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->syncLists("ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->fetch(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'get', + 'https://preview.twilio.com/Sync/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Lists/ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + )); + } + + public function testDeleteRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->sync->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->syncLists("ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->delete(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'delete', + 'https://preview.twilio.com/Sync/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Lists/ESaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + )); + } + + public function testCreateRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->sync->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->syncLists->create(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'post', + 'https://preview.twilio.com/Sync/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Lists' + )); + } + + public function testReadRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->sync->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->syncLists->read(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'get', + 'https://preview.twilio.com/Sync/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Lists' + )); + } +}
\ No newline at end of file diff --git a/Twilio/Tests/Integration/Preview/Sync/Service/SyncMap/SyncMapItemTest.php b/Twilio/Tests/Integration/Preview/Sync/Service/SyncMap/SyncMapItemTest.php new file mode 100644 index 0000000..e991f4f --- /dev/null +++ b/Twilio/Tests/Integration/Preview/Sync/Service/SyncMap/SyncMapItemTest.php @@ -0,0 +1,111 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Tests\Integration\Preview\Sync\Service\SyncMap; + +use Twilio\Exceptions\DeserializeException; +use Twilio\Exceptions\TwilioException; +use Twilio\Http\Response; +use Twilio\Tests\HolodeckTestCase; +use Twilio\Tests\Request; + +class SyncMapItemTest extends HolodeckTestCase { + public function testFetchRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->sync->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->syncMaps("MPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->syncMapItems("key")->fetch(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'get', + 'https://preview.twilio.com/Sync/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Maps/MPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Items/key' + )); + } + + public function testDeleteRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->sync->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->syncMaps("MPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->syncMapItems("key")->delete(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'delete', + 'https://preview.twilio.com/Sync/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Maps/MPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Items/key' + )); + } + + public function testCreateRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->sync->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->syncMaps("MPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->syncMapItems->create("key", "{}"); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $values = array( + 'Key' => "key", + 'Data' => "{}", + ); + + $this->assertRequest(new Request( + 'post', + 'https://preview.twilio.com/Sync/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Maps/MPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Items', + null, + $values + )); + } + + public function testReadRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->sync->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->syncMaps("MPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->syncMapItems->read(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'get', + 'https://preview.twilio.com/Sync/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Maps/MPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Items' + )); + } + + public function testUpdateRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->sync->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->syncMaps("MPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->syncMapItems("key")->update("{}"); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $values = array( + 'Data' => "{}", + ); + + $this->assertRequest(new Request( + 'post', + 'https://preview.twilio.com/Sync/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Maps/MPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Items/key', + null, + $values + )); + } +}
\ No newline at end of file diff --git a/Twilio/Tests/Integration/Preview/Sync/Service/SyncMapTest.php b/Twilio/Tests/Integration/Preview/Sync/Service/SyncMapTest.php new file mode 100644 index 0000000..4ef693c --- /dev/null +++ b/Twilio/Tests/Integration/Preview/Sync/Service/SyncMapTest.php @@ -0,0 +1,78 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Tests\Integration\Preview\Sync\Service; + +use Twilio\Exceptions\DeserializeException; +use Twilio\Exceptions\TwilioException; +use Twilio\Http\Response; +use Twilio\Tests\HolodeckTestCase; +use Twilio\Tests\Request; + +class SyncMapTest extends HolodeckTestCase { + public function testFetchRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->sync->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->syncMaps("MPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->fetch(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'get', + 'https://preview.twilio.com/Sync/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Maps/MPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + )); + } + + public function testDeleteRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->sync->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->syncMaps("MPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->delete(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'delete', + 'https://preview.twilio.com/Sync/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Maps/MPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + )); + } + + public function testCreateRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->sync->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->syncMaps->create(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'post', + 'https://preview.twilio.com/Sync/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Maps' + )); + } + + public function testReadRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->sync->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->syncMaps->read(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'get', + 'https://preview.twilio.com/Sync/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Maps' + )); + } +}
\ No newline at end of file diff --git a/Twilio/Tests/Integration/Preview/Sync/ServiceTest.php b/Twilio/Tests/Integration/Preview/Sync/ServiceTest.php new file mode 100644 index 0000000..d522668 --- /dev/null +++ b/Twilio/Tests/Integration/Preview/Sync/ServiceTest.php @@ -0,0 +1,88 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Tests\Integration\Preview\Sync; + +use Twilio\Exceptions\DeserializeException; +use Twilio\Exceptions\TwilioException; +use Twilio\Http\Response; +use Twilio\Tests\HolodeckTestCase; +use Twilio\Tests\Request; + +class ServiceTest extends HolodeckTestCase { + public function testFetchRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->sync->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->fetch(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'get', + 'https://preview.twilio.com/Sync/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + )); + } + + public function testDeleteRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->sync->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->delete(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'delete', + 'https://preview.twilio.com/Sync/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + )); + } + + public function testCreateRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->sync->services->create(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'post', + 'https://preview.twilio.com/Sync/Services' + )); + } + + public function testReadRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->sync->services->read(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'get', + 'https://preview.twilio.com/Sync/Services' + )); + } + + public function testUpdateRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->sync->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->update(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'post', + 'https://preview.twilio.com/Sync/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + )); + } +}
\ No newline at end of file diff --git a/Twilio/Tests/Integration/Preview/Wireless/CommandTest.php b/Twilio/Tests/Integration/Preview/Wireless/CommandTest.php new file mode 100644 index 0000000..dd52653 --- /dev/null +++ b/Twilio/Tests/Integration/Preview/Wireless/CommandTest.php @@ -0,0 +1,67 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Tests\Integration\Preview\Wireless; + +use Twilio\Exceptions\DeserializeException; +use Twilio\Exceptions\TwilioException; +use Twilio\Http\Response; +use Twilio\Tests\HolodeckTestCase; +use Twilio\Tests\Request; + +class CommandTest extends HolodeckTestCase { + public function testFetchRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->wireless->commands("DCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->fetch(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'get', + 'https://preview.twilio.com/wireless/Commands/DCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + )); + } + + public function testReadRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->wireless->commands->read(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'get', + 'https://preview.twilio.com/wireless/Commands' + )); + } + + public function testCreateRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->wireless->commands->create("device", "command"); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $values = array( + 'Device' => "device", + 'Command' => "command", + ); + + $this->assertRequest(new Request( + 'post', + 'https://preview.twilio.com/wireless/Commands', + null, + $values + )); + } +}
\ No newline at end of file diff --git a/Twilio/Tests/Integration/Preview/Wireless/Device/UsageTest.php b/Twilio/Tests/Integration/Preview/Wireless/Device/UsageTest.php new file mode 100644 index 0000000..62713ba --- /dev/null +++ b/Twilio/Tests/Integration/Preview/Wireless/Device/UsageTest.php @@ -0,0 +1,33 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Tests\Integration\Preview\Wireless\Device; + +use Twilio\Exceptions\DeserializeException; +use Twilio\Exceptions\TwilioException; +use Twilio\Http\Response; +use Twilio\Tests\HolodeckTestCase; +use Twilio\Tests\Request; + +class UsageTest extends HolodeckTestCase { + public function testFetchRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->wireless->devices("DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + ->usage()->fetch(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'get', + 'https://preview.twilio.com/wireless/Devices/DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Usage' + )); + } +}
\ No newline at end of file diff --git a/Twilio/Tests/Integration/Preview/Wireless/DeviceTest.php b/Twilio/Tests/Integration/Preview/Wireless/DeviceTest.php new file mode 100644 index 0000000..7b66e64 --- /dev/null +++ b/Twilio/Tests/Integration/Preview/Wireless/DeviceTest.php @@ -0,0 +1,80 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Tests\Integration\Preview\Wireless; + +use Twilio\Exceptions\DeserializeException; +use Twilio\Exceptions\TwilioException; +use Twilio\Http\Response; +use Twilio\Tests\HolodeckTestCase; +use Twilio\Tests\Request; + +class DeviceTest extends HolodeckTestCase { + public function testFetchRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->wireless->devices("DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->fetch(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'get', + 'https://preview.twilio.com/wireless/Devices/DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + )); + } + + public function testReadRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->wireless->devices->read(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'get', + 'https://preview.twilio.com/wireless/Devices' + )); + } + + public function testCreateRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->wireless->devices->create("ratePlan"); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $values = array( + 'RatePlan' => "ratePlan", + ); + + $this->assertRequest(new Request( + 'post', + 'https://preview.twilio.com/wireless/Devices', + null, + $values + )); + } + + public function testUpdateRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->wireless->devices("DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")->update(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'post', + 'https://preview.twilio.com/wireless/Devices/DEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + )); + } +}
\ No newline at end of file diff --git a/Twilio/Tests/Integration/Preview/Wireless/RatePlanTest.php b/Twilio/Tests/Integration/Preview/Wireless/RatePlanTest.php new file mode 100644 index 0000000..0dde6cd --- /dev/null +++ b/Twilio/Tests/Integration/Preview/Wireless/RatePlanTest.php @@ -0,0 +1,46 @@ +<?php + +/** + * This code was generated by + * \ / _ _ _| _ _ + * | (_)\/(_)(_|\/| |(/_ v1.0.0 + * / / + */ + +namespace Twilio\Tests\Integration\Preview\Wireless; + +use Twilio\Exceptions\DeserializeException; +use Twilio\Exceptions\TwilioException; +use Twilio\Http\Response; +use Twilio\Tests\HolodeckTestCase; +use Twilio\Tests\Request; + +class RatePlanTest extends HolodeckTestCase { + public function testReadRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->wireless->ratePlans->read(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'get', + 'https://preview.twilio.com/wireless/RatePlans' + )); + } + + public function testFetchRequest() { + $this->holodeck->mock(new Response(500, '')); + + try { + $this->twilio->preview->wireless->ratePlans("sid")->fetch(); + } catch (DeserializeException $e) {} + catch (TwilioException $e) {} + + $this->assertRequest(new Request( + 'get', + 'https://preview.twilio.com/wireless/RatePlans/sid' + )); + } +}
\ No newline at end of file diff --git a/Twilio/VersionInfo.php b/Twilio/VersionInfo.php index d0e1fc7..12ca87d 100644 --- a/Twilio/VersionInfo.php +++ b/Twilio/VersionInfo.php @@ -7,7 +7,7 @@ namespace Twilio; class VersionInfo { const MAJOR = 5; const MINOR = 4; - const PATCH = 2; + const PATCH = '2-alpha1'; public static function string() { return implode('.', array(self::MAJOR, self::MINOR, self::PATCH)); diff --git a/docs/read_the_docs/conf.py b/docs/read_the_docs/conf.py index f170867..5b719fc 100644 --- a/docs/read_the_docs/conf.py +++ b/docs/read_the_docs/conf.py @@ -49,8 +49,8 @@ master_doc = 'index' # General information about the project. project = u'twilio-php' -copyright = u'2016, Neuman Vong' -author = u'Neuman Vong' +copyright = u'2016, Twilio' +author = u'Twilio' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -260,7 +260,7 @@ latex_elements = { # author, documentclass [howto, manual, or own class]). latex_documents = [ (master_doc, 'twilio-php.tex', u'twilio-php Documentation', - u'Neuman Vong', 'manual'), + u'Twilio', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of |