summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--LICENSE3
-rw-r--r--Makefile2
-rw-r--r--Twilio/Rest/Client.php28
-rw-r--r--Twilio/Rest/Notify.php120
-rw-r--r--Twilio/Rest/Notify/V1.php100
-rw-r--r--Twilio/Rest/Notify/V1/CredentialContext.php108
-rw-r--r--Twilio/Rest/Notify/V1/CredentialInstance.php136
-rw-r--r--Twilio/Rest/Notify/V1/CredentialList.php155
-rw-r--r--Twilio/Rest/Notify/V1/CredentialPage.php37
-rw-r--r--Twilio/Rest/Notify/V1/Service/BindingContext.php80
-rw-r--r--Twilio/Rest/Notify/V1/Service/BindingInstance.php135
-rw-r--r--Twilio/Rest/Notify/V1/Service/BindingList.php175
-rw-r--r--Twilio/Rest/Notify/V1/Service/BindingPage.php38
-rw-r--r--Twilio/Rest/Notify/V1/Service/NotificationInstance.php102
-rw-r--r--Twilio/Rest/Notify/V1/Service/NotificationList.php82
-rw-r--r--Twilio/Rest/Notify/V1/Service/NotificationPage.php38
-rw-r--r--Twilio/Rest/Notify/V1/ServiceContext.php186
-rw-r--r--Twilio/Rest/Notify/V1/ServiceInstance.php167
-rw-r--r--Twilio/Rest/Notify/V1/ServiceList.php160
-rw-r--r--Twilio/Rest/Notify/V1/ServicePage.php37
-rw-r--r--Twilio/Rest/Preview.php137
-rw-r--r--Twilio/Rest/Preview/Wireless.php114
-rw-r--r--Twilio/Rest/Preview/Wireless/CommandContext.php68
-rw-r--r--Twilio/Rest/Preview/Wireless/CommandInstance.php117
-rw-r--r--Twilio/Rest/Preview/Wireless/CommandList.php161
-rw-r--r--Twilio/Rest/Preview/Wireless/CommandPage.php37
-rw-r--r--Twilio/Rest/Preview/Wireless/Device/UsageContext.php74
-rw-r--r--Twilio/Rest/Preview/Wireless/Device/UsageInstance.php119
-rw-r--r--Twilio/Rest/Preview/Wireless/Device/UsageList.php52
-rw-r--r--Twilio/Rest/Preview/Wireless/Device/UsagePage.php38
-rw-r--r--Twilio/Rest/Preview/Wireless/DeviceContext.php159
-rw-r--r--Twilio/Rest/Preview/Wireless/DeviceInstance.php148
-rw-r--r--Twilio/Rest/Preview/Wireless/DeviceList.php165
-rw-r--r--Twilio/Rest/Preview/Wireless/DevicePage.php37
-rw-r--r--Twilio/Rest/Preview/Wireless/RatePlanContext.php68
-rw-r--r--Twilio/Rest/Preview/Wireless/RatePlanInstance.php129
-rw-r--r--Twilio/Rest/Preview/Wireless/RatePlanList.php123
-rw-r--r--Twilio/Rest/Preview/Wireless/RatePlanPage.php37
-rw-r--r--Twilio/Tests/Integration/Notify/V1/CredentialTest.php230
-rw-r--r--Twilio/Tests/Integration/Notify/V1/Service/BindingTest.php218
-rw-r--r--Twilio/Tests/Integration/Notify/V1/Service/NotificationTest.php67
-rw-r--r--Twilio/Tests/Integration/Notify/V1/ServiceTest.php256
-rw-r--r--Twilio/Tests/Integration/Preview/Wireless/CommandTest.php67
-rw-r--r--Twilio/Tests/Integration/Preview/Wireless/Device/UsageTest.php33
-rw-r--r--Twilio/Tests/Integration/Preview/Wireless/DeviceTest.php80
-rw-r--r--Twilio/Tests/Integration/Preview/Wireless/RatePlanTest.php46
-rw-r--r--Twilio/VersionInfo.php2
-rw-r--r--docs/read_the_docs/conf.py6
48 files changed, 4670 insertions, 7 deletions
diff --git a/LICENSE b/LICENSE
index a81ef8b..b2cee84 100644
--- a/LICENSE
+++ b/LICENSE
@@ -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
diff --git a/Makefile b/Makefile
index 9756f20..9cac0df 100644
--- a/Makefile
+++ b/Makefile
@@ -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 d00a071..31f5373 100644
--- a/Twilio/Rest/Client.php
+++ b/Twilio/Rest/Client.php
@@ -22,6 +22,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
@@ -85,6 +87,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;
@@ -624,6 +628,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..e09150a
--- /dev/null
+++ b/Twilio/Rest/Notify/V1/CredentialContext.php
@@ -0,0 +1,108 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _ _ _| _ _
+ * | (_)\/(_)(_|\/| |(/_ v1.0.0
+ * / /
+ */
+
+namespace Twilio\Rest\Notify\V1;
+
+use Twilio\InstanceContext;
+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/' . $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 Optional Arguments
+ * @return CredentialInstance Updated CredentialInstance
+ */
+ public function update(array $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..9dbfe90
--- /dev/null
+++ b/Twilio/Rest/Notify/V1/CredentialInstance.php
@@ -0,0 +1,136 @@
+<?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\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 Optional Arguments
+ * @return CredentialInstance Updated CredentialInstance
+ */
+ public function update(array $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..5eefd91
--- /dev/null
+++ b/Twilio/Rest/Notify/V1/CredentialList.php
@@ -0,0 +1,155 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _ _ _| _ _
+ * | (_)\/(_)(_|\/| |(/_ v1.0.0
+ * / /
+ */
+
+namespace Twilio\Rest\Notify\V1;
+
+use Twilio\ListResource;
+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 Optional Arguments
+ * @return CredentialInstance Newly created CredentialInstance
+ */
+ public function create($type, array $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/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..250db22
--- /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/' . $serviceSid . '/Bindings/' . $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..e6a3fcf
--- /dev/null
+++ b/Twilio/Rest/Notify/V1/Service/BindingList.php
@@ -0,0 +1,175 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _ _ _| _ _
+ * | (_)\/(_)(_|\/| |(/_ v1.0.0
+ * / /
+ */
+
+namespace Twilio\Rest\Notify\V1\Service;
+
+use Twilio\ListResource;
+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/' . $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 Optional Arguments
+ * @return BindingInstance Newly created BindingInstance
+ */
+ public function create($endpoint, $identity, $bindingType, $address, array $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 Optional Arguments
+ * @param int $limit Upper limit for the number of records to return. stream()
+ * guarantees to never return more than limit. Default is no
+ * limit
+ * @param mixed $pageSize Number of records to fetch per request, when not set
+ * will use the default value of 50 records. If no
+ * page_size is defined but a limit is defined, stream()
+ * will attempt to read the limit with the most
+ * efficient page size, i.e. min(limit, 1000)
+ * @return \Twilio\Stream stream of results
+ */
+ public function stream(array $options = array(), $limit = null, $pageSize = null) {
+ $limits = $this->version->readLimits($limit, $pageSize);
+
+ $page = $this->page($options, $limits['pageSize']);
+
+ return $this->version->stream($page, $limits['limit'], $limits['pageLimit']);
+ }
+
+ /**
+ * Reads 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 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(array $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 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(array $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/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..66ad7a1
--- /dev/null
+++ b/Twilio/Rest/Notify/V1/Service/NotificationList.php
@@ -0,0 +1,82 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _ _ _| _ _
+ * | (_)\/(_)(_|\/| |(/_ v1.0.0
+ * / /
+ */
+
+namespace Twilio\Rest\Notify\V1\Service;
+
+use Twilio\ListResource;
+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/' . $serviceSid . '/Notifications';
+ }
+
+ /**
+ * Create a new NotificationInstance
+ *
+ * @param array $options Optional Arguments
+ * @return NotificationInstance Newly created NotificationInstance
+ */
+ public function create(array $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/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..5d01e6d
--- /dev/null
+++ b/Twilio/Rest/Notify/V1/ServiceContext.php
@@ -0,0 +1,186 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _ _ _| _ _
+ * | (_)\/(_)(_|\/| |(/_ v1.0.0
+ * / /
+ */
+
+namespace Twilio\Rest\Notify\V1;
+
+use Twilio\Exceptions\TwilioException;
+use Twilio\InstanceContext;
+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/' . $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 Optional Arguments
+ * @return ServiceInstance Updated ServiceInstance
+ */
+ public function update(array $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..248c84b
--- /dev/null
+++ b/Twilio/Rest/Notify/V1/ServiceInstance.php
@@ -0,0 +1,167 @@
+<?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\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 Optional Arguments
+ * @return ServiceInstance Updated ServiceInstance
+ */
+ public function update(array $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..ac5fc8a
--- /dev/null
+++ b/Twilio/Rest/Notify/V1/ServiceList.php
@@ -0,0 +1,160 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _ _ _| _ _
+ * | (_)\/(_)(_|\/| |(/_ v1.0.0
+ * / /
+ */
+
+namespace Twilio\Rest\Notify\V1;
+
+use Twilio\ListResource;
+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 Optional Arguments
+ * @return ServiceInstance Newly created ServiceInstance
+ */
+ public function create(array $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 Optional Arguments
+ * @param int $limit Upper limit for the number of records to return. stream()
+ * guarantees to never return more than limit. Default is no
+ * limit
+ * @param mixed $pageSize Number of records to fetch per request, when not set
+ * will use the default value of 50 records. If no
+ * page_size is defined but a limit is defined, stream()
+ * will attempt to read the limit with the most
+ * efficient page size, i.e. min(limit, 1000)
+ * @return \Twilio\Stream stream of results
+ */
+ public function stream(array $options = array(), $limit = null, $pageSize = null) {
+ $limits = $this->version->readLimits($limit, $pageSize);
+
+ $page = $this->page($options, $limits['pageSize']);
+
+ return $this->version->stream($page, $limits['limit'], $limits['pageLimit']);
+ }
+
+ /**
+ * Reads 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 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(array $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 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(array $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/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..35d79b9
--- /dev/null
+++ b/Twilio/Rest/Preview.php
@@ -0,0 +1,137 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _ _ _| _ _
+ * | (_)\/(_)(_|\/| |(/_ v1.0.0
+ * / /
+ */
+
+namespace Twilio\Rest;
+
+use Twilio\Domain;
+use Twilio\Exceptions\TwilioException;
+use Twilio\Rest\Preview\Wireless;
+
+/**
+ * @property \Twilio\Rest\Preview\Wireless wireless
+ * @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 Preview extends Domain {
+ 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\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\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/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..4ff3b26
--- /dev/null
+++ b/Twilio/Rest/Preview/Wireless/CommandContext.php
@@ -0,0 +1,68 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _ _ _| _ _
+ * | (_)\/(_)(_|\/| |(/_ v1.0.0
+ * / /
+ */
+
+namespace Twilio\Rest\Preview\Wireless;
+
+use Twilio\InstanceContext;
+use Twilio\Values;
+use Twilio\Version;
+
+class CommandContext extends InstanceContext {
+ /**
+ * Initialize the CommandContext
+ *
+ * @param \Twilio\Version $version Version that contains the resource
+ * @param string $sid The sid
+ * @return \Twilio\Rest\Preview\Wireless\CommandContext
+ */
+ public function __construct(Version $version, $sid) {
+ parent::__construct($version);
+
+ // Path Solution
+ $this->solution = array(
+ 'sid' => $sid,
+ );
+
+ $this->uri = '/Commands/' . $sid . '';
+ }
+
+ /**
+ * Fetch a CommandInstance
+ *
+ * @return CommandInstance Fetched CommandInstance
+ */
+ public function fetch() {
+ $params = Values::of(array());
+
+ $payload = $this->version->fetch(
+ 'GET',
+ $this->uri,
+ $params
+ );
+
+ return new CommandInstance(
+ $this->version,
+ $payload,
+ $this->solution['sid']
+ );
+ }
+
+ /**
+ * Provide a friendly representation
+ *
+ * @return string Machine friendly representation
+ */
+ public function __toString() {
+ $context = array();
+ foreach ($this->solution as $key => $value) {
+ $context[] = "$key=$value";
+ }
+ return '[Twilio.Preview.Wireless.CommandContext ' . implode(' ', $context) . ']';
+ }
+} \ No newline at end of file
diff --git a/Twilio/Rest/Preview/Wireless/CommandInstance.php b/Twilio/Rest/Preview/Wireless/CommandInstance.php
new file mode 100644
index 0000000..597347a
--- /dev/null
+++ b/Twilio/Rest/Preview/Wireless/CommandInstance.php
@@ -0,0 +1,117 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _ _ _| _ _
+ * | (_)\/(_)(_|\/| |(/_ v1.0.0
+ * / /
+ */
+
+namespace Twilio\Rest\Preview\Wireless;
+
+use Twilio\Deserialize;
+use Twilio\Exceptions\TwilioException;
+use Twilio\InstanceResource;
+use Twilio\Version;
+
+/**
+ * @property string sid
+ * @property string accountSid
+ * @property string deviceSid
+ * @property string command
+ * @property string status
+ * @property string direction
+ * @property \DateTime dateCreated
+ * @property \DateTime dateUpdated
+ * @property string url
+ */
+class CommandInstance extends InstanceResource {
+ /**
+ * Initialize the CommandInstance
+ *
+ * @param \Twilio\Version $version Version that contains the resource
+ * @param mixed[] $payload The response payload
+ * @param string $sid The sid
+ * @return \Twilio\Rest\Preview\Wireless\CommandInstance
+ */
+ public function __construct(Version $version, array $payload, $sid = null) {
+ parent::__construct($version);
+
+ // Marshaled Properties
+ $this->properties = array(
+ 'sid' => $payload['sid'],
+ 'accountSid' => $payload['account_sid'],
+ 'deviceSid' => $payload['device_sid'],
+ 'command' => $payload['command'],
+ 'status' => $payload['status'],
+ 'direction' => $payload['direction'],
+ 'dateCreated' => Deserialize::iso8601DateTime($payload['date_created']),
+ 'dateUpdated' => Deserialize::iso8601DateTime($payload['date_updated']),
+ 'url' => $payload['url'],
+ );
+
+ $this->solution = array(
+ 'sid' => $sid ?: $this->properties['sid'],
+ );
+ }
+
+ /**
+ * Generate an instance context for the instance, the context is capable of
+ * performing various actions. All instance actions are proxied to the context
+ *
+ * @return \Twilio\Rest\Preview\Wireless\CommandContext Context for this
+ * CommandInstance
+ */
+ protected function proxy() {
+ if (!$this->context) {
+ $this->context = new CommandContext(
+ $this->version,
+ $this->solution['sid']
+ );
+ }
+
+ return $this->context;
+ }
+
+ /**
+ * Fetch a CommandInstance
+ *
+ * @return CommandInstance Fetched CommandInstance
+ */
+ public function fetch() {
+ return $this->proxy()->fetch();
+ }
+
+ /**
+ * Magic getter to access properties
+ *
+ * @param string $name Property to access
+ * @return mixed The requested property
+ * @throws TwilioException For unknown properties
+ */
+ public function __get($name) {
+ if (array_key_exists($name, $this->properties)) {
+ return $this->properties[$name];
+ }
+
+ if (property_exists($this, '_' . $name)) {
+ $method = 'get' . ucfirst($name);
+ return $this->$method();
+ }
+
+ throw new TwilioException('Unknown property: ' . $name);
+ }
+
+ /**
+ * Provide a friendly representation
+ *
+ * @return string Machine friendly representation
+ */
+ public function __toString() {
+ $context = array();
+ foreach ($this->solution as $key => $value) {
+ $context[] = "$key=$value";
+ }
+ return '[Twilio.Preview.Wireless.CommandInstance ' . implode(' ', $context) . ']';
+ }
+} \ No newline at end of file
diff --git a/Twilio/Rest/Preview/Wireless/CommandList.php b/Twilio/Rest/Preview/Wireless/CommandList.php
new file mode 100644
index 0000000..de60d86
--- /dev/null
+++ b/Twilio/Rest/Preview/Wireless/CommandList.php
@@ -0,0 +1,161 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _ _ _| _ _
+ * | (_)\/(_)(_|\/| |(/_ v1.0.0
+ * / /
+ */
+
+namespace Twilio\Rest\Preview\Wireless;
+
+use Twilio\ListResource;
+use Twilio\Values;
+use Twilio\Version;
+
+class CommandList extends ListResource {
+ /**
+ * Construct the CommandList
+ *
+ * @param Version $version Version that contains the resource
+ * @return \Twilio\Rest\Preview\Wireless\CommandList
+ */
+ public function __construct(Version $version) {
+ parent::__construct($version);
+
+ // Path Solution
+ $this->solution = array();
+
+ $this->uri = '/Commands';
+ }
+
+ /**
+ * Streams CommandInstance records from the API as a generator stream.
+ * This operation lazily loads records as efficiently as possible until the
+ * limit
+ * is reached.
+ * The results are returned as a generator, so this operation is memory
+ * efficient.
+ *
+ * @param array $options Optional Arguments
+ * @param int $limit Upper limit for the number of records to return. stream()
+ * guarantees to never return more than limit. Default is no
+ * limit
+ * @param mixed $pageSize Number of records to fetch per request, when not set
+ * will use the default value of 50 records. If no
+ * page_size is defined but a limit is defined, stream()
+ * will attempt to read the limit with the most
+ * efficient page size, i.e. min(limit, 1000)
+ * @return \Twilio\Stream stream of results
+ */
+ public function stream(array $options = array(), $limit = null, $pageSize = null) {
+ $limits = $this->version->readLimits($limit, $pageSize);
+
+ $page = $this->page($options, $limits['pageSize']);
+
+ return $this->version->stream($page, $limits['limit'], $limits['pageLimit']);
+ }
+
+ /**
+ * Reads CommandInstance records from the API as a list.
+ * Unlike stream(), this operation is eager and will load `limit` records into
+ * memory before returning.
+ *
+ * @param array $options Optional Arguments
+ * @param int $limit Upper limit for the number of records to return. read()
+ * guarantees to never return more than limit. Default is no
+ * limit
+ * @param mixed $pageSize Number of records to fetch per request, when not set
+ * will use the default value of 50 records. If no
+ * page_size is defined but a limit is defined, read()
+ * will attempt to read the limit with the most
+ * efficient page size, i.e. min(limit, 1000)
+ * @return CommandInstance[] Array of results
+ */
+ public function read(array $options = array(), $limit = null, $pageSize = Values::NONE) {
+ return iterator_to_array($this->stream($options, $limit, $pageSize), false);
+ }
+
+ /**
+ * Retrieve a single page of CommandInstance records from the API.
+ * Request is executed immediately
+ *
+ * @param array $options Optional Arguments
+ * @param mixed $pageSize Number of records to return, defaults to 50
+ * @param string $pageToken PageToken provided by the API
+ * @param mixed $pageNumber Page Number, this value is simply for client state
+ * @return \Twilio\Page Page of CommandInstance
+ */
+ public function page(array $options = array(), $pageSize = Values::NONE, $pageToken = Values::NONE, $pageNumber = Values::NONE) {
+ $options = new Values($options);
+ $params = Values::of(array(
+ 'Device' => $options['device'],
+ 'Status' => $options['status'],
+ 'Direction' => $options['direction'],
+ 'PageToken' => $pageToken,
+ 'Page' => $pageNumber,
+ 'PageSize' => $pageSize,
+ ));
+
+ $response = $this->version->page(
+ 'GET',
+ $this->uri,
+ $params
+ );
+
+ return new CommandPage($this->version, $response, $this->solution);
+ }
+
+ /**
+ * Create a new CommandInstance
+ *
+ * @param string $device The device
+ * @param string $command The command
+ * @param array $options Optional Arguments
+ * @return CommandInstance Newly created CommandInstance
+ */
+ public function create($device, $command, array $options = array()) {
+ $options = new Values($options);
+
+ $data = Values::of(array(
+ 'Device' => $device,
+ 'Command' => $command,
+ 'CallbackMethod' => $options['callbackMethod'],
+ 'CallbackUrl' => $options['callbackUrl'],
+ ));
+
+ $payload = $this->version->create(
+ 'POST',
+ $this->uri,
+ array(),
+ $data
+ );
+
+ return new CommandInstance(
+ $this->version,
+ $payload
+ );
+ }
+
+ /**
+ * Constructs a CommandContext
+ *
+ * @param string $sid The sid
+ * @return \Twilio\Rest\Preview\Wireless\CommandContext
+ */
+ public function getContext($sid) {
+ return new CommandContext(
+ $this->version,
+ $sid
+ );
+ }
+
+ /**
+ * Provide a friendly representation
+ *
+ * @return string Machine friendly representation
+ */
+ public function __toString() {
+ return '[Twilio.Preview.Wireless.CommandList]';
+ }
+} \ No newline at end of file
diff --git a/Twilio/Rest/Preview/Wireless/CommandPage.php b/Twilio/Rest/Preview/Wireless/CommandPage.php
new file mode 100644
index 0000000..b7e8b3d
--- /dev/null
+++ b/Twilio/Rest/Preview/Wireless/CommandPage.php
@@ -0,0 +1,37 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _ _ _| _ _
+ * | (_)\/(_)(_|\/| |(/_ v1.0.0
+ * / /
+ */
+
+namespace Twilio\Rest\Preview\Wireless;
+
+use Twilio\Page;
+
+class CommandPage extends Page {
+ public function __construct($version, $response, $solution) {
+ parent::__construct($version, $response);
+
+ // Path Solution
+ $this->solution = $solution;
+ }
+
+ public function buildInstance(array $payload) {
+ return new CommandInstance(
+ $this->version,
+ $payload
+ );
+ }
+
+ /**
+ * Provide a friendly representation
+ *
+ * @return string Machine friendly representation
+ */
+ public function __toString() {
+ return '[Twilio.Preview.Wireless.CommandPage]';
+ }
+} \ No newline at end of file
diff --git a/Twilio/Rest/Preview/Wireless/Device/UsageContext.php b/Twilio/Rest/Preview/Wireless/Device/UsageContext.php
new file mode 100644
index 0000000..14928f1
--- /dev/null
+++ b/Twilio/Rest/Preview/Wireless/Device/UsageContext.php
@@ -0,0 +1,74 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _ _ _| _ _
+ * | (_)\/(_)(_|\/| |(/_ v1.0.0
+ * / /
+ */
+
+namespace Twilio\Rest\Preview\Wireless\Device;
+
+use Twilio\InstanceContext;
+use Twilio\Values;
+use Twilio\Version;
+
+class UsageContext extends InstanceContext {
+ /**
+ * Initialize the UsageContext
+ *
+ * @param \Twilio\Version $version Version that contains the resource
+ * @param string $deviceSid The device_sid
+ * @return \Twilio\Rest\Preview\Wireless\Device\UsageContext
+ */
+ public function __construct(Version $version, $deviceSid) {
+ parent::__construct($version);
+
+ // Path Solution
+ $this->solution = array(
+ 'deviceSid' => $deviceSid,
+ );
+
+ $this->uri = '/Devices/' . $deviceSid . '/Usage';
+ }
+
+ /**
+ * Fetch a UsageInstance
+ *
+ * @param array $options Optional Arguments
+ * @return UsageInstance Fetched UsageInstance
+ */
+ public function fetch(array $options = array()) {
+ $options = new Values($options);
+
+ $params = Values::of(array(
+ 'End' => $options['end'],
+ 'Start' => $options['start'],
+ ));
+
+ $payload = $this->version->fetch(
+ 'GET',
+ $this->uri,
+ $params
+ );
+
+ return new UsageInstance(
+ $this->version,
+ $payload,
+ $this->solution['deviceSid']
+ );
+ }
+
+ /**
+ * Provide a friendly representation
+ *
+ * @return string Machine friendly representation
+ */
+ public function __toString() {
+ $context = array();
+ foreach ($this->solution as $key => $value) {
+ $context[] = "$key=$value";
+ }
+ return '[Twilio.Preview.Wireless.UsageContext ' . implode(' ', $context) . ']';
+ }
+} \ No newline at end of file
diff --git a/Twilio/Rest/Preview/Wireless/Device/UsageInstance.php b/Twilio/Rest/Preview/Wireless/Device/UsageInstance.php
new file mode 100644
index 0000000..25ebf1f
--- /dev/null
+++ b/Twilio/Rest/Preview/Wireless/Device/UsageInstance.php
@@ -0,0 +1,119 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _ _ _| _ _
+ * | (_)\/(_)(_|\/| |(/_ v1.0.0
+ * / /
+ */
+
+namespace Twilio\Rest\Preview\Wireless\Device;
+
+use Twilio\Exceptions\TwilioException;
+use Twilio\InstanceResource;
+use Twilio\Version;
+
+/**
+ * @property string deviceSid
+ * @property string deviceAlias
+ * @property string accountSid
+ * @property string period
+ * @property string commandsUsage
+ * @property string commandsCosts
+ * @property string dataUsage
+ * @property string dataCosts
+ * @property string url
+ */
+class UsageInstance extends InstanceResource {
+ /**
+ * Initialize the UsageInstance
+ *
+ * @param \Twilio\Version $version Version that contains the resource
+ * @param mixed[] $payload The response payload
+ * @param string $deviceSid The device_sid
+ * @return \Twilio\Rest\Preview\Wireless\Device\UsageInstance
+ */
+ public function __construct(Version $version, array $payload, $deviceSid) {
+ parent::__construct($version);
+
+ // Marshaled Properties
+ $this->properties = array(
+ 'deviceSid' => $payload['device_sid'],
+ 'deviceAlias' => $payload['device_alias'],
+ 'accountSid' => $payload['account_sid'],
+ 'period' => $payload['period'],
+ 'commandsUsage' => $payload['commands_usage'],
+ 'commandsCosts' => $payload['commands_costs'],
+ 'dataUsage' => $payload['data_usage'],
+ 'dataCosts' => $payload['data_costs'],
+ 'url' => $payload['url'],
+ );
+
+ $this->solution = array(
+ 'deviceSid' => $deviceSid,
+ );
+ }
+
+ /**
+ * Generate an instance context for the instance, the context is capable of
+ * performing various actions. All instance actions are proxied to the context
+ *
+ * @return \Twilio\Rest\Preview\Wireless\Device\UsageContext Context for this
+ * UsageInstance
+ */
+ protected function proxy() {
+ if (!$this->context) {
+ $this->context = new UsageContext(
+ $this->version,
+ $this->solution['deviceSid']
+ );
+ }
+
+ return $this->context;
+ }
+
+ /**
+ * Fetch a UsageInstance
+ *
+ * @param array $options Optional Arguments
+ * @return UsageInstance Fetched UsageInstance
+ */
+ public function fetch(array $options = array()) {
+ return $this->proxy()->fetch(
+ $options
+ );
+ }
+
+ /**
+ * Magic getter to access properties
+ *
+ * @param string $name Property to access
+ * @return mixed The requested property
+ * @throws TwilioException For unknown properties
+ */
+ public function __get($name) {
+ if (array_key_exists($name, $this->properties)) {
+ return $this->properties[$name];
+ }
+
+ if (property_exists($this, '_' . $name)) {
+ $method = 'get' . ucfirst($name);
+ return $this->$method();
+ }
+
+ throw new TwilioException('Unknown property: ' . $name);
+ }
+
+ /**
+ * Provide a friendly representation
+ *
+ * @return string Machine friendly representation
+ */
+ public function __toString() {
+ $context = array();
+ foreach ($this->solution as $key => $value) {
+ $context[] = "$key=$value";
+ }
+ return '[Twilio.Preview.Wireless.UsageInstance ' . implode(' ', $context) . ']';
+ }
+} \ No newline at end of file
diff --git a/Twilio/Rest/Preview/Wireless/Device/UsageList.php b/Twilio/Rest/Preview/Wireless/Device/UsageList.php
new file mode 100644
index 0000000..59d25e6
--- /dev/null
+++ b/Twilio/Rest/Preview/Wireless/Device/UsageList.php
@@ -0,0 +1,52 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _ _ _| _ _
+ * | (_)\/(_)(_|\/| |(/_ v1.0.0
+ * / /
+ */
+
+namespace Twilio\Rest\Preview\Wireless\Device;
+
+use Twilio\ListResource;
+use Twilio\Version;
+
+class UsageList extends ListResource {
+ /**
+ * Construct the UsageList
+ *
+ * @param Version $version Version that contains the resource
+ * @param string $deviceSid The device_sid
+ * @return \Twilio\Rest\Preview\Wireless\Device\UsageList
+ */
+ public function __construct(Version $version, $deviceSid) {
+ parent::__construct($version);
+
+ // Path Solution
+ $this->solution = array(
+ 'deviceSid' => $deviceSid,
+ );
+ }
+
+ /**
+ * Constructs a UsageContext
+ *
+ * @return \Twilio\Rest\Preview\Wireless\Device\UsageContext
+ */
+ public function getContext() {
+ return new UsageContext(
+ $this->version,
+ $this->solution['deviceSid']
+ );
+ }
+
+ /**
+ * Provide a friendly representation
+ *
+ * @return string Machine friendly representation
+ */
+ public function __toString() {
+ return '[Twilio.Preview.Wireless.UsageList]';
+ }
+} \ No newline at end of file
diff --git a/Twilio/Rest/Preview/Wireless/Device/UsagePage.php b/Twilio/Rest/Preview/Wireless/Device/UsagePage.php
new file mode 100644
index 0000000..d35524f
--- /dev/null
+++ b/Twilio/Rest/Preview/Wireless/Device/UsagePage.php
@@ -0,0 +1,38 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _ _ _| _ _
+ * | (_)\/(_)(_|\/| |(/_ v1.0.0
+ * / /
+ */
+
+namespace Twilio\Rest\Preview\Wireless\Device;
+
+use Twilio\Page;
+
+class UsagePage extends Page {
+ public function __construct($version, $response, $solution) {
+ parent::__construct($version, $response);
+
+ // Path Solution
+ $this->solution = $solution;
+ }
+
+ public function buildInstance(array $payload) {
+ return new UsageInstance(
+ $this->version,
+ $payload,
+ $this->solution['deviceSid']
+ );
+ }
+
+ /**
+ * Provide a friendly representation
+ *
+ * @return string Machine friendly representation
+ */
+ public function __toString() {
+ return '[Twilio.Preview.Wireless.UsagePage]';
+ }
+} \ No newline at end of file
diff --git a/Twilio/Rest/Preview/Wireless/DeviceContext.php b/Twilio/Rest/Preview/Wireless/DeviceContext.php
new file mode 100644
index 0000000..8509d72
--- /dev/null
+++ b/Twilio/Rest/Preview/Wireless/DeviceContext.php
@@ -0,0 +1,159 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _ _ _| _ _
+ * | (_)\/(_)(_|\/| |(/_ v1.0.0
+ * / /
+ */
+
+namespace Twilio\Rest\Preview\Wireless;
+
+use Twilio\Exceptions\TwilioException;
+use Twilio\InstanceContext;
+use Twilio\Rest\Preview\Wireless\Device\UsageList;
+use Twilio\Values;
+use Twilio\Version;
+
+/**
+ * @property \Twilio\Rest\Preview\Wireless\Device\UsageList usage
+ * @method \Twilio\Rest\Preview\Wireless\Device\UsageContext usage()
+ */
+class DeviceContext extends InstanceContext {
+ protected $_usage = null;
+
+ /**
+ * Initialize the DeviceContext
+ *
+ * @param \Twilio\Version $version Version that contains the resource
+ * @param string $sid The sid
+ * @return \Twilio\Rest\Preview\Wireless\DeviceContext
+ */
+ public function __construct(Version $version, $sid) {
+ parent::__construct($version);
+
+ // Path Solution
+ $this->solution = array(
+ 'sid' => $sid,
+ );
+
+ $this->uri = '/Devices/' . $sid . '';
+ }
+
+ /**
+ * Fetch a DeviceInstance
+ *
+ * @return DeviceInstance Fetched DeviceInstance
+ */
+ public function fetch() {
+ $params = Values::of(array());
+
+ $payload = $this->version->fetch(
+ 'GET',
+ $this->uri,
+ $params
+ );
+
+ return new DeviceInstance(
+ $this->version,
+ $payload,
+ $this->solution['sid']
+ );
+ }
+
+ /**
+ * Update the DeviceInstance
+ *
+ * @param array $options Optional Arguments
+ * @return DeviceInstance Updated DeviceInstance
+ */
+ public function update(array $options = array()) {
+ $options = new Values($options);
+
+ $data = Values::of(array(
+ 'Alias' => $options['alias'],
+ 'CallbackMethod' => $options['callbackMethod'],
+ 'CallbackUrl' => $options['callbackUrl'],
+ 'FriendlyName' => $options['friendlyName'],
+ 'SimIdentifier' => $options['simIdentifier'],
+ 'Status' => $options['status'],
+ 'CommandsCallbackMethod' => $options['commandsCallbackMethod'],
+ 'CommandsCallbackUrl' => $options['commandsCallbackUrl'],
+ ));
+
+ $payload = $this->version->update(
+ 'POST',
+ $this->uri,
+ array(),
+ $data
+ );
+
+ return new DeviceInstance(
+ $this->version,
+ $payload,
+ $this->solution['sid']
+ );
+ }
+
+ /**
+ * Access the usage
+ *
+ * @return \Twilio\Rest\Preview\Wireless\Device\UsageList
+ */
+ protected function getUsage() {
+ if (!$this->_usage) {
+ $this->_usage = new UsageList(
+ $this->version,
+ $this->solution['sid']
+ );
+ }
+
+ return $this->_usage;
+ }
+
+ /**
+ * Magic getter to lazy load subresources
+ *
+ * @param string $name Subresource to return
+ * @return \Twilio\ListResource The requested subresource
+ * @throws \Twilio\Exceptions\TwilioException For unknown subresources
+ */
+ public function __get($name) {
+ if (property_exists($this, '_' . $name)) {
+ $method = 'get' . ucfirst($name);
+ return $this->$method();
+ }
+
+ throw new TwilioException('Unknown subresource ' . $name);
+ }
+
+ /**
+ * Magic caller to get resource contexts
+ *
+ * @param string $name Resource to return
+ * @param array $arguments Context parameters
+ * @return \Twilio\InstanceContext The requested resource context
+ * @throws \Twilio\Exceptions\TwilioException For unknown resource
+ */
+ public function __call($name, $arguments) {
+ $property = $this->$name;
+ if (method_exists($property, 'getContext')) {
+ return call_user_func_array(array($property, 'getContext'), $arguments);
+ }
+
+ throw new TwilioException('Resource does not have a context');
+ }
+
+ /**
+ * Provide a friendly representation
+ *
+ * @return string Machine friendly representation
+ */
+ public function __toString() {
+ $context = array();
+ foreach ($this->solution as $key => $value) {
+ $context[] = "$key=$value";
+ }
+ return '[Twilio.Preview.Wireless.DeviceContext ' . implode(' ', $context) . ']';
+ }
+} \ No newline at end of file
diff --git a/Twilio/Rest/Preview/Wireless/DeviceInstance.php b/Twilio/Rest/Preview/Wireless/DeviceInstance.php
new file mode 100644
index 0000000..79257c2
--- /dev/null
+++ b/Twilio/Rest/Preview/Wireless/DeviceInstance.php
@@ -0,0 +1,148 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _ _ _| _ _
+ * | (_)\/(_)(_|\/| |(/_ v1.0.0
+ * / /
+ */
+
+namespace Twilio\Rest\Preview\Wireless;
+
+use Twilio\Deserialize;
+use Twilio\Exceptions\TwilioException;
+use Twilio\InstanceResource;
+use Twilio\Version;
+
+/**
+ * @property string sid
+ * @property string alias
+ * @property string accountSid
+ * @property string ratePlanSid
+ * @property string friendlyName
+ * @property string simIdentifier
+ * @property string status
+ * @property string commandsCallbackUrl
+ * @property string commandsCallbackMethod
+ * @property \DateTime dateCreated
+ * @property \DateTime dateUpdated
+ * @property string url
+ * @property string links
+ */
+class DeviceInstance extends InstanceResource {
+ protected $_usage = null;
+
+ /**
+ * Initialize the DeviceInstance
+ *
+ * @param \Twilio\Version $version Version that contains the resource
+ * @param mixed[] $payload The response payload
+ * @param string $sid The sid
+ * @return \Twilio\Rest\Preview\Wireless\DeviceInstance
+ */
+ public function __construct(Version $version, array $payload, $sid = null) {
+ parent::__construct($version);
+
+ // Marshaled Properties
+ $this->properties = array(
+ 'sid' => $payload['sid'],
+ 'alias' => $payload['alias'],
+ 'accountSid' => $payload['account_sid'],
+ 'ratePlanSid' => $payload['rate_plan_sid'],
+ 'friendlyName' => $payload['friendly_name'],
+ 'simIdentifier' => $payload['sim_identifier'],
+ 'status' => $payload['status'],
+ 'commandsCallbackUrl' => $payload['commands_callback_url'],
+ 'commandsCallbackMethod' => $payload['commands_callback_method'],
+ 'dateCreated' => Deserialize::iso8601DateTime($payload['date_created']),
+ 'dateUpdated' => Deserialize::iso8601DateTime($payload['date_updated']),
+ 'url' => $payload['url'],
+ 'links' => $payload['links'],
+ );
+
+ $this->solution = array(
+ 'sid' => $sid ?: $this->properties['sid'],
+ );
+ }
+
+ /**
+ * Generate an instance context for the instance, the context is capable of
+ * performing various actions. All instance actions are proxied to the context
+ *
+ * @return \Twilio\Rest\Preview\Wireless\DeviceContext Context for this
+ * DeviceInstance
+ */
+ protected function proxy() {
+ if (!$this->context) {
+ $this->context = new DeviceContext(
+ $this->version,
+ $this->solution['sid']
+ );
+ }
+
+ return $this->context;
+ }
+
+ /**
+ * Fetch a DeviceInstance
+ *
+ * @return DeviceInstance Fetched DeviceInstance
+ */
+ public function fetch() {
+ return $this->proxy()->fetch();
+ }
+
+ /**
+ * Update the DeviceInstance
+ *
+ * @param array $options Optional Arguments
+ * @return DeviceInstance Updated DeviceInstance
+ */
+ public function update(array $options = array()) {
+ return $this->proxy()->update(
+ $options
+ );
+ }
+
+ /**
+ * Access the usage
+ *
+ * @return \Twilio\Rest\Preview\Wireless\Device\UsageList
+ */
+ protected function getUsage() {
+ return $this->proxy()->usage;
+ }
+
+ /**
+ * Magic getter to access properties
+ *
+ * @param string $name Property to access
+ * @return mixed The requested property
+ * @throws TwilioException For unknown properties
+ */
+ public function __get($name) {
+ if (array_key_exists($name, $this->properties)) {
+ return $this->properties[$name];
+ }
+
+ if (property_exists($this, '_' . $name)) {
+ $method = 'get' . ucfirst($name);
+ return $this->$method();
+ }
+
+ throw new TwilioException('Unknown property: ' . $name);
+ }
+
+ /**
+ * Provide a friendly representation
+ *
+ * @return string Machine friendly representation
+ */
+ public function __toString() {
+ $context = array();
+ foreach ($this->solution as $key => $value) {
+ $context[] = "$key=$value";
+ }
+ return '[Twilio.Preview.Wireless.DeviceInstance ' . implode(' ', $context) . ']';
+ }
+} \ No newline at end of file
diff --git a/Twilio/Rest/Preview/Wireless/DeviceList.php b/Twilio/Rest/Preview/Wireless/DeviceList.php
new file mode 100644
index 0000000..960bcbf
--- /dev/null
+++ b/Twilio/Rest/Preview/Wireless/DeviceList.php
@@ -0,0 +1,165 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _ _ _| _ _
+ * | (_)\/(_)(_|\/| |(/_ v1.0.0
+ * / /
+ */
+
+namespace Twilio\Rest\Preview\Wireless;
+
+use Twilio\ListResource;
+use Twilio\Values;
+use Twilio\Version;
+
+class DeviceList extends ListResource {
+ /**
+ * Construct the DeviceList
+ *
+ * @param Version $version Version that contains the resource
+ * @return \Twilio\Rest\Preview\Wireless\DeviceList
+ */
+ public function __construct(Version $version) {
+ parent::__construct($version);
+
+ // Path Solution
+ $this->solution = array();
+
+ $this->uri = '/Devices';
+ }
+
+ /**
+ * Streams DeviceInstance records from the API as a generator stream.
+ * This operation lazily loads records as efficiently as possible until the
+ * limit
+ * is reached.
+ * The results are returned as a generator, so this operation is memory
+ * efficient.
+ *
+ * @param array $options Optional Arguments
+ * @param int $limit Upper limit for the number of records to return. stream()
+ * guarantees to never return more than limit. Default is no
+ * limit
+ * @param mixed $pageSize Number of records to fetch per request, when not set
+ * will use the default value of 50 records. If no
+ * page_size is defined but a limit is defined, stream()
+ * will attempt to read the limit with the most
+ * efficient page size, i.e. min(limit, 1000)
+ * @return \Twilio\Stream stream of results
+ */
+ public function stream(array $options = array(), $limit = null, $pageSize = null) {
+ $limits = $this->version->readLimits($limit, $pageSize);
+
+ $page = $this->page($options, $limits['pageSize']);
+
+ return $this->version->stream($page, $limits['limit'], $limits['pageLimit']);
+ }
+
+ /**
+ * Reads DeviceInstance records from the API as a list.
+ * Unlike stream(), this operation is eager and will load `limit` records into
+ * memory before returning.
+ *
+ * @param array $options Optional Arguments
+ * @param int $limit Upper limit for the number of records to return. read()
+ * guarantees to never return more than limit. Default is no
+ * limit
+ * @param mixed $pageSize Number of records to fetch per request, when not set
+ * will use the default value of 50 records. If no
+ * page_size is defined but a limit is defined, read()
+ * will attempt to read the limit with the most
+ * efficient page size, i.e. min(limit, 1000)
+ * @return DeviceInstance[] Array of results
+ */
+ public function read(array $options = array(), $limit = null, $pageSize = Values::NONE) {
+ return iterator_to_array($this->stream($options, $limit, $pageSize), false);
+ }
+
+ /**
+ * Retrieve a single page of DeviceInstance records from the API.
+ * Request is executed immediately
+ *
+ * @param array $options Optional Arguments
+ * @param mixed $pageSize Number of records to return, defaults to 50
+ * @param string $pageToken PageToken provided by the API
+ * @param mixed $pageNumber Page Number, this value is simply for client state
+ * @return \Twilio\Page Page of DeviceInstance
+ */
+ public function page(array $options = array(), $pageSize = Values::NONE, $pageToken = Values::NONE, $pageNumber = Values::NONE) {
+ $options = new Values($options);
+ $params = Values::of(array(
+ 'Status' => $options['status'],
+ 'SimIdentifier' => $options['simIdentifier'],
+ 'RatePlan' => $options['ratePlan'],
+ 'PageToken' => $pageToken,
+ 'Page' => $pageNumber,
+ 'PageSize' => $pageSize,
+ ));
+
+ $response = $this->version->page(
+ 'GET',
+ $this->uri,
+ $params
+ );
+
+ return new DevicePage($this->version, $response, $this->solution);
+ }
+
+ /**
+ * Create a new DeviceInstance
+ *
+ * @param string $ratePlan The rate_plan
+ * @param array $options Optional Arguments
+ * @return DeviceInstance Newly created DeviceInstance
+ */
+ public function create($ratePlan, array $options = array()) {
+ $options = new Values($options);
+
+ $data = Values::of(array(
+ 'RatePlan' => $ratePlan,
+ 'Alias' => $options['alias'],
+ 'CallbackMethod' => $options['callbackMethod'],
+ 'CallbackUrl' => $options['callbackUrl'],
+ 'FriendlyName' => $options['friendlyName'],
+ 'SimIdentifier' => $options['simIdentifier'],
+ 'Status' => $options['status'],
+ 'CommandsCallbackMethod' => $options['commandsCallbackMethod'],
+ 'CommandsCallbackUrl' => $options['commandsCallbackUrl'],
+ ));
+
+ $payload = $this->version->create(
+ 'POST',
+ $this->uri,
+ array(),
+ $data
+ );
+
+ return new DeviceInstance(
+ $this->version,
+ $payload
+ );
+ }
+
+ /**
+ * Constructs a DeviceContext
+ *
+ * @param string $sid The sid
+ * @return \Twilio\Rest\Preview\Wireless\DeviceContext
+ */
+ public function getContext($sid) {
+ return new DeviceContext(
+ $this->version,
+ $sid
+ );
+ }
+
+ /**
+ * Provide a friendly representation
+ *
+ * @return string Machine friendly representation
+ */
+ public function __toString() {
+ return '[Twilio.Preview.Wireless.DeviceList]';
+ }
+} \ No newline at end of file
diff --git a/Twilio/Rest/Preview/Wireless/DevicePage.php b/Twilio/Rest/Preview/Wireless/DevicePage.php
new file mode 100644
index 0000000..fb04329
--- /dev/null
+++ b/Twilio/Rest/Preview/Wireless/DevicePage.php
@@ -0,0 +1,37 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _ _ _| _ _
+ * | (_)\/(_)(_|\/| |(/_ v1.0.0
+ * / /
+ */
+
+namespace Twilio\Rest\Preview\Wireless;
+
+use Twilio\Page;
+
+class DevicePage extends Page {
+ public function __construct($version, $response, $solution) {
+ parent::__construct($version, $response);
+
+ // Path Solution
+ $this->solution = $solution;
+ }
+
+ public function buildInstance(array $payload) {
+ return new DeviceInstance(
+ $this->version,
+ $payload
+ );
+ }
+
+ /**
+ * Provide a friendly representation
+ *
+ * @return string Machine friendly representation
+ */
+ public function __toString() {
+ return '[Twilio.Preview.Wireless.DevicePage]';
+ }
+} \ No newline at end of file
diff --git a/Twilio/Rest/Preview/Wireless/RatePlanContext.php b/Twilio/Rest/Preview/Wireless/RatePlanContext.php
new file mode 100644
index 0000000..30c6aa4
--- /dev/null
+++ b/Twilio/Rest/Preview/Wireless/RatePlanContext.php
@@ -0,0 +1,68 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _ _ _| _ _
+ * | (_)\/(_)(_|\/| |(/_ v1.0.0
+ * / /
+ */
+
+namespace Twilio\Rest\Preview\Wireless;
+
+use Twilio\InstanceContext;
+use Twilio\Values;
+use Twilio\Version;
+
+class RatePlanContext extends InstanceContext {
+ /**
+ * Initialize the RatePlanContext
+ *
+ * @param \Twilio\Version $version Version that contains the resource
+ * @param string $sid The sid
+ * @return \Twilio\Rest\Preview\Wireless\RatePlanContext
+ */
+ public function __construct(Version $version, $sid) {
+ parent::__construct($version);
+
+ // Path Solution
+ $this->solution = array(
+ 'sid' => $sid,
+ );
+
+ $this->uri = '/RatePlans/' . $sid . '';
+ }
+
+ /**
+ * Fetch a RatePlanInstance
+ *
+ * @return RatePlanInstance Fetched RatePlanInstance
+ */
+ public function fetch() {
+ $params = Values::of(array());
+
+ $payload = $this->version->fetch(
+ 'GET',
+ $this->uri,
+ $params
+ );
+
+ return new RatePlanInstance(
+ $this->version,
+ $payload,
+ $this->solution['sid']
+ );
+ }
+
+ /**
+ * Provide a friendly representation
+ *
+ * @return string Machine friendly representation
+ */
+ public function __toString() {
+ $context = array();
+ foreach ($this->solution as $key => $value) {
+ $context[] = "$key=$value";
+ }
+ return '[Twilio.Preview.Wireless.RatePlanContext ' . implode(' ', $context) . ']';
+ }
+} \ No newline at end of file
diff --git a/Twilio/Rest/Preview/Wireless/RatePlanInstance.php b/Twilio/Rest/Preview/Wireless/RatePlanInstance.php
new file mode 100644
index 0000000..d5212b8
--- /dev/null
+++ b/Twilio/Rest/Preview/Wireless/RatePlanInstance.php
@@ -0,0 +1,129 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _ _ _| _ _
+ * | (_)\/(_)(_|\/| |(/_ v1.0.0
+ * / /
+ */
+
+namespace Twilio\Rest\Preview\Wireless;
+
+use Twilio\Deserialize;
+use Twilio\Exceptions\TwilioException;
+use Twilio\InstanceResource;
+use Twilio\Version;
+
+/**
+ * @property string sid
+ * @property string alias
+ * @property string accountSid
+ * @property string friendlyName
+ * @property string dataMetering
+ * @property string capabilities
+ * @property string voiceCap
+ * @property string messagingCap
+ * @property string commandsCap
+ * @property string dataCap
+ * @property string capPeriod
+ * @property string capUnit
+ * @property \DateTime dateCreated
+ * @property \DateTime dateUpdated
+ * @property string url
+ */
+class RatePlanInstance extends InstanceResource {
+ /**
+ * Initialize the RatePlanInstance
+ *
+ * @param \Twilio\Version $version Version that contains the resource
+ * @param mixed[] $payload The response payload
+ * @param string $sid The sid
+ * @return \Twilio\Rest\Preview\Wireless\RatePlanInstance
+ */
+ public function __construct(Version $version, array $payload, $sid = null) {
+ parent::__construct($version);
+
+ // Marshaled Properties
+ $this->properties = array(
+ 'sid' => $payload['sid'],
+ 'alias' => $payload['alias'],
+ 'accountSid' => $payload['account_sid'],
+ 'friendlyName' => $payload['friendly_name'],
+ 'dataMetering' => $payload['data_metering'],
+ 'capabilities' => $payload['capabilities'],
+ 'voiceCap' => $payload['voice_cap'],
+ 'messagingCap' => $payload['messaging_cap'],
+ 'commandsCap' => $payload['commands_cap'],
+ 'dataCap' => $payload['data_cap'],
+ 'capPeriod' => $payload['cap_period'],
+ 'capUnit' => $payload['cap_unit'],
+ 'dateCreated' => Deserialize::iso8601DateTime($payload['date_created']),
+ 'dateUpdated' => Deserialize::iso8601DateTime($payload['date_updated']),
+ 'url' => $payload['url'],
+ );
+
+ $this->solution = array(
+ 'sid' => $sid ?: $this->properties['sid'],
+ );
+ }
+
+ /**
+ * Generate an instance context for the instance, the context is capable of
+ * performing various actions. All instance actions are proxied to the context
+ *
+ * @return \Twilio\Rest\Preview\Wireless\RatePlanContext Context for this
+ * RatePlanInstance
+ */
+ protected function proxy() {
+ if (!$this->context) {
+ $this->context = new RatePlanContext(
+ $this->version,
+ $this->solution['sid']
+ );
+ }
+
+ return $this->context;
+ }
+
+ /**
+ * Fetch a RatePlanInstance
+ *
+ * @return RatePlanInstance Fetched RatePlanInstance
+ */
+ public function fetch() {
+ return $this->proxy()->fetch();
+ }
+
+ /**
+ * Magic getter to access properties
+ *
+ * @param string $name Property to access
+ * @return mixed The requested property
+ * @throws TwilioException For unknown properties
+ */
+ public function __get($name) {
+ if (array_key_exists($name, $this->properties)) {
+ return $this->properties[$name];
+ }
+
+ if (property_exists($this, '_' . $name)) {
+ $method = 'get' . ucfirst($name);
+ return $this->$method();
+ }
+
+ throw new TwilioException('Unknown property: ' . $name);
+ }
+
+ /**
+ * Provide a friendly representation
+ *
+ * @return string Machine friendly representation
+ */
+ public function __toString() {
+ $context = array();
+ foreach ($this->solution as $key => $value) {
+ $context[] = "$key=$value";
+ }
+ return '[Twilio.Preview.Wireless.RatePlanInstance ' . implode(' ', $context) . ']';
+ }
+} \ No newline at end of file
diff --git a/Twilio/Rest/Preview/Wireless/RatePlanList.php b/Twilio/Rest/Preview/Wireless/RatePlanList.php
new file mode 100644
index 0000000..6017b7d
--- /dev/null
+++ b/Twilio/Rest/Preview/Wireless/RatePlanList.php
@@ -0,0 +1,123 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _ _ _| _ _
+ * | (_)\/(_)(_|\/| |(/_ v1.0.0
+ * / /
+ */
+
+namespace Twilio\Rest\Preview\Wireless;
+
+use Twilio\ListResource;
+use Twilio\Values;
+use Twilio\Version;
+
+class RatePlanList extends ListResource {
+ /**
+ * Construct the RatePlanList
+ *
+ * @param Version $version Version that contains the resource
+ * @return \Twilio\Rest\Preview\Wireless\RatePlanList
+ */
+ public function __construct(Version $version) {
+ parent::__construct($version);
+
+ // Path Solution
+ $this->solution = array();
+
+ $this->uri = '/RatePlans';
+ }
+
+ /**
+ * Streams RatePlanInstance records from the API as a generator stream.
+ * This operation lazily loads records as efficiently as possible until the
+ * limit
+ * is reached.
+ * The results are returned as a generator, so this operation is memory
+ * efficient.
+ *
+ * @param int $limit Upper limit for the number of records to return. stream()
+ * guarantees to never return more than limit. Default is no
+ * limit
+ * @param mixed $pageSize Number of records to fetch per request, when not set
+ * will use the default value of 50 records. If no
+ * page_size is defined but a limit is defined, stream()
+ * will attempt to read the limit with the most
+ * efficient page size, i.e. min(limit, 1000)
+ * @return \Twilio\Stream stream of results
+ */
+ public function stream($limit = null, $pageSize = null) {
+ $limits = $this->version->readLimits($limit, $pageSize);
+
+ $page = $this->page($limits['pageSize']);
+
+ return $this->version->stream($page, $limits['limit'], $limits['pageLimit']);
+ }
+
+ /**
+ * Reads RatePlanInstance records from the API as a list.
+ * Unlike stream(), this operation is eager and will load `limit` records into
+ * memory before returning.
+ *
+ * @param int $limit Upper limit for the number of records to return. read()
+ * guarantees to never return more than limit. Default is no
+ * limit
+ * @param mixed $pageSize Number of records to fetch per request, when not set
+ * will use the default value of 50 records. If no
+ * page_size is defined but a limit is defined, read()
+ * will attempt to read the limit with the most
+ * efficient page size, i.e. min(limit, 1000)
+ * @return RatePlanInstance[] Array of results
+ */
+ public function read($limit = null, $pageSize = Values::NONE) {
+ return iterator_to_array($this->stream($limit, $pageSize), false);
+ }
+
+ /**
+ * Retrieve a single page of RatePlanInstance records from the API.
+ * Request is executed immediately
+ *
+ * @param mixed $pageSize Number of records to return, defaults to 50
+ * @param string $pageToken PageToken provided by the API
+ * @param mixed $pageNumber Page Number, this value is simply for client state
+ * @return \Twilio\Page Page of RatePlanInstance
+ */
+ public function page($pageSize = Values::NONE, $pageToken = Values::NONE, $pageNumber = Values::NONE) {
+ $params = Values::of(array(
+ 'PageToken' => $pageToken,
+ 'Page' => $pageNumber,
+ 'PageSize' => $pageSize,
+ ));
+
+ $response = $this->version->page(
+ 'GET',
+ $this->uri,
+ $params
+ );
+
+ return new RatePlanPage($this->version, $response, $this->solution);
+ }
+
+ /**
+ * Constructs a RatePlanContext
+ *
+ * @param string $sid The sid
+ * @return \Twilio\Rest\Preview\Wireless\RatePlanContext
+ */
+ public function getContext($sid) {
+ return new RatePlanContext(
+ $this->version,
+ $sid
+ );
+ }
+
+ /**
+ * Provide a friendly representation
+ *
+ * @return string Machine friendly representation
+ */
+ public function __toString() {
+ return '[Twilio.Preview.Wireless.RatePlanList]';
+ }
+} \ No newline at end of file
diff --git a/Twilio/Rest/Preview/Wireless/RatePlanPage.php b/Twilio/Rest/Preview/Wireless/RatePlanPage.php
new file mode 100644
index 0000000..ceb2fcc
--- /dev/null
+++ b/Twilio/Rest/Preview/Wireless/RatePlanPage.php
@@ -0,0 +1,37 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _ _ _| _ _
+ * | (_)\/(_)(_|\/| |(/_ v1.0.0
+ * / /
+ */
+
+namespace Twilio\Rest\Preview\Wireless;
+
+use Twilio\Page;
+
+class RatePlanPage extends Page {
+ public function __construct($version, $response, $solution) {
+ parent::__construct($version, $response);
+
+ // Path Solution
+ $this->solution = $solution;
+ }
+
+ public function buildInstance(array $payload) {
+ return new RatePlanInstance(
+ $this->version,
+ $payload
+ );
+ }
+
+ /**
+ * Provide a friendly representation
+ *
+ * @return string Machine friendly representation
+ */
+ public function __toString() {
+ return '[Twilio.Preview.Wireless.RatePlanPage]';
+ }
+} \ No newline at end of file
diff --git a/Twilio/Tests/Integration/Notify/V1/CredentialTest.php b/Twilio/Tests/Integration/Notify/V1/CredentialTest.php
new file mode 100644
index 0000000..88c0b50
--- /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->assertTrue($this->holodeck->hasRequest(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->assertTrue(count($actual) > 0);
+ }
+
+ 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->assertTrue($this->holodeck->hasRequest(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->assertTrue($this->holodeck->hasRequest(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->assertTrue($this->holodeck->hasRequest(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->assertTrue($this->holodeck->hasRequest(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..ba90832
--- /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->assertTrue($this->holodeck->hasRequest(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->assertTrue($this->holodeck->hasRequest(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->assertTrue($this->holodeck->hasRequest(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->assertTrue($this->holodeck->hasRequest(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->assertTrue(count($actual) > 0);
+ }
+
+ 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..3831378
--- /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->assertTrue($this->holodeck->hasRequest(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..5b8eef3
--- /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->assertTrue($this->holodeck->hasRequest(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->assertTrue($this->holodeck->hasRequest(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->assertTrue($this->holodeck->hasRequest(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->assertTrue($this->holodeck->hasRequest(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->assertTrue(count($actual) > 0);
+ }
+
+ 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->assertTrue($this->holodeck->hasRequest(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/Wireless/CommandTest.php b/Twilio/Tests/Integration/Preview/Wireless/CommandTest.php
new file mode 100644
index 0000000..260c95d
--- /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->assertTrue($this->holodeck->hasRequest(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->assertTrue($this->holodeck->hasRequest(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->assertTrue($this->holodeck->hasRequest(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..60975ca
--- /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->assertTrue($this->holodeck->hasRequest(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..2be4508
--- /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->assertTrue($this->holodeck->hasRequest(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->assertTrue($this->holodeck->hasRequest(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->assertTrue($this->holodeck->hasRequest(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->assertTrue($this->holodeck->hasRequest(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..4d9fc5d
--- /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->assertTrue($this->holodeck->hasRequest(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->assertTrue($this->holodeck->hasRequest(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 93b0296..a0d51df 100644
--- a/Twilio/VersionInfo.php
+++ b/Twilio/VersionInfo.php
@@ -7,7 +7,7 @@ namespace Twilio;
class VersionInfo {
const MAJOR = 5;
const MINOR = 0;
- const PATCH = 3;
+ const PATCH = '3-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