RomanL преди 8 години
родител
ревизия
923d552ac9
променени са 100 файла, в които са добавени 11777 реда и са изтрити 0 реда
  1. 22 0
      plugins/Twilio/Deserialize.php
  2. 83 0
      plugins/Twilio/Domain.php
  3. 9 0
      plugins/Twilio/Exceptions/ConfigurationException.php
  4. 9 0
      plugins/Twilio/Exceptions/DeserializeException.php
  5. 9 0
      plugins/Twilio/Exceptions/EnvironmentException.php
  6. 9 0
      plugins/Twilio/Exceptions/HttpException.php
  7. 32 0
      plugins/Twilio/Exceptions/RestException.php
  8. 9 0
      plugins/Twilio/Exceptions/TwilioException.php
  9. 9 0
      plugins/Twilio/Exceptions/TwimlException.php
  10. 11 0
      plugins/Twilio/Http/Client.php
  11. 188 0
      plugins/Twilio/Http/CurlClient.php
  12. 43 0
      plugins/Twilio/Http/Response.php
  13. 19 0
      plugins/Twilio/InstanceContext.php
  14. 24 0
      plugins/Twilio/InstanceResource.php
  15. 130 0
      plugins/Twilio/Jwt/AccessToken.php
  16. 67 0
      plugins/Twilio/Jwt/Client/ScopeURI.php
  17. 115 0
      plugins/Twilio/Jwt/ClientToken.php
  18. 128 0
      plugins/Twilio/Jwt/Grants/ChatGrant.php
  19. 55 0
      plugins/Twilio/Jwt/Grants/ConversationsGrant.php
  20. 21 0
      plugins/Twilio/Jwt/Grants/Grant.php
  21. 132 0
      plugins/Twilio/Jwt/Grants/IpMessagingGrant.php
  22. 138 0
      plugins/Twilio/Jwt/Grants/SyncGrant.php
  23. 110 0
      plugins/Twilio/Jwt/Grants/TaskRouterGrant.php
  24. 80 0
      plugins/Twilio/Jwt/Grants/VideoGrant.php
  25. 148 0
      plugins/Twilio/Jwt/Grants/VoiceGrant.php
  26. 156 0
      plugins/Twilio/Jwt/JWT.php
  27. 160 0
      plugins/Twilio/Jwt/TaskRouter/CapabilityToken.php
  28. 54 0
      plugins/Twilio/Jwt/TaskRouter/Policy.php
  29. 20 0
      plugins/Twilio/Jwt/TaskRouter/TaskQueueCapability.php
  30. 48 0
      plugins/Twilio/Jwt/TaskRouter/WorkerCapability.php
  31. 15 0
      plugins/Twilio/Jwt/TaskRouter/WorkspaceCapability.php
  32. 19 0
      plugins/Twilio/ListResource.php
  33. 13 0
      plugins/Twilio/Options.php
  34. 192 0
      plugins/Twilio/Page.php
  35. 94 0
      plugins/Twilio/Rest/Accounts.php
  36. 85 0
      plugins/Twilio/Rest/Accounts/V1.php
  37. 93 0
      plugins/Twilio/Rest/Accounts/V1/Credential/AwsContext.php
  38. 127 0
      plugins/Twilio/Rest/Accounts/V1/Credential/AwsInstance.php
  39. 163 0
      plugins/Twilio/Rest/Accounts/V1/Credential/AwsList.php
  40. 115 0
      plugins/Twilio/Rest/Accounts/V1/Credential/AwsOptions.php
  41. 34 0
      plugins/Twilio/Rest/Accounts/V1/Credential/AwsPage.php
  42. 93 0
      plugins/Twilio/Rest/Accounts/V1/Credential/PublicKeyContext.php
  43. 128 0
      plugins/Twilio/Rest/Accounts/V1/Credential/PublicKeyInstance.php
  44. 163 0
      plugins/Twilio/Rest/Accounts/V1/Credential/PublicKeyList.php
  45. 118 0
      plugins/Twilio/Rest/Accounts/V1/Credential/PublicKeyOptions.php
  46. 34 0
      plugins/Twilio/Rest/Accounts/V1/Credential/PublicKeyPage.php
  47. 59 0
      plugins/Twilio/Rest/Accounts/V1/CredentialInstance.php
  48. 104 0
      plugins/Twilio/Rest/Accounts/V1/CredentialList.php
  49. 34 0
      plugins/Twilio/Rest/Accounts/V1/CredentialPage.php
  50. 449 0
      plugins/Twilio/Rest/Api.php
  51. 338 0
      plugins/Twilio/Rest/Api/V2010.php
  52. 120 0
      plugins/Twilio/Rest/Api/V2010/Account/Address/DependentPhoneNumberInstance.php
  53. 130 0
      plugins/Twilio/Rest/Api/V2010/Account/Address/DependentPhoneNumberList.php
  54. 39 0
      plugins/Twilio/Rest/Api/V2010/Account/Address/DependentPhoneNumberPage.php
  55. 171 0
      plugins/Twilio/Rest/Api/V2010/Account/AddressContext.php
  56. 159 0
      plugins/Twilio/Rest/Api/V2010/Account/AddressInstance.php
  57. 183 0
      plugins/Twilio/Rest/Api/V2010/Account/AddressList.php
  58. 298 0
      plugins/Twilio/Rest/Api/V2010/Account/AddressOptions.php
  59. 34 0
      plugins/Twilio/Rest/Api/V2010/Account/AddressPage.php
  60. 121 0
      plugins/Twilio/Rest/Api/V2010/Account/ApplicationContext.php
  61. 160 0
      plugins/Twilio/Rest/Api/V2010/Account/ApplicationInstance.php
  62. 182 0
      plugins/Twilio/Rest/Api/V2010/Account/ApplicationList.php
  63. 540 0
      plugins/Twilio/Rest/Api/V2010/Account/ApplicationOptions.php
  64. 34 0
      plugins/Twilio/Rest/Api/V2010/Account/ApplicationPage.php
  65. 68 0
      plugins/Twilio/Rest/Api/V2010/Account/AuthorizedConnectAppContext.php
  66. 124 0
      plugins/Twilio/Rest/Api/V2010/Account/AuthorizedConnectAppInstance.php
  67. 143 0
      plugins/Twilio/Rest/Api/V2010/Account/AuthorizedConnectAppList.php
  68. 34 0
      plugins/Twilio/Rest/Api/V2010/Account/AuthorizedConnectAppPage.php
  69. 94 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/LocalInstance.php
  70. 153 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/LocalList.php
  71. 302 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/LocalOptions.php
  72. 39 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/LocalPage.php
  73. 94 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/MachineToMachineInstance.php
  74. 153 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/MachineToMachineList.php
  75. 302 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/MachineToMachineOptions.php
  76. 39 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/MachineToMachinePage.php
  77. 94 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/MobileInstance.php
  78. 153 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/MobileList.php
  79. 302 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/MobileOptions.php
  80. 39 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/MobilePage.php
  81. 94 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/NationalInstance.php
  82. 153 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/NationalList.php
  83. 302 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/NationalOptions.php
  84. 39 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/NationalPage.php
  85. 94 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/SharedCostInstance.php
  86. 153 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/SharedCostList.php
  87. 302 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/SharedCostOptions.php
  88. 39 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/SharedCostPage.php
  89. 94 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/TollFreeInstance.php
  90. 153 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/TollFreeList.php
  91. 302 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/TollFreeOptions.php
  92. 39 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/TollFreePage.php
  93. 94 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/VoipInstance.php
  94. 153 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/VoipList.php
  95. 302 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/VoipOptions.php
  96. 39 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/VoipPage.php
  97. 246 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountryContext.php
  98. 184 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountryInstance.php
  99. 145 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountryList.php
  100. 38 0
      plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountryPage.php

+ 22 - 0
plugins/Twilio/Deserialize.php

@@ -0,0 +1,22 @@
+<?php
+
+namespace Twilio;
+
+class Deserialize {
+
+    /**
+     * Deserialize a string date into a DateTime object
+     *
+     * @param string $s A date or date and time, can be iso8601, rfc2822, 
+     *                  YYYY-MM-DD format.
+     * @return \DateTime DateTime corresponding to the input string, in UTC time.
+     */
+    public static function dateTime($s) {
+        try {
+            return new \DateTime($s, new \DateTimeZone('UTC'));
+        } catch (\Exception $e) {
+            return $s;
+        }
+    }
+
+}

+ 83 - 0
plugins/Twilio/Domain.php

@@ -0,0 +1,83 @@
+<?php
+
+
+namespace Twilio;
+
+
+use Twilio\Rest\Client;
+
+/**
+ * Class Domain
+ * Abstracts a Twilio sub domain
+ * @package Twilio
+ */
+abstract class Domain {
+    /**
+     * @var \Twilio\Rest\Client Twilio Client
+     */
+    protected $client;
+
+    /**
+     * @var string Base URL for this domain
+     */
+    protected $baseUrl;
+
+    /**
+     * Construct a new Domain
+     * @param \Twilio\Rest\Client $client used to communicate with Twilio
+     */
+    public function __construct(Client $client) {
+        $this->client = $client;
+        $this->baseUrl = '';
+    }
+
+    /**
+     * Translate version relative URIs into absolute URLs
+     *
+     * @param string $uri Version relative URI
+     * @return string Absolute URL for this domain
+     */
+    public function absoluteUrl($uri) {
+        return implode('/', array(trim($this->baseUrl, '/'), trim($uri, '/')));
+    }
+
+    /**
+     * Make an HTTP request to the domain
+     *
+     * @param string $method HTTP Method to make the request with
+     * @param string $uri Relative uri to make a request to
+     * @param array $params Query string arguments
+     * @param array $data Post form data
+     * @param array $headers HTTP headers to send with the request
+     * @param string $user User to authenticate as
+     * @param string $password Password
+     * @param null $timeout Request timeout
+     * @return \Twilio\Http\Response the response for the request
+     */
+    public function request($method, $uri, $params = array(), $data = array(),
+                            $headers = array(), $user = null, $password = null,
+                            $timeout = null) {
+        $url = $this->absoluteUrl($uri);
+        return $this->client->request(
+            $method,
+            $url,
+            $params,
+            $data,
+            $headers,
+            $user,
+            $password,
+            $timeout
+        );
+    }
+
+    /**
+     * @return \Twilio\Rest\Client
+     */
+    public function getClient() {
+        return $this->client;
+    }
+
+    public function __toString() {
+        return '[Domain]';
+    }
+}

+ 9 - 0
plugins/Twilio/Exceptions/ConfigurationException.php

@@ -0,0 +1,9 @@
+<?php
+
+
+namespace Twilio\Exceptions;
+
+
+class ConfigurationException extends TwilioException {
+
+}

+ 9 - 0
plugins/Twilio/Exceptions/DeserializeException.php

@@ -0,0 +1,9 @@
+<?php
+
+
+namespace Twilio\Exceptions;
+
+
+class DeserializeException extends TwilioException {
+
+}

+ 9 - 0
plugins/Twilio/Exceptions/EnvironmentException.php

@@ -0,0 +1,9 @@
+<?php
+
+
+namespace Twilio\Exceptions;
+
+
+class EnvironmentException extends TwilioException {
+
+}

+ 9 - 0
plugins/Twilio/Exceptions/HttpException.php

@@ -0,0 +1,9 @@
+<?php
+
+
+namespace Twilio\Exceptions;
+
+
+class HttpException extends TwilioException {
+
+}

+ 32 - 0
plugins/Twilio/Exceptions/RestException.php

@@ -0,0 +1,32 @@
+<?php
+
+
+namespace Twilio\Exceptions;
+
+
+class RestException extends TwilioException {
+    protected $statusCode;
+
+    /**
+     * Construct the exception. Note: The message is NOT binary safe.
+     * @link http://php.net/manual/en/exception.construct.php
+     * @param string $message [optional] The Exception message to throw.
+     * @param int $code [optional] The Exception code.
+     * @param int $statusCode [optional] The HTTP Status code.
+     * @since 5.1.0
+     */
+    public function __construct($message, $code, $statusCode) {
+        $this->statusCode = $statusCode;
+        parent::__construct($message, $code);
+    }
+
+    /**
+     * Get the HTTP Status Code of the RestException
+     * @return int HTTP Status Code
+     */
+    public function getStatusCode() {
+        return $this->statusCode;
+    }
+
+
+}

+ 9 - 0
plugins/Twilio/Exceptions/TwilioException.php

@@ -0,0 +1,9 @@
+<?php
+
+
+namespace Twilio\Exceptions;
+
+
+class TwilioException extends \Exception {
+
+}

+ 9 - 0
plugins/Twilio/Exceptions/TwimlException.php

@@ -0,0 +1,9 @@
+<?php
+
+
+namespace Twilio\Exceptions;
+
+
+class TwimlException extends TwilioException {
+
+}

+ 11 - 0
plugins/Twilio/Http/Client.php

@@ -0,0 +1,11 @@
+<?php
+
+
+namespace Twilio\Http;
+
+
+interface Client {
+    public function request($method, $url, $params = array(), $data = array(),
+                            $headers = array(), $user = null, $password = null,
+                            $timeout = null);
+}

+ 188 - 0
plugins/Twilio/Http/CurlClient.php

@@ -0,0 +1,188 @@
+<?php
+
+
+namespace Twilio\Http;
+
+
+use Twilio\Exceptions\EnvironmentException;
+
+class CurlClient implements Client {
+    const DEFAULT_TIMEOUT = 60;
+    protected $curlOptions = array();
+    protected $debugHttp = false;
+
+    public $lastRequest = null;
+    public $lastResponse = null;
+
+    public function __construct(array $options = array()) {
+        $this->curlOptions = $options;
+        $this->debugHttp = getenv('DEBUG_HTTP_TRAFFIC') === 'true';
+    }
+
+    public function request($method, $url, $params = array(), $data = array(),
+                            $headers = array(), $user = null, $password = null,
+                            $timeout = null) {
+        $options = $this->options($method, $url, $params, $data, $headers,
+                                  $user, $password, $timeout);
+
+        $this->lastRequest = $options;
+        $this->lastResponse = null;
+
+        try {
+            if (!$curl = curl_init()) {
+                throw new EnvironmentException('Unable to initialize cURL');
+            }
+
+            if (!curl_setopt_array($curl, $options)) {
+                throw new EnvironmentException(curl_error($curl));
+            }
+
+            if (!$response = curl_exec($curl)) {
+                throw new EnvironmentException(curl_error($curl));
+            }
+
+            $parts = explode("\r\n\r\n", $response, 3);
+            list($head, $body) = ($parts[0] == 'HTTP/1.1 100 Continue')
+                               ? array($parts[1], $parts[2])
+                               : array($parts[0], $parts[1]);
+
+            if ($this->debugHttp) {
+                $u = parse_url($url);
+                $hdrLine = $method . ' ' . $u['path'];
+                if (isset($u['query']) && strlen($u['query']) > 0 ) {
+                    $hdrLine = $hdrLine . '?' . $u['query'];
+                }
+                error_log($hdrLine);
+                foreach ($headers as $key => $value) {
+                    error_log("$key: $value");
+                }
+                if ($method === 'POST') {
+                    error_log("\n" . $options[CURLOPT_POSTFIELDS] . "\n");
+                }
+            }
+            $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
+
+            $responseHeaders = array();
+            $headerLines = explode("\r\n", $head);
+            array_shift($headerLines);
+            foreach ($headerLines as $line) {
+                list($key, $value) = explode(':', $line, 2);
+                $responseHeaders[$key] = $value;
+            }
+
+            curl_close($curl);
+
+            if (isset($buffer) && is_resource($buffer)) {
+                fclose($buffer);
+            }
+
+            if ($this->debugHttp) {
+                error_log("HTTP/1.1 $statusCode");
+                foreach ($responseHeaders as $key => $value) {
+                    error_log("$key: $value");
+                }
+                error_log("\n$body");
+            }
+
+            $this->lastResponse = new Response($statusCode, $body, $responseHeaders);
+
+            return $this->lastResponse;
+        } catch (\ErrorException $e) {
+            if (isset($curl) && is_resource($curl)) {
+                curl_close($curl);
+            }
+
+            if (isset($buffer) && is_resource($buffer)) {
+                fclose($buffer);
+            }
+
+            throw $e;
+        }
+    }
+
+    public function options($method, $url, $params = array(), $data = array(),
+                            $headers = array(), $user = null, $password = null,
+                            $timeout = null) {
+
+        $timeout = is_null($timeout)
+            ? self::DEFAULT_TIMEOUT
+            : $timeout;
+        $options = $this->curlOptions + array(
+            CURLOPT_URL => $url,
+            CURLOPT_HEADER => true,
+            CURLOPT_RETURNTRANSFER => true,
+            CURLOPT_INFILESIZE => Null,
+            CURLOPT_HTTPHEADER => array(),
+            CURLOPT_TIMEOUT => $timeout,
+            CURLOPT_SSL_VERIFYHOST => 0,
+            CURLOPT_SSL_VERIFYPEER => 0
+        );
+
+        foreach ($headers as $key => $value) {
+            $options[CURLOPT_HTTPHEADER][] = "$key: $value";
+        }
+
+        if ($user && $password) {
+            $options[CURLOPT_HTTPHEADER][] = 'Authorization: Basic ' . base64_encode("$user:$password");
+        }
+
+        $body = $this->buildQuery($params);
+        if ($body) {
+            $options[CURLOPT_URL] .= '?' . $body;
+        }
+
+        switch (strtolower(trim($method))) {
+            case 'get':
+                $options[CURLOPT_HTTPGET] = true;
+                break;
+            case 'post':
+                $options[CURLOPT_POST] = true;
+                $options[CURLOPT_POSTFIELDS] = $this->buildQuery($data);
+
+                break;
+            case 'put':
+                $options[CURLOPT_PUT] = true;
+                if ($data) {
+                    if ($buffer = fopen('php://memory', 'w+')) {
+                        $dataString = $this->buildQuery($data);
+                        fwrite($buffer, $dataString);
+                        fseek($buffer, 0);
+                        $options[CURLOPT_INFILE] = $buffer;
+                        $options[CURLOPT_INFILESIZE] = strlen($dataString);
+                    } else {
+                        throw new EnvironmentException('Unable to open a temporary file');
+                    }
+                }
+                break;
+            case 'head':
+                $options[CURLOPT_NOBODY] = true;
+                break;
+            default:
+                $options[CURLOPT_CUSTOMREQUEST] = strtoupper($method);
+        }
+
+        return $options;
+    }
+
+    public function buildQuery($params) {
+        $parts = array();
+
+        if (is_string($params)) {
+            return $params;
+        }
+
+        $params = $params ?: array();
+
+        foreach ($params as $key => $value) {
+            if (is_array($value)) {
+                foreach ($value as $item) {
+                    $parts[] = urlencode((string)$key) . '=' . urlencode((string)$item);
+                }
+            } else {
+                $parts[] = urlencode((string)$key) . '=' . urlencode((string)$value);
+            }
+        }
+
+        return implode('&', $parts);
+    }
+}

+ 43 - 0
plugins/Twilio/Http/Response.php

@@ -0,0 +1,43 @@
+<?php
+
+
+namespace Twilio\Http;
+
+
+class Response {
+    protected $headers;
+    protected $content;
+    protected $statusCode;
+
+    public function __construct($statusCode, $content, $headers = array()) {
+        $this->statusCode = $statusCode;
+        $this->content = $content;
+        $this->headers = $headers;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getContent() {
+        return json_decode($this->content, true);
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getStatusCode() {
+        return $this->statusCode;
+    }
+
+    public function getHeaders() {
+        return $this->headers;
+    }
+
+    public function ok() {
+        return $this->getStatusCode() < 400;
+    }
+
+    public function __toString() {
+        return '[Response] HTTP ' . $this->getStatusCode() . ' ' . $this->content;
+    }
+}

+ 19 - 0
plugins/Twilio/InstanceContext.php

@@ -0,0 +1,19 @@
+<?php
+
+
+namespace Twilio;
+
+
+class InstanceContext {
+    protected $version;
+    protected $solution = array();
+    protected $uri;
+
+    public function __construct(Version $version) {
+        $this->version = $version;
+    }
+
+    public function __toString() {
+        return '[InstanceContext]';
+    }
+}

+ 24 - 0
plugins/Twilio/InstanceResource.php

@@ -0,0 +1,24 @@
+<?php
+
+
+namespace Twilio;
+
+
+class InstanceResource {
+    protected $version;
+    protected $context = null;
+    protected $properties = array();
+    protected $solution = array();
+
+    public function __construct(Version $version) {
+        $this->version = $version;
+    }
+
+    public function toArray() {
+        return $this->properties;
+    }
+
+    public function __toString() {
+        return '[InstanceResource]';
+    }
+}

+ 130 - 0
plugins/Twilio/Jwt/AccessToken.php

@@ -0,0 +1,130 @@
+<?php
+
+namespace Twilio\Jwt;
+
+
+use Twilio\Jwt\Grants\Grant;
+
+class AccessToken {
+    private $signingKeySid;
+    private $accountSid;
+    private $secret;
+    private $ttl;
+    private $identity;
+    private $nbf;
+    /** @var Grant[] $grants */
+    private $grants;
+
+    public function __construct($accountSid, $signingKeySid, $secret, $ttl = 3600, $identity = null) {
+        $this->signingKeySid = $signingKeySid;
+        $this->accountSid = $accountSid;
+        $this->secret = $secret;
+        $this->ttl = $ttl;
+
+        if (!is_null($identity)) {
+            $this->identity = $identity;
+        }
+
+        $this->grants = array();
+    }
+
+    /**
+     * Set the identity of this access token
+     *
+     * @param string $identity identity of the grant
+     *
+     * @return $this updated access token
+     */
+    public function setIdentity($identity) {
+        $this->identity = $identity;
+        return $this;
+    }
+
+    /**
+     * Returns the identity of the grant
+     *
+     * @return string the identity
+     */
+    public function getIdentity() {
+        return $this->identity;
+    }
+
+    /**
+     * Set the nbf of this access token
+     *
+     * @param integer $nbf nbf in epoch seconds of the grant
+     *
+     * @return $this updated access token
+     */
+    public function setNbf($nbf) {
+        $this->nbf = $nbf;
+        return $this;
+    }
+
+    /**
+     * Returns the nbf of the grant
+     *
+     * @return integer the nbf in epoch seconds
+     */
+    public function getNbf() {
+        return $this->nbf;
+    }
+
+    /**
+     * Add a grant to the access token
+     *
+     * @param Grant $grant to be added
+     *
+     * @return $this the updated access token
+     */
+    public function addGrant(Grant $grant) {
+        $this->grants[] = $grant;
+        return $this;
+    }
+
+
+    public function toJWT($algorithm = 'HS256') {
+        $header = array(
+            'cty' => 'twilio-fpa;v=1',
+            'typ' => 'JWT'
+        );
+
+        $now = time();
+
+        $grants = array();
+        if ($this->identity) {
+            $grants['identity'] = $this->identity;
+        }
+
+        foreach ($this->grants as $grant) {
+            $payload = $grant->getPayload();
+            if (empty($payload)) {
+                $payload = json_decode('{}');
+            }
+
+            $grants[$grant->getGrantKey()] = $payload;
+        }
+
+        if (empty($grants)) {
+            $grants = json_decode('{}');
+        }
+
+        $payload = array(
+            'jti' => $this->signingKeySid . '-' . $now,
+            'iss' => $this->signingKeySid,
+            'sub' => $this->accountSid,
+            'exp' => $now + $this->ttl,
+            'grants' => $grants
+        );
+
+        if (!is_null($this->nbf)) {
+            $payload['nbf'] = $this->nbf;
+        }
+
+        return JWT::encode($payload, $this->secret, $algorithm, $header);
+    }
+
+    public function __toString() {
+        return $this->toJWT();
+    }
+}

+ 67 - 0
plugins/Twilio/Jwt/Client/ScopeURI.php

@@ -0,0 +1,67 @@
+<?php
+
+
+namespace Twilio\Jwt\Client;
+
+
+/**
+ * Scope URI implementation
+ *
+ * Simple way to represent configurable privileges in an OAuth
+ * friendly way. For our case, they look like this:
+ *
+ * scope:<service>:<privilege>?<params>
+ *
+ * For example:
+ * scope:client:incoming?name=jonas
+ */
+class ScopeURI {
+    public $service;
+    public $privilege;
+    public $params;
+
+    public function __construct($service, $privilege, $params = array()) {
+        $this->service = $service;
+        $this->privilege = $privilege;
+        $this->params = $params;
+    }
+
+    public function toString() {
+        $uri = "scope:{$this->service}:{$this->privilege}";
+        if (count($this->params)) {
+            $uri .= "?" . http_build_query($this->params, '', '&');
+        }
+        return $uri;
+    }
+
+    /**
+     * Parse a scope URI into a ScopeURI object
+     *
+     * @param string $uri The scope URI
+     * @return ScopeURI The parsed scope uri
+     * @throws \UnexpectedValueException
+     */
+    public static function parse($uri) {
+        if (strpos($uri, 'scope:') !== 0) {
+            throw new \UnexpectedValueException(
+                'Not a scope URI according to scheme');
+        }
+
+        $parts = explode('?', $uri, 1);
+        $params = null;
+
+        if (count($parts) > 1) {
+            parse_str($parts[1], $params);
+        }
+
+        $parts = explode(':', $parts[0], 2);
+
+        if (count($parts) != 3) {
+            throw new \UnexpectedValueException(
+                'Not enough parts for scope URI');
+        }
+
+        list($scheme, $service, $privilege) = $parts;
+        return new ScopeURI($service, $privilege, $params);
+    }
+}

+ 115 - 0
plugins/Twilio/Jwt/ClientToken.php

@@ -0,0 +1,115 @@
+<?php
+
+
+namespace Twilio\Jwt;
+
+use Twilio\Jwt\Client\ScopeURI;
+
+/**
+ * Twilio Capability Token generator
+ */
+class ClientToken {
+    public $accountSid;
+    public $authToken;
+    /** @var ScopeURI[] $scopes */
+    public $scopes;
+
+    /**
+     * Create a new TwilioCapability with zero permissions. Next steps are to
+     * grant access to resources by configuring this token through the
+     * functions allowXXXX.
+     *
+     * @param string $accountSid the account sid to which this token is granted
+     *        access
+     * @param string $authToken the secret key used to sign the token. Note,
+     *        this auth token is not visible to the user of the token.
+     */
+    public function __construct($accountSid, $authToken) {
+        $this->accountSid = $accountSid;
+        $this->authToken = $authToken;
+        $this->scopes = array();
+        $this->clientName = false;
+    }
+
+    /**
+     * If the user of this token should be allowed to accept incoming
+     * connections then configure the TwilioCapability through this method and
+     * specify the client name.
+     *
+     * @param $clientName
+     * @throws \InvalidArgumentException
+     */
+    public function allowClientIncoming($clientName) {
+
+        // clientName must be a non-zero length alphanumeric string
+        if (preg_match('/\W/', $clientName)) {
+            throw new \InvalidArgumentException(
+                'Only alphanumeric characters allowed in client name.');
+        }
+
+        if (strlen($clientName) == 0) {
+            throw new \InvalidArgumentException(
+                'Client name must not be a zero length string.');
+        }
+
+        $this->clientName = $clientName;
+        $this->allow('client', 'incoming',
+            array('clientName' => $clientName));
+    }
+
+    /**
+     * Allow the user of this token to make outgoing connections.
+     *
+     * @param string $appSid the application to which this token grants access
+     * @param mixed[] $appParams signed parameters that the user of this token
+     *        cannot overwrite.
+     */
+    public function allowClientOutgoing($appSid, array $appParams = array()) {
+        $this->allow('client', 'outgoing', array(
+            'appSid' => $appSid,
+            'appParams' => http_build_query($appParams, '', '&')));
+    }
+
+    /**
+     * Allow the user of this token to access their event stream.
+     *
+     * @param mixed[] $filters key/value filters to apply to the event stream
+     */
+    public function allowEventStream(array $filters = array()) {
+        $this->allow('stream', 'subscribe', array(
+            'path' => '/2010-04-01/Events',
+            'params' => http_build_query($filters, '', '&'),
+        ));
+    }
+
+    /**
+     * Generates a new token based on the credentials and permissions that
+     * previously has been granted to this token.
+     *
+     * @param int $ttl the expiration time of the token (in seconds). Default
+     *        value is 3600 (1hr)
+     * @return ClientToken the newly generated token that is valid for $ttl
+     *         seconds
+     */
+    public function generateToken($ttl = 3600) {
+        $payload = array(
+            'scope' => array(),
+            'iss' => $this->accountSid,
+            'exp' => time() + $ttl,
+        );
+        $scopeStrings = array();
+
+        foreach ($this->scopes as $scope) {
+            if ($scope->privilege == "outgoing" && $this->clientName)
+                $scope->params["clientName"] = $this->clientName;
+            $scopeStrings[] = $scope->toString();
+        }
+
+        $payload['scope'] = implode(' ', $scopeStrings);
+        return JWT::encode($payload, $this->authToken, 'HS256');
+    }
+
+    protected function allow($service, $privilege, $params) {
+        $this->scopes[] = new ScopeURI($service, $privilege, $params);
+    }
+}

+ 128 - 0
plugins/Twilio/Jwt/Grants/ChatGrant.php

@@ -0,0 +1,128 @@
+<?php
+
+
+namespace Twilio\Jwt\Grants;
+
+
+class ChatGrant implements Grant {
+    private $serviceSid;
+    private $endpointId;
+    private $deploymentRoleSid;
+    private $pushCredentialSid;
+
+    /**
+     * Returns the service sid
+     *
+     * @return string the service sid
+     */
+    public function getServiceSid() {
+        return $this->serviceSid;
+    }
+
+    /**
+     * Set the service sid of this grant
+     *
+     * @param string $serviceSid service sid of the grant
+     *
+     * @return $this updated grant
+     */
+    public function setServiceSid($serviceSid) {
+        $this->serviceSid = $serviceSid;
+        return $this;
+    }
+
+    /**
+     * Returns the endpoint id of the grant
+     *
+     * @return string the endpoint id
+     */
+    public function getEndpointId() {
+        return $this->endpointId;
+    }
+
+    /**
+     * Set the endpoint id of the grant
+     *
+     * @param string $endpointId endpoint id of the grant
+     *
+     * @return $this updated grant
+     */
+    public function setEndpointId($endpointId) {
+        $this->endpointId = $endpointId;
+        return $this;
+    }
+
+    /**
+     * Returns the deployment role sid of the grant
+     *
+     * @return string the deployment role sid
+     */
+    public function getDeploymentRoleSid() {
+        return $this->deploymentRoleSid;
+    }
+
+    /**
+     * Set the role sid of the grant
+     *
+     * @param string $deploymentRoleSid role sid of the grant
+     *
+     * @return $this updated grant
+     */
+    public function setDeploymentRoleSid($deploymentRoleSid) {
+        $this->deploymentRoleSid = $deploymentRoleSid;
+        return $this;
+    }
+
+    /**
+     * Returns the push credential sid of the grant
+     *
+     * @return string the push credential sid
+     */
+    public function getPushCredentialSid() {
+        return $this->pushCredentialSid;
+    }
+
+    /**
+     * Set the credential sid of the grant
+     *
+     * @param string $pushCredentialSid push credential sid of the grant
+     *
+     * @return $this updated grant
+     */
+    public function setPushCredentialSid($pushCredentialSid) {
+        $this->pushCredentialSid = $pushCredentialSid;
+        return $this;
+    }
+
+    /**
+     * Returns the grant type
+     *
+     * @return string type of the grant
+     */
+    public function getGrantKey() {
+        return "chat";
+    }
+
+    /**
+     * Returns the grant data
+     *
+     * @return array data of the grant
+     */
+    public function getPayload() {
+        $payload = array();
+        if ($this->serviceSid) {
+            $payload['service_sid'] = $this->serviceSid;
+        }
+        if ($this->endpointId) {
+            $payload['endpoint_id'] = $this->endpointId;
+        }
+        if ($this->deploymentRoleSid) {
+            $payload['deployment_role_sid'] = $this->deploymentRoleSid;
+        }
+        if ($this->pushCredentialSid) {
+            $payload['push_credential_sid'] = $this->pushCredentialSid;
+        }
+
+        return $payload;
+    }
+}

+ 55 - 0
plugins/Twilio/Jwt/Grants/ConversationsGrant.php

@@ -0,0 +1,55 @@
+<?php
+
+
+namespace Twilio\Jwt\Grants;
+
+
+class ConversationsGrant implements Grant {
+    private $configurationProfileSid;
+
+    public function __construct() {
+        trigger_error("ConversationsGrant is deprecated, please use VideoGrant", E_USER_NOTICE);
+    }
+
+    /**
+     * Returns the configuration profile sid
+     *
+     * @return string the configuration profile sid
+     */
+    public function getConfigurationProfileSid() {
+        return $this->configurationProfileSid;
+    }
+
+    /**
+     * @param string $configurationProfileSid the configuration profile sid
+     * we want to enable for this grant
+     *
+     * @return $this updated grant
+     */
+    public function setConfigurationProfileSid($configurationProfileSid) {
+        $this->configurationProfileSid = $configurationProfileSid;
+        return $this;
+    }
+
+    /**
+     * Returns the grant type
+     *
+     * @return string type of the grant
+     */
+    public function getGrantKey() {
+        return "rtc";
+    }
+
+    /**
+     * Returns the grant data
+     *
+     * @return array data of the grant
+     */
+    public function getPayload() {
+        $payload = array();
+        if ($this->configurationProfileSid) {
+            $payload['configuration_profile_sid'] = $this->configurationProfileSid;
+        }
+        return $payload;
+    }
+}

+ 21 - 0
plugins/Twilio/Jwt/Grants/Grant.php

@@ -0,0 +1,21 @@
+<?php
+
+
+namespace Twilio\Jwt\Grants;
+
+
+interface Grant {
+    /**
+     * Returns the grant type
+     *
+     * @return string type of the grant
+     */
+    public function getGrantKey();
+
+    /**
+     * Returns the grant data
+     *
+     * @return array data of the grant
+     */
+    public function getPayload();
+}

+ 132 - 0
plugins/Twilio/Jwt/Grants/IpMessagingGrant.php

@@ -0,0 +1,132 @@
+<?php
+
+
+namespace Twilio\Jwt\Grants;
+
+
+class IpMessagingGrant implements Grant {
+    private $serviceSid;
+    private $endpointId;
+    private $deploymentRoleSid;
+    private $pushCredentialSid;
+
+    public function __construct() {
+        trigger_error("IpMessagingGrant is deprecated, please use ChatGrant", E_USER_NOTICE);
+    }
+
+    /**
+     * Returns the service sid
+     *
+     * @return string the service sid
+     */
+    public function getServiceSid() {
+        return $this->serviceSid;
+    }
+
+    /**
+     * Set the service sid of this grant
+     *
+     * @param string $serviceSid service sid of the grant
+     *
+     * @return $this updated grant
+     */
+    public function setServiceSid($serviceSid) {
+        $this->serviceSid = $serviceSid;
+        return $this;
+    }
+
+    /**
+     * Returns the endpoint id of the grant
+     *
+     * @return string the endpoint id
+     */
+    public function getEndpointId() {
+        return $this->endpointId;
+    }
+
+    /**
+     * Set the endpoint id of the grant
+     *
+     * @param string $endpointId endpoint id of the grant
+     *
+     * @return $this updated grant
+     */
+    public function setEndpointId($endpointId) {
+        $this->endpointId = $endpointId;
+        return $this;
+    }
+
+    /**
+     * Returns the deployment role sid of the grant
+     *
+     * @return string the deployment role sid
+     */
+    public function getDeploymentRoleSid() {
+        return $this->deploymentRoleSid;
+    }
+
+    /**
+     * Set the role sid of the grant
+     *
+     * @param string $deploymentRoleSid role sid of the grant
+     *
+     * @return $this updated grant
+     */
+    public function setDeploymentRoleSid($deploymentRoleSid) {
+        $this->deploymentRoleSid = $deploymentRoleSid;
+        return $this;
+    }
+
+    /**
+     * Returns the push credential sid of the grant
+     *
+     * @return string the push credential sid
+     */
+    public function getPushCredentialSid() {
+        return $this->pushCredentialSid;
+    }
+
+    /**
+     * Set the credential sid of the grant
+     *
+     * @param string $pushCredentialSid push credential sid of the grant
+     *
+     * @return $this updated grant
+     */
+    public function setPushCredentialSid($pushCredentialSid) {
+        $this->pushCredentialSid = $pushCredentialSid;
+        return $this;
+    }
+
+    /**
+     * Returns the grant type
+     *
+     * @return string type of the grant
+     */
+    public function getGrantKey() {
+        return "ip_messaging";
+    }
+
+    /**
+     * Returns the grant data
+     *
+     * @return array data of the grant
+     */
+    public function getPayload() {
+        $payload = array();
+        if ($this->serviceSid) {
+            $payload['service_sid'] = $this->serviceSid;
+        }
+        if ($this->endpointId) {
+            $payload['endpoint_id'] = $this->endpointId;
+        }
+        if ($this->deploymentRoleSid) {
+            $payload['deployment_role_sid'] = $this->deploymentRoleSid;
+        }
+        if ($this->pushCredentialSid) {
+            $payload['push_credential_sid'] = $this->pushCredentialSid;
+        }
+
+        return $payload;
+    }
+}

+ 138 - 0
plugins/Twilio/Jwt/Grants/SyncGrant.php

@@ -0,0 +1,138 @@
+<?php
+
+namespace Twilio\Jwt\Grants;
+
+class SyncGrant implements Grant
+{
+    private $serviceSid;
+    private $endpointId;
+    private $deploymentRoleSid;
+    private $pushCredentialSid;
+
+    /**
+     * Returns the service sid
+     *
+     * @return string the service sid
+     */
+    public function getServiceSid()
+    {
+        return $this->serviceSid;
+    }
+
+    /**
+     * Set the service sid of this grant
+     *
+     * @param string $serviceSid service sid of the grant
+     *
+     * @return Services_Twilio_Auth_SyncGrant updated grant
+     */
+    public function setServiceSid($serviceSid)
+    {
+        $this->serviceSid = $serviceSid;
+        return $this;
+    }
+
+    /**
+     * Returns the endpoint id of the grant
+     *
+     * @return string the endpoint id
+     */
+    public function getEndpointId()
+    {
+        return $this->endpointId;
+    }
+
+    /**
+     * Set the endpoint id of the grant
+     *
+     * @param string $endpointId endpoint id of the grant
+     *
+     * @return Services_Twilio_Auth_SyncGrant updated grant
+     */
+    public function setEndpointId($endpointId)
+    {
+        $this->endpointId = $endpointId;
+        return $this;
+    }
+
+    /**
+     * Returns the deployment role sid of the grant
+     *
+     * @return string the deployment role sid
+     */
+    public function getDeploymentRoleSid()
+    {
+        return $this->deploymentRoleSid;
+    }
+
+    /**
+     * Set the role sid of the grant
+     *
+     * @param string $deploymentRoleSid role sid of the grant
+     *
+     * @return Services_Twilio_Auth_SyncGrant updated grant
+     */
+    public function setDeploymentRoleSid($deploymentRoleSid)
+    {
+        $this->deploymentRoleSid = $deploymentRoleSid;
+        return $this;
+    }
+
+    /**
+     * Returns the push credential sid of the grant
+     *
+     * @return string the push credential sid
+     */
+    public function getPushCredentialSid()
+    {
+        return $this->pushCredentialSid;
+    }
+
+    /**
+     * Set the credential sid of the grant
+     *
+     * @param string $pushCredentialSid push credential sid of the grant
+     *
+     * @return Services_Twilio_Auth_SyncGrant updated grant
+     */
+    public function setPushCredentialSid($pushCredentialSid)
+    {
+        $this->pushCredentialSid = $pushCredentialSid;
+        return $this;
+    }
+
+    /**
+     * Returns the grant type
+     *
+     * @return string type of the grant
+     */
+    public function getGrantKey()
+    {
+        return "data_sync";
+    }
+
+    /**
+     * Returns the grant data
+     *
+     * @return array data of the grant
+     */
+    public function getPayload()
+    {
+        $payload = array();
+        if ($this->serviceSid) {
+            $payload['service_sid'] = $this->serviceSid;
+        }
+        if ($this->endpointId) {
+            $payload['endpoint_id'] = $this->endpointId;
+        }
+        if ($this->deploymentRoleSid) {
+            $payload['deployment_role_sid'] = $this->deploymentRoleSid;
+        }
+        if ($this->pushCredentialSid) {
+            $payload['push_credential_sid'] = $this->pushCredentialSid;
+        }
+
+        return $payload;
+    }
+
+}

+ 110 - 0
plugins/Twilio/Jwt/Grants/TaskRouterGrant.php

@@ -0,0 +1,110 @@
+<?php
+
+namespace Twilio\Jwt\Grants;
+
+class TaskRouterGrant implements Grant {
+    private $workspaceSid;
+    private $workerSid;
+    private $role;
+
+    /**
+     * Returns the workspace sid
+     *
+     * @return string the workspace sid
+     */
+    public function getWorkspaceSid()
+    {
+        return $this->workspaceSid;
+    }
+
+    /**
+     * Set the workspace sid of this grant
+     *
+     * @param string $workspaceSid workspace sid of the grant
+     *
+     * @return Services_Twilio_Auth_TaskRouterGrant updated grant
+     */
+    public function setWorkspaceSid($workspaceSid)
+    {
+        $this->workspaceSid = $workspaceSid;
+        return $this;
+    }
+
+    /**
+     * Returns the worker sid
+     *
+     * @return string the worker sid
+     */
+    public function getWorkerSid()
+    {
+        return $this->workerSid;
+    }
+
+    /**
+     * Set the worker sid of this grant
+     *
+     * @param string $worker worker sid of the grant
+     *
+     * @return Services_Twilio_Auth_TaskRouterGrant updated grant
+     */
+    public function setWorkerSid($workerSid)
+    {
+        $this->workerSid = $workerSid;
+        return $this;
+    }
+
+    /**
+     * Returns the role
+     *
+     * @return string the role
+     */
+    public function getRole()
+    {
+        return $this->role;
+    }
+
+    /**
+     * Set the role of this grant
+     *
+     * @param string $role role of the grant
+     *
+     * @return Services_Twilio_Auth_TaskRouterGrant updated grant
+     */
+    public function setRole($role)
+    {
+        $this->role = $role;
+        return $this;
+    }
+
+    /**
+     * Returns the grant type
+     *
+     * @return string type of the grant
+     */
+    public function getGrantKey()
+    {
+        return "task_router";
+    }
+
+    /**
+     * Returns the grant data
+     *
+     * @return array data of the grant
+     */
+    public function getPayload()
+    {
+        $payload = array();
+        if ($this->workspaceSid) {
+            $payload['workspace_sid'] = $this->workspaceSid;
+        }
+        if ($this->workerSid) {
+            $payload['worker_sid'] = $this->workerSid;
+        }
+        if ($this->role) {
+            $payload['role'] = $this->role;
+        }
+
+        return $payload;
+    }
+
+}

+ 80 - 0
plugins/Twilio/Jwt/Grants/VideoGrant.php

@@ -0,0 +1,80 @@
+<?php
+
+
+namespace Twilio\Jwt\Grants;
+
+
+class VideoGrant implements Grant {
+
+    private $configurationProfileSid;
+    private $room;
+
+    /**
+     * Returns the configuration profile sid
+     *
+     * @return string the configuration profile sid
+     */
+    public function getConfigurationProfileSid() {
+        return $this->configurationProfileSid;
+    }
+
+    /**
+     * Set the configuration profile sid of the grant
+     * @deprecated in favor of setRoom/getRoom
+     *
+     * @param string $configurationProfileSid configuration profile sid of grant
+     *
+     * @return $this updated grant
+     */
+    public function setConfigurationProfileSid($configurationProfileSid) {
+        trigger_error('Configuration profile sid is deprecated, use room instead.', E_USER_NOTICE);
+        $this->configurationProfileSid = $configurationProfileSid;
+        return $this;
+    }
+
+    /**
+     * Returns the room
+     *
+     * @return string room name or sid set in this grant
+     */
+    public function getRoom() {
+        return $this->room;
+    }
+
+    /**
+     * Set the room to allow access to in the grant
+     *
+     * @param string $roomSidOrName room sid or name
+     * @return $this updated grant
+     */
+    public function setRoom($roomSidOrName) {
+        $this->room = $roomSidOrName;
+        return $this;
+    }
+
+    /**
+     * Returns the grant type
+     *
+     * @return string type of the grant
+     */
+    public function getGrantKey() {
+        return "video";
+    }
+
+    /**
+     * Returns the grant data
+     *
+     * @return array data of the grant
+     */
+    public function getPayload() {
+        $payload = array();
+        if ($this->configurationProfileSid) {
+            $payload['configuration_profile_sid'] = $this->configurationProfileSid;
+        }
+        if ($this->room) {
+            $payload['room'] = $this->room;
+        }
+        return $payload;
+    }
+
+}

+ 148 - 0
plugins/Twilio/Jwt/Grants/VoiceGrant.php

@@ -0,0 +1,148 @@
+<?php
+
+
+namespace Twilio\Jwt\Grants;
+
+
+class VoiceGrant implements Grant {
+
+    private $outgoingApplicationSid;
+    private $outgoingApplicationParams;
+    private $pushCredentialSid;
+    private $endpointId;
+
+    /**
+     * Returns the outgoing application sid
+     *
+     * @return string the outgoing application sid
+     */
+    public function getOutgoingApplicationSid()
+    {
+        return $this->outgoingApplicationSid;
+    }
+
+    /**
+     * Set the outgoing application sid of the grant
+     *
+     * @param string $outgoingApplicationSid outgoing application sid of grant
+     *
+     * @return $this updated grant
+     */
+    public function setOutgoingApplicationSid($outgoingApplicationSid)
+    {
+        $this->outgoingApplicationSid = $outgoingApplicationSid;
+        return $this;
+    }
+
+    /**
+     * Returns the outgoing application params
+     *
+     * @return array the outgoing application params
+     */
+    public function getOutgoingApplicationParams()
+    {
+        return $this->outgoingApplicationParams;
+    }
+
+    /**
+     * Set the outgoing application of the the grant
+     *
+     * @param string $sid outgoing application sid of the grant
+     * @param string $params params to pass the the application
+     *
+     * @return $this updated grant
+     */
+    public function setOutgoingApplication($sid, $params) {
+        $this->outgoingApplicationSid = $sid;
+        $this->outgoingApplicationParams = $params;
+        return $this;
+    }
+
+    /**
+     * Returns the push credential sid
+     *
+     * @return string the push credential sid
+     */
+    public function getPushCredentialSid()
+    {
+        return $this->pushCredentialSid;
+    }
+
+    /**
+     * Set the push credential sid
+     *
+     * @param string $pushCredentialSid
+     *
+     * @return $this updated grant
+     */
+    public function setPushCredentialSid($pushCredentialSid)
+    {
+        $this->pushCredentialSid = $pushCredentialSid;
+        return $this;
+    }
+
+    /**
+     * Returns the endpoint id
+     *
+     * @return string the endpoint id
+     */
+    public function getEndpointId()
+    {
+        return $this->endpointId;
+    }
+
+    /**
+     * Set the endpoint id
+     *
+     * @param string $endpointId endpoint id
+     *
+     * @return $this updated grant
+     */
+    public function setEndpointId($endpointId)
+    {
+        $this->endpointId = $endpointId;
+        return $this;
+    }
+
+    /**
+     * Returns the grant type
+     *
+     * @return string type of the grant
+     */
+    public function getGrantKey()
+    {
+        return "voice";
+    }
+
+    /**
+     * Returns the grant data
+     *
+     * @return array data of the grant
+     */
+    public function getPayload()
+    {
+        $payload = array();
+        if ($this->outgoingApplicationSid) {
+            $outgoing = array();
+            $outgoing['application_sid'] = $this->outgoingApplicationSid;
+
+            if ($this->outgoingApplicationParams) {
+                $outgoing['params'] = $this->outgoingApplicationParams;
+            }
+
+            $payload['outgoing'] = $outgoing;
+        }
+
+        if ($this->pushCredentialSid) {
+            $payload['push_credential_sid'] = $this->pushCredentialSid;
+        }
+
+        if ($this->endpointId) {
+            $payload['endpoint_id'] = $this->endpointId;
+        }
+
+        return $payload;
+    }
+
+
+}

+ 156 - 0
plugins/Twilio/Jwt/JWT.php

@@ -0,0 +1,156 @@
+<?php
+
+namespace Twilio\Jwt;
+
+/**
+ * JSON Web Token implementation
+ *
+ * Minimum implementation used by Realtime auth, based on this spec:
+ * http://self-issued.info/docs/draft-jones-json-web-token-01.html.
+ *
+ * @author Neuman Vong <neuman@twilio.com>
+ */
+class JWT {
+    /**
+     * @param string $jwt The JWT
+     * @param string|null $key The secret key
+     * @param bool $verify Don't skip verification process
+     * @return object The JWT's payload as a PHP object
+     * @throws \DomainException
+     * @throws \UnexpectedValueException
+     */
+    public static function decode($jwt, $key = null, $verify = true) {
+        $tks = explode('.', $jwt);
+        if (count($tks) != 3) {
+            throw new \UnexpectedValueException('Wrong number of segments');
+        }
+        list($headb64, $payloadb64, $cryptob64) = $tks;
+        if (null === ($header = self::jsonDecode(self::urlsafeB64Decode($headb64)))
+        ) {
+            throw new \UnexpectedValueException('Invalid segment encoding');
+        }
+        if (null === $payload = self::jsonDecode(self::urlsafeB64Decode($payloadb64))
+        ) {
+            throw new \UnexpectedValueException('Invalid segment encoding');
+        }
+        $sig = self::urlsafeB64Decode($cryptob64);
+        if ($verify) {
+            if (empty($header->alg)) {
+                throw new \DomainException('Empty algorithm');
+            }
+            if ($sig != self::sign("$headb64.$payloadb64", $key, $header->alg)) {
+                throw new \UnexpectedValueException('Signature verification failed');
+            }
+        }
+        return $payload;
+    }
+
+    /**
+     * @param object|array $payload PHP object or array
+     * @param string $key The secret key
+     * @param string $algo The signing algorithm
+     * @param array $additionalHeaders Additional keys/values to add to the header
+     *
+     * @return string A JWT
+     */
+    public static function encode($payload, $key, $algo = 'HS256', $additionalHeaders = array()) {
+        $header = array('typ' => 'JWT', 'alg' => $algo);
+        $header = $header + $additionalHeaders;
+
+        $segments = array();
+        $segments[] = self::urlsafeB64Encode(self::jsonEncode($header));
+        $segments[] = self::urlsafeB64Encode(self::jsonEncode($payload));
+        $signing_input = implode('.', $segments);
+
+        $signature = self::sign($signing_input, $key, $algo);
+        $segments[] = self::urlsafeB64Encode($signature);
+
+        return implode('.', $segments);
+    }
+
+    /**
+     * @param string $msg The message to sign
+     * @param string $key The secret key
+     * @param string $method The signing algorithm
+     * @return string An encrypted message
+     * @throws \DomainException
+     */
+    public static function sign($msg, $key, $method = 'HS256') {
+        $methods = array(
+            'HS256' => 'sha256',
+            'HS384' => 'sha384',
+            'HS512' => 'sha512',
+        );
+        if (empty($methods[$method])) {
+            throw new \DomainException('Algorithm not supported');
+        }
+        return hash_hmac($methods[$method], $msg, $key, true);
+    }
+
+    /**
+     * @param string $input JSON string
+     * @return object Object representation of JSON string
+     * @throws \DomainException
+     */
+    public static function jsonDecode($input) {
+        $obj = json_decode($input);
+        if (function_exists('json_last_error') && $errno = json_last_error()) {
+            self::handleJsonError($errno);
+        } else if ($obj === null && $input !== 'null') {
+            throw new \DomainException('Null result with non-null input');
+        }
+        return $obj;
+    }
+
+    /**
+     * @param object|array $input A PHP object or array
+     * @return string JSON representation of the PHP object or array
+     * @throws \DomainException
+     */
+    public static function jsonEncode($input) {
+        $json = json_encode($input);
+        if (function_exists('json_last_error') && $errno = json_last_error()) {
+            self::handleJsonError($errno);
+        } else if ($json === 'null' && $input !== null) {
+            throw new \DomainException('Null result with non-null input');
+        }
+        return $json;
+    }
+
+    /**
+     * @param string $input A base64 encoded string
+     *
+     * @return string A decoded string
+     */
+    public static function urlsafeB64Decode($input) {
+        $padlen = 4 - strlen($input) % 4;
+        $input .= str_repeat('=', $padlen);
+        return base64_decode(strtr($input, '-_', '+/'));
+    }
+
+    /**
+     * @param string $input Anything really
+     *
+     * @return string The base64 encode of what you passed in
+     */
+    public static function urlsafeB64Encode($input) {
+        return str_replace('=', '', strtr(base64_encode($input), '+/', '-_'));
+    }
+
+    /**
+     * @param int $errno An error number from json_last_error()
+     *
+     * @throws \DomainException
+     */
+    private static function handleJsonError($errno) {
+        $messages = array(
+            JSON_ERROR_DEPTH => 'Maximum stack depth exceeded',
+            JSON_ERROR_CTRL_CHAR => 'Unexpected control character found',
+            JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON'
+        );
+        throw new \DomainException(isset($messages[$errno])
+            ? $messages[$errno]
+            : 'Unknown JSON error: ' . $errno
+        );
+    }
+}

+ 160 - 0
plugins/Twilio/Jwt/TaskRouter/CapabilityToken.php

@@ -0,0 +1,160 @@
+<?php
+
+
+namespace Twilio\Jwt\TaskRouter;
+use Twilio\Jwt\JWT;
+
+
+/**
+ * Twilio TaskRouter Capability assigner
+ *
+ * @author Justin Witz <justin.witz@twilio.com>
+ * @license  http://creativecommons.org/licenses/MIT/ MIT
+ */
+class CapabilityToken {
+    protected $accountSid;
+    protected $authToken;
+    private $friendlyName;
+    /** @var Policy[] $policies */
+    private $policies;
+
+    protected $baseUrl = 'https://taskrouter.twilio.com/v1';
+    protected $baseWsUrl = 'https://event-bridge.twilio.com/v1/wschannels';
+    protected $version = 'v1';
+
+    protected $workspaceSid;
+    protected $channelId;
+    protected $resourceUrl;
+
+    protected $required = array("required" => true);
+    protected $optional = array("required" => false);
+
+    public function __construct($accountSid, $authToken, $workspaceSid, $channelId, $resourceUrl = null, $overrideBaseUrl = null, $overrideBaseWSUrl = null) {
+        $this->accountSid = $accountSid;
+        $this->authToken = $authToken;
+        $this->friendlyName = $channelId;
+        $this->policies = array();
+
+        $this->workspaceSid = $workspaceSid;
+        $this->channelId = $channelId;
+        if (isset($overrideBaseUrl)) {
+            $this->baseUrl = $overrideBaseUrl;
+        }
+        if (isset($overrideBaseWSUrl)) {
+            $this->baseWsUrl = $overrideBaseWSUrl;
+        }
+        $this->baseUrl = $this->baseUrl . '/Workspaces/' . $workspaceSid;
+
+        $this->validateJWT();
+
+        if (!isset($resourceUrl)) {
+            $this->setupResource();
+        }
+
+        //add permissions to GET and POST to the event-bridge channel
+        $this->allow($this->baseWsUrl . "/" . $this->accountSid . "/" . $this->channelId, "GET", null, null);
+        $this->allow($this->baseWsUrl . "/" . $this->accountSid . "/" . $this->channelId, "POST", null, null);
+
+        //add permissions to fetch the instance resource
+        $this->allow($this->resourceUrl, "GET", null, null);
+    }
+
+    protected function setupResource() {
+
+    }
+
+    public function addPolicyDeconstructed($url, $method, $queryFilter = array(), $postFilter = array(), $allow = true) {
+        $policy = new Policy($url, $method, $queryFilter, $postFilter, $allow);
+        array_push($this->policies, $policy);
+        return $policy;
+    }
+
+    public function allow($url, $method, $queryFilter = array(), $postFilter = array()) {
+        $this->addPolicyDeconstructed($url, $method, $queryFilter, $postFilter, true);
+    }
+
+    public function deny($url, $method, $queryFilter = array(), $postFilter = array()) {
+        $this->addPolicyDeconstructed($url, $method, $queryFilter, $postFilter, false);
+    }
+
+    private function validateJWT() {
+        if (!isset($this->accountSid) || substr($this->accountSid, 0, 2) != 'AC') {
+            throw new \Exception("Invalid AccountSid provided: " . $this->accountSid);
+        }
+        if (!isset($this->workspaceSid) || substr($this->workspaceSid, 0, 2) != 'WS') {
+            throw new \Exception("Invalid WorkspaceSid provided: " . $this->workspaceSid);
+        }
+        if (!isset($this->channelId)) {
+            throw new \Exception("ChannelId not provided");
+        }
+        $prefix = substr($this->channelId, 0, 2);
+        if ($prefix != 'WS' && $prefix != 'WK' && $prefix != 'WQ') {
+            throw new \Exception("Invalid ChannelId provided: " . $this->channelId);
+        }
+    }
+
+    public function allowFetchSubresources() {
+        $method = 'GET';
+        $queryFilter = array();
+        $postFilter = array();
+        $this->allow($this->resourceUrl . '/**', $method, $queryFilter, $postFilter);
+    }
+
+    public function allowUpdates() {
+        $method = 'POST';
+        $queryFilter = array();
+        $postFilter = array();
+        $this->allow($this->resourceUrl, $method, $queryFilter, $postFilter);
+    }
+
+    public function allowUpdatesSubresources() {
+        $method = 'POST';
+        $queryFilter = array();
+        $postFilter = array();
+        $this->allow($this->resourceUrl . '/**', $method, $queryFilter, $postFilter);
+    }
+
+    public function allowDelete() {
+        $method = 'DELETE';
+        $queryFilter = array();
+        $postFilter = array();
+        $this->allow($this->resourceUrl, $method, $queryFilter, $postFilter);
+    }
+
+    public function allowDeleteSubresources() {
+        $method = 'DELETE';
+        $queryFilter = array();
+        $postFilter = array();
+        $this->allow($this->resourceUrl . '/**', $method, $queryFilter, $postFilter);
+    }
+
+    public function generateToken($ttl = 3600, $extraAttributes = array()) {
+        $payload = array(
+            'version' => $this->version,
+            'friendly_name' => $this->friendlyName,
+            'iss' => $this->accountSid,
+            'exp' => time() + $ttl,
+            'account_sid' => $this->accountSid,
+            'channel' => $this->channelId,
+            'workspace_sid' => $this->workspaceSid
+        );
+
+        if (substr($this->channelId, 0, 2) == 'WK') {
+            $payload['worker_sid'] = $this->channelId;
+        } else if (substr($this->channelId, 0, 2) == 'WQ') {
+            $payload['taskqueue_sid'] = $this->channelId;
+        }
+
+        foreach ($extraAttributes as $key => $value) {
+            $payload[$key] = $value;
+        }
+
+        $policyStrings = array();
+        foreach ($this->policies as $policy) {
+            $policyStrings[] = $policy->toArray();
+        }
+
+        $payload['policies'] = $policyStrings;
+        return JWT::encode($payload, $this->authToken, 'HS256');
+    }
+}

+ 54 - 0
plugins/Twilio/Jwt/TaskRouter/Policy.php

@@ -0,0 +1,54 @@
+<?php
+
+
+namespace Twilio\Jwt\TaskRouter;
+
+
+/**
+ * Twilio API Policy constructor
+ *
+ * @author Justin Witz <justin.witz@twilio.com>
+ * @license  http://creativecommons.org/licenses/MIT/ MIT
+ */
+class Policy {
+    private $url;
+    private $method;
+    private $queryFilter;
+    private $postFilter;
+    private $allow;
+
+    public function __construct($url, $method, $queryFilter = array(), $postFilter = array(), $allow = true) {
+        $this->url = $url;
+        $this->method = $method;
+        $this->queryFilter = $queryFilter;
+        $this->postFilter = $postFilter;
+        $this->allow = $allow;
+    }
+
+    public function addQueryFilter($queryFilter) {
+        array_push($this->queryFilter, $queryFilter);
+    }
+
+    public function addPostFilter($postFilter) {
+        array_push($this->postFilter, $postFilter);
+    }
+
+    public function toArray() {
+        $policy_array = array('url' => $this->url, 'method' => $this->method, 'allow' => $this->allow);
+        if (!is_null($this->queryFilter)) {
+            if (count($this->queryFilter) > 0) {
+                $policy_array['query_filter'] = $this->queryFilter;
+            } else {
+                $policy_array['query_filter'] = new \stdClass();
+            }
+        }
+        if (!is_null($this->postFilter)) {
+            if (count($this->postFilter) > 0) {
+                $policy_array['post_filter'] = $this->postFilter;
+            } else {
+                $policy_array['post_filter'] = new \stdClass();
+            }
+        }
+        return $policy_array;
+    }
+}

+ 20 - 0
plugins/Twilio/Jwt/TaskRouter/TaskQueueCapability.php

@@ -0,0 +1,20 @@
+<?php
+
+
+namespace Twilio\Jwt\TaskRouter;
+
+/**
+ * Twilio TaskRouter TaskQueue Capability assigner
+ *
+ * @author Justin Witz <justin.witz@twilio.com>
+ * @license  http://creativecommons.org/licenses/MIT/ MIT
+ */
+class TaskQueueCapability extends CapabilityToken {
+    public function __construct($accountSid, $authToken, $workspaceSid, $taskQueueSid, $overrideBaseUrl = null, $overrideBaseWSUrl = null) {
+        parent::__construct($accountSid, $authToken, $workspaceSid, $taskQueueSid, null, $overrideBaseUrl, $overrideBaseWSUrl);
+    }
+
+    protected function setupResource() {
+        $this->resourceUrl = $this->baseUrl . '/TaskQueues/' . $this->channelId;
+    }
+}

+ 48 - 0
plugins/Twilio/Jwt/TaskRouter/WorkerCapability.php

@@ -0,0 +1,48 @@
+<?php
+
+
+namespace Twilio\Jwt\TaskRouter;
+
+/**
+ * Twilio TaskRouter Worker Capability assigner
+ *
+ * @author Justin Witz <justin.witz@twilio.com>
+ * @license  http://creativecommons.org/licenses/MIT/ MIT
+ */
+class WorkerCapability extends CapabilityToken {
+    private $tasksUrl;
+    private $workerReservationsUrl;
+    private $activityUrl;
+
+    public function __construct($accountSid, $authToken, $workspaceSid, $workerSid, $overrideBaseUrl = null, $overrideBaseWSUrl = null) {
+        parent::__construct($accountSid, $authToken, $workspaceSid, $workerSid, null, $overrideBaseUrl, $overrideBaseWSUrl);
+
+        $this->tasksUrl = $this->baseUrl . '/Tasks/**';
+        $this->activityUrl = $this->baseUrl . '/Activities';
+        $this->workerReservationsUrl = $this->resourceUrl . '/Reservations/**';
+
+        //add permissions to fetch the list of activities, tasks, and worker reservations
+        $this->allow($this->activityUrl, "GET", null, null);
+        $this->allow($this->tasksUrl, "GET", null, null);
+        $this->allow($this->workerReservationsUrl, "GET", null, null);
+    }
+
+    protected function setupResource() {
+        $this->resourceUrl = $this->baseUrl . '/Workers/' . $this->channelId;
+    }
+
+    public function allowActivityUpdates() {
+        $method = 'POST';
+        $queryFilter = array();
+        $postFilter = array("ActivitySid" => $this->required);
+        $this->allow($this->resourceUrl, $method, $queryFilter, $postFilter);
+    }
+
+    public function allowReservationUpdates() {
+        $method = 'POST';
+        $queryFilter = array();
+        $postFilter = array();
+        $this->allow($this->tasksUrl, $method, $queryFilter, $postFilter);
+        $this->allow($this->workerReservationsUrl, $method, $queryFilter, $postFilter);
+    }
+}

+ 15 - 0
plugins/Twilio/Jwt/TaskRouter/WorkspaceCapability.php

@@ -0,0 +1,15 @@
+<?php
+
+
+namespace Twilio\Jwt\TaskRouter;
+
+
+class WorkspaceCapability extends CapabilityToken {
+    public function __construct($accountSid, $authToken, $workspaceSid, $overrideBaseUrl = null, $overrideBaseWSUrl = null) {
+        parent::__construct($accountSid, $authToken, $workspaceSid, $workspaceSid, null, $overrideBaseUrl, $overrideBaseWSUrl);
+    }
+
+    protected function setupResource() {
+        $this->resourceUrl = $this->baseUrl;
+    }
+}

+ 19 - 0
plugins/Twilio/ListResource.php

@@ -0,0 +1,19 @@
+<?php
+
+
+namespace Twilio;
+
+
+class ListResource {
+    protected $version;
+    protected $solution = array();
+    protected $uri;
+
+    public function __construct(Version $version) {
+        $this->version = $version;
+    }
+
+    public function __toString() {
+        return '[ListResource]';
+    }
+}

+ 13 - 0
plugins/Twilio/Options.php

@@ -0,0 +1,13 @@
+<?php
+
+
+namespace Twilio;
+
+
+abstract class Options implements \IteratorAggregate {
+    protected $options = array();
+
+    public function getIterator() {
+        return new \ArrayIterator($this->options);
+    }
+}

+ 192 - 0
plugins/Twilio/Page.php

@@ -0,0 +1,192 @@
+<?php
+
+
+namespace Twilio;
+
+
+use Twilio\Exceptions\DeserializeException;
+use Twilio\Exceptions\RestException;
+use Twilio\Http\Response;
+
+abstract class Page implements \Iterator {
+    protected static $metaKeys = array(
+        'end',
+        'first_page_uri',
+        'next_page_uri',
+        'last_page_uri',
+        'page',
+        'page_size',
+        'previous_page_uri',
+        'total',
+        'num_pages',
+        'start',
+        'uri',
+    );
+
+    protected $version;
+    protected $payload;
+    protected $solution;
+    protected $records;
+
+    abstract public function buildInstance(array $payload);
+
+    public function __construct(Version $version, Response $response) {
+        $payload = $this->processResponse($response);
+
+        $this->version = $version;
+        $this->payload = $payload;
+        $this->solution = array();
+        $this->records = new \ArrayIterator($this->loadPage());
+    }
+
+    protected function processResponse(Response $response) {
+        if ($response->getStatusCode() != 200 && !$this->isPagingEol($response->getContent())) {
+            $message = '[HTTP ' . $response->getStatusCode() . '] Unable to fetch page';
+            $code = $response->getStatusCode();
+
+            $content = $response->getContent();
+
+            if (is_array($content)) {
+                $message .= isset($content['message']) ? ': ' . $content['message'] : '';
+                $code = isset($content['code']) ? $content['code'] : $code;
+            }
+
+            throw new RestException($message, $code, $response->getStatusCode());
+        }
+        return $response->getContent();
+    }
+
+    protected function isPagingEol($content) {
+        return !is_null($content) && array_key_exists('code', $content) && $content['code'] == 20006;
+    }
+
+    protected function hasMeta($key) {
+        return array_key_exists('meta', $this->payload) && array_key_exists($key, $this->payload['meta']);
+    }
+
+    protected function getMeta($key, $default = null) {
+        return $this->hasMeta($key) ? $this->payload['meta'][$key] : $default;
+    }
+
+    protected function loadPage() {
+        $key = $this->getMeta('key');
+        if ($key) {
+            return $this->payload[$key];
+        } else {
+            $keys = array_keys($this->payload);
+            $key = array_diff($keys, self::$metaKeys);
+            $key = array_values($key);
+
+            if (count($key) == 1) {
+                return $this->payload[$key[0]];
+            }
+        }
+
+        // handle end of results error code
+        if ($this->isPagingEol($this->payload)) {
+            return array();
+        }
+
+        throw new DeserializeException('Page Records can not be deserialized');
+    }
+
+    public function getPreviousPageUrl() {
+        if ($this->hasMeta('previous_page_url')) {
+            return $this->getMeta('previous_page_url');
+        } else if (array_key_exists('previous_page_uri', $this->payload) && $this->payload['previous_page_uri']) {
+            return $this->getVersion()->getDomain()->absoluteUrl($this->payload['previous_page_uri']);
+        }
+        return null;
+    }
+
+    public function getNextPageUrl() {
+        if ($this->hasMeta('next_page_url')) {
+            return $this->getMeta('next_page_url');
+        } else if (array_key_exists('next_page_uri', $this->payload) && $this->payload['next_page_uri']) {
+            return $this->getVersion()->getDomain()->absoluteUrl($this->payload['next_page_uri']);
+        }
+        return null;
+    }
+
+    public function nextPage() {
+        if (!$this->getNextPageUrl()) {
+            return null;
+        }
+
+        $response = $this->getVersion()->getDomain()->getClient()->request('GET', $this->getNextPageUrl());
+        return new static($this->getVersion(), $response, $this->solution);
+    }
+
+    public function previousPage() {
+        if (!$this->getPreviousPageUrl()) {
+            return null;
+        }
+
+        $response = $this->getVersion()->getDomain()->getClient()->request('GET', $this->getPreviousPageUrl());
+        return new static($this->getVersion(), $response, $this->solution);
+    }
+
+    /**
+     * (PHP 5 &gt;= 5.0.0)<br/>
+     * Return the current element
+     * @link http://php.net/manual/en/iterator.current.php
+     * @return mixed Can return any type.
+     */
+    public function current() {
+        return $this->buildInstance($this->records->current());
+    }
+
+    /**
+     * (PHP 5 &gt;= 5.0.0)<br/>
+     * Move forward to next element
+     * @link http://php.net/manual/en/iterator.next.php
+     * @return void Any returned value is ignored.
+     */
+    public function next() {
+        $this->records->next();
+    }
+
+    /**
+     * (PHP 5 &gt;= 5.0.0)<br/>
+     * Return the key of the current element
+     * @link http://php.net/manual/en/iterator.key.php
+     * @return mixed scalar on success, or null on failure.
+     */
+    public function key() {
+        return $this->records->key();
+    }
+
+    /**
+     * (PHP 5 &gt;= 5.0.0)<br/>
+     * Checks if current position is valid
+     * @link http://php.net/manual/en/iterator.valid.php
+     * @return boolean The return value will be casted to boolean and then evaluated.
+     * Returns true on success or false on failure.
+     */
+    public function valid() {
+        return $this->records->valid();
+    }
+
+    /**
+     * (PHP 5 &gt;= 5.0.0)<br/>
+     * Rewind the Iterator to the first element
+     * @link http://php.net/manual/en/iterator.rewind.php
+     * @return void Any returned value is ignored.
+     */
+    public function rewind() {
+        $this->records->rewind();
+    }
+
+
+    /**
+     * @return Version
+     */
+    public function getVersion() {
+        return $this->version;
+    }
+
+    public function __toString() {
+        return '[Page]';
+    }
+
+}

+ 94 - 0
plugins/Twilio/Rest/Accounts.php

@@ -0,0 +1,94 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest;
+
+use Twilio\Domain;
+use Twilio\Exceptions\TwilioException;
+use Twilio\Rest\Accounts\V1;
+
+/**
+ * @property \Twilio\Rest\Accounts\V1 v1
+ * @property \Twilio\Rest\Accounts\V1\CredentialList credentials
+ */
+class Accounts extends Domain {
+    protected $_v1 = null;
+
+    /**
+     * Construct the Accounts Domain
+     * 
+     * @param \Twilio\Rest\Client $client Twilio\Rest\Client to communicate with
+     *                                    Twilio
+     * @return \Twilio\Rest\Accounts Domain for Accounts
+     */
+    public function __construct(Client $client) {
+        parent::__construct($client);
+
+        $this->baseUrl = 'https://accounts.twilio.com';
+    }
+
+    /**
+     * @return \Twilio\Rest\Accounts\V1 Version v1 of accounts
+     */
+    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\Accounts\V1\CredentialList 
+     */
+    protected function getCredentials() {
+        return $this->v1->credentials;
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        return '[Twilio.Accounts]';
+    }
+}

+ 85 - 0
plugins/Twilio/Rest/Accounts/V1.php

@@ -0,0 +1,85 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Accounts;
+
+use Twilio\Domain;
+use Twilio\Exceptions\TwilioException;
+use Twilio\Rest\Accounts\V1\CredentialList;
+use Twilio\Version;
+
+/**
+ * @property \Twilio\Rest\Accounts\V1\CredentialList credentials
+ */
+class V1 extends Version {
+    protected $_credentials = null;
+
+    /**
+     * Construct the V1 version of Accounts
+     * 
+     * @param \Twilio\Domain $domain Domain that contains the version
+     * @return \Twilio\Rest\Accounts\V1 V1 version of Accounts
+     */
+    public function __construct(Domain $domain) {
+        parent::__construct($domain);
+        $this->version = 'v1';
+    }
+
+    /**
+     * @return \Twilio\Rest\Accounts\V1\CredentialList 
+     */
+    protected function getCredentials() {
+        if (!$this->_credentials) {
+            $this->_credentials = new CredentialList($this);
+        }
+        return $this->_credentials;
+    }
+
+    /**
+     * 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.Accounts.V1]';
+    }
+}

+ 93 - 0
plugins/Twilio/Rest/Accounts/V1/Credential/AwsContext.php

@@ -0,0 +1,93 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Accounts\V1\Credential;
+
+use Twilio\InstanceContext;
+use Twilio\Options;
+use Twilio\Values;
+use Twilio\Version;
+
+class AwsContext extends InstanceContext {
+    /**
+     * Initialize the AwsContext
+     * 
+     * @param \Twilio\Version $version Version that contains the resource
+     * @param string $sid The sid
+     * @return \Twilio\Rest\Accounts\V1\Credential\AwsContext 
+     */
+    public function __construct(Version $version, $sid) {
+        parent::__construct($version);
+
+        // Path Solution
+        $this->solution = array('sid' => $sid, );
+
+        $this->uri = '/Credentials/AWS/' . rawurlencode($sid) . '';
+    }
+
+    /**
+     * Fetch a AwsInstance
+     * 
+     * @return AwsInstance Fetched AwsInstance
+     */
+    public function fetch() {
+        $params = Values::of(array());
+
+        $payload = $this->version->fetch(
+            'GET',
+            $this->uri,
+            $params
+        );
+
+        return new AwsInstance($this->version, $payload, $this->solution['sid']);
+    }
+
+    /**
+     * Update the AwsInstance
+     * 
+     * @param array|Options $options Optional Arguments
+     * @return AwsInstance Updated AwsInstance
+     */
+    public function update($options = array()) {
+        $options = new Values($options);
+
+        $data = Values::of(array('FriendlyName' => $options['friendlyName'], ));
+
+        $payload = $this->version->update(
+            'POST',
+            $this->uri,
+            array(),
+            $data
+        );
+
+        return new AwsInstance($this->version, $payload, $this->solution['sid']);
+    }
+
+    /**
+     * Deletes the AwsInstance
+     * 
+     * @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.Accounts.V1.AwsContext ' . implode(' ', $context) . ']';
+    }
+}

+ 127 - 0
plugins/Twilio/Rest/Accounts/V1/Credential/AwsInstance.php

@@ -0,0 +1,127 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Accounts\V1\Credential;
+
+use Twilio\Deserialize;
+use Twilio\Exceptions\TwilioException;
+use Twilio\InstanceResource;
+use Twilio\Options;
+use Twilio\Values;
+use Twilio\Version;
+
+/**
+ * @property string sid
+ * @property string accountSid
+ * @property string friendlyName
+ * @property \DateTime dateCreated
+ * @property \DateTime dateUpdated
+ * @property string url
+ */
+class AwsInstance extends InstanceResource {
+    /**
+     * Initialize the AwsInstance
+     * 
+     * @param \Twilio\Version $version Version that contains the resource
+     * @param mixed[] $payload The response payload
+     * @param string $sid The sid
+     * @return \Twilio\Rest\Accounts\V1\Credential\AwsInstance 
+     */
+    public function __construct(Version $version, array $payload, $sid = null) {
+        parent::__construct($version);
+
+        // Marshaled Properties
+        $this->properties = array(
+            'sid' => Values::array_get($payload, 'sid'),
+            'accountSid' => Values::array_get($payload, 'account_sid'),
+            'friendlyName' => Values::array_get($payload, 'friendly_name'),
+            'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')),
+            'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')),
+            'url' => Values::array_get($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\Accounts\V1\Credential\AwsContext Context for this
+     *                                                        AwsInstance
+     */
+    protected function proxy() {
+        if (!$this->context) {
+            $this->context = new AwsContext($this->version, $this->solution['sid']);
+        }
+
+        return $this->context;
+    }
+
+    /**
+     * Fetch a AwsInstance
+     * 
+     * @return AwsInstance Fetched AwsInstance
+     */
+    public function fetch() {
+        return $this->proxy()->fetch();
+    }
+
+    /**
+     * Update the AwsInstance
+     * 
+     * @param array|Options $options Optional Arguments
+     * @return AwsInstance Updated AwsInstance
+     */
+    public function update($options = array()) {
+        return $this->proxy()->update($options);
+    }
+
+    /**
+     * Deletes the AwsInstance
+     * 
+     * @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.Accounts.V1.AwsInstance ' . implode(' ', $context) . ']';
+    }
+}

+ 163 - 0
plugins/Twilio/Rest/Accounts/V1/Credential/AwsList.php

@@ -0,0 +1,163 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Accounts\V1\Credential;
+
+use Twilio\ListResource;
+use Twilio\Options;
+use Twilio\Values;
+use Twilio\Version;
+
+class AwsList extends ListResource {
+    /**
+     * Construct the AwsList
+     * 
+     * @param Version $version Version that contains the resource
+     * @return \Twilio\Rest\Accounts\V1\Credential\AwsList 
+     */
+    public function __construct(Version $version) {
+        parent::__construct($version);
+
+        // Path Solution
+        $this->solution = array();
+
+        $this->uri = '/Credentials/AWS';
+    }
+
+    /**
+     * Streams AwsInstance 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 AwsInstance 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 AwsInstance[] Array of results
+     */
+    public function read($limit = null, $pageSize = null) {
+        return iterator_to_array($this->stream($limit, $pageSize), false);
+    }
+
+    /**
+     * Retrieve a single page of AwsInstance 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 AwsInstance
+     */
+    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 AwsPage($this->version, $response, $this->solution);
+    }
+
+    /**
+     * Retrieve a specific page of AwsInstance records from the API.
+     * Request is executed immediately
+     * 
+     * @param string $targetUrl API-generated URL for the requested results page
+     * @return \Twilio\Page Page of AwsInstance
+     */
+    public function getPage($targetUrl) {
+        $response = $this->version->getDomain()->getClient()->request(
+            'GET',
+            $targetUrl
+        );
+
+        return new AwsPage($this->version, $response, $this->solution);
+    }
+
+    /**
+     * Create a new AwsInstance
+     * 
+     * @param string $credentials The credentials
+     * @param array|Options $options Optional Arguments
+     * @return AwsInstance Newly created AwsInstance
+     */
+    public function create($credentials, $options = array()) {
+        $options = new Values($options);
+
+        $data = Values::of(array(
+            'Credentials' => $credentials,
+            'FriendlyName' => $options['friendlyName'],
+            'AccountSid' => $options['accountSid'],
+        ));
+
+        $payload = $this->version->create(
+            'POST',
+            $this->uri,
+            array(),
+            $data
+        );
+
+        return new AwsInstance($this->version, $payload);
+    }
+
+    /**
+     * Constructs a AwsContext
+     * 
+     * @param string $sid The sid
+     * @return \Twilio\Rest\Accounts\V1\Credential\AwsContext 
+     */
+    public function getContext($sid) {
+        return new AwsContext($this->version, $sid);
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        return '[Twilio.Accounts.V1.AwsList]';
+    }
+}

+ 115 - 0
plugins/Twilio/Rest/Accounts/V1/Credential/AwsOptions.php

@@ -0,0 +1,115 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Accounts\V1\Credential;
+
+use Twilio\Options;
+use Twilio\Values;
+
+abstract class AwsOptions {
+    /**
+     * @param string $friendlyName The friendly_name
+     * @param string $accountSid The account_sid
+     * @return CreateAwsOptions Options builder
+     */
+    public static function create($friendlyName = Values::NONE, $accountSid = Values::NONE) {
+        return new CreateAwsOptions($friendlyName, $accountSid);
+    }
+
+    /**
+     * @param string $friendlyName The friendly_name
+     * @return UpdateAwsOptions Options builder
+     */
+    public static function update($friendlyName = Values::NONE) {
+        return new UpdateAwsOptions($friendlyName);
+    }
+}
+
+class CreateAwsOptions extends Options {
+    /**
+     * @param string $friendlyName The friendly_name
+     * @param string $accountSid The account_sid
+     */
+    public function __construct($friendlyName = Values::NONE, $accountSid = Values::NONE) {
+        $this->options['friendlyName'] = $friendlyName;
+        $this->options['accountSid'] = $accountSid;
+    }
+
+    /**
+     * The friendly_name
+     * 
+     * @param string $friendlyName The friendly_name
+     * @return $this Fluent Builder
+     */
+    public function setFriendlyName($friendlyName) {
+        $this->options['friendlyName'] = $friendlyName;
+        return $this;
+    }
+
+    /**
+     * The account_sid
+     * 
+     * @param string $accountSid The account_sid
+     * @return $this Fluent Builder
+     */
+    public function setAccountSid($accountSid) {
+        $this->options['accountSid'] = $accountSid;
+        return $this;
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        $options = array();
+        foreach ($this->options as $key => $value) {
+            if ($value != Values::NONE) {
+                $options[] = "$key=$value";
+            }
+        }
+        return '[Twilio.Accounts.V1.CreateAwsOptions ' . implode(' ', $options) . ']';
+    }
+}
+
+class UpdateAwsOptions extends Options {
+    /**
+     * @param string $friendlyName The friendly_name
+     */
+    public function __construct($friendlyName = Values::NONE) {
+        $this->options['friendlyName'] = $friendlyName;
+    }
+
+    /**
+     * The friendly_name
+     * 
+     * @param string $friendlyName The friendly_name
+     * @return $this Fluent Builder
+     */
+    public function setFriendlyName($friendlyName) {
+        $this->options['friendlyName'] = $friendlyName;
+        return $this;
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        $options = array();
+        foreach ($this->options as $key => $value) {
+            if ($value != Values::NONE) {
+                $options[] = "$key=$value";
+            }
+        }
+        return '[Twilio.Accounts.V1.UpdateAwsOptions ' . implode(' ', $options) . ']';
+    }
+}

+ 34 - 0
plugins/Twilio/Rest/Accounts/V1/Credential/AwsPage.php

@@ -0,0 +1,34 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Accounts\V1\Credential;
+
+use Twilio\Page;
+
+class AwsPage extends Page {
+    public function __construct($version, $response, $solution) {
+        parent::__construct($version, $response);
+
+        // Path Solution
+        $this->solution = $solution;
+    }
+
+    public function buildInstance(array $payload) {
+        return new AwsInstance($this->version, $payload);
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        return '[Twilio.Accounts.V1.AwsPage]';
+    }
+}

+ 93 - 0
plugins/Twilio/Rest/Accounts/V1/Credential/PublicKeyContext.php

@@ -0,0 +1,93 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Accounts\V1\Credential;
+
+use Twilio\InstanceContext;
+use Twilio\Options;
+use Twilio\Values;
+use Twilio\Version;
+
+class PublicKeyContext extends InstanceContext {
+    /**
+     * Initialize the PublicKeyContext
+     * 
+     * @param \Twilio\Version $version Version that contains the resource
+     * @param string $sid Fetch by unique Credential Sid
+     * @return \Twilio\Rest\Accounts\V1\Credential\PublicKeyContext 
+     */
+    public function __construct(Version $version, $sid) {
+        parent::__construct($version);
+
+        // Path Solution
+        $this->solution = array('sid' => $sid, );
+
+        $this->uri = '/Credentials/PublicKeys/' . rawurlencode($sid) . '';
+    }
+
+    /**
+     * Fetch a PublicKeyInstance
+     * 
+     * @return PublicKeyInstance Fetched PublicKeyInstance
+     */
+    public function fetch() {
+        $params = Values::of(array());
+
+        $payload = $this->version->fetch(
+            'GET',
+            $this->uri,
+            $params
+        );
+
+        return new PublicKeyInstance($this->version, $payload, $this->solution['sid']);
+    }
+
+    /**
+     * Update the PublicKeyInstance
+     * 
+     * @param array|Options $options Optional Arguments
+     * @return PublicKeyInstance Updated PublicKeyInstance
+     */
+    public function update($options = array()) {
+        $options = new Values($options);
+
+        $data = Values::of(array('FriendlyName' => $options['friendlyName'], ));
+
+        $payload = $this->version->update(
+            'POST',
+            $this->uri,
+            array(),
+            $data
+        );
+
+        return new PublicKeyInstance($this->version, $payload, $this->solution['sid']);
+    }
+
+    /**
+     * Deletes the PublicKeyInstance
+     * 
+     * @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.Accounts.V1.PublicKeyContext ' . implode(' ', $context) . ']';
+    }
+}

+ 128 - 0
plugins/Twilio/Rest/Accounts/V1/Credential/PublicKeyInstance.php

@@ -0,0 +1,128 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Accounts\V1\Credential;
+
+use Twilio\Deserialize;
+use Twilio\Exceptions\TwilioException;
+use Twilio\InstanceResource;
+use Twilio\Options;
+use Twilio\Values;
+use Twilio\Version;
+
+/**
+ * @property string sid
+ * @property string accountSid
+ * @property string friendlyName
+ * @property \DateTime dateCreated
+ * @property \DateTime dateUpdated
+ * @property string url
+ */
+class PublicKeyInstance extends InstanceResource {
+    /**
+     * Initialize the PublicKeyInstance
+     * 
+     * @param \Twilio\Version $version Version that contains the resource
+     * @param mixed[] $payload The response payload
+     * @param string $sid Fetch by unique Credential Sid
+     * @return \Twilio\Rest\Accounts\V1\Credential\PublicKeyInstance 
+     */
+    public function __construct(Version $version, array $payload, $sid = null) {
+        parent::__construct($version);
+
+        // Marshaled Properties
+        $this->properties = array(
+            'sid' => Values::array_get($payload, 'sid'),
+            'accountSid' => Values::array_get($payload, 'account_sid'),
+            'friendlyName' => Values::array_get($payload, 'friendly_name'),
+            'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')),
+            'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')),
+            'url' => Values::array_get($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\Accounts\V1\Credential\PublicKeyContext Context for
+     *                                                              this
+     *                                                              PublicKeyInstance
+     */
+    protected function proxy() {
+        if (!$this->context) {
+            $this->context = new PublicKeyContext($this->version, $this->solution['sid']);
+        }
+
+        return $this->context;
+    }
+
+    /**
+     * Fetch a PublicKeyInstance
+     * 
+     * @return PublicKeyInstance Fetched PublicKeyInstance
+     */
+    public function fetch() {
+        return $this->proxy()->fetch();
+    }
+
+    /**
+     * Update the PublicKeyInstance
+     * 
+     * @param array|Options $options Optional Arguments
+     * @return PublicKeyInstance Updated PublicKeyInstance
+     */
+    public function update($options = array()) {
+        return $this->proxy()->update($options);
+    }
+
+    /**
+     * Deletes the PublicKeyInstance
+     * 
+     * @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.Accounts.V1.PublicKeyInstance ' . implode(' ', $context) . ']';
+    }
+}

+ 163 - 0
plugins/Twilio/Rest/Accounts/V1/Credential/PublicKeyList.php

@@ -0,0 +1,163 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Accounts\V1\Credential;
+
+use Twilio\ListResource;
+use Twilio\Options;
+use Twilio\Values;
+use Twilio\Version;
+
+class PublicKeyList extends ListResource {
+    /**
+     * Construct the PublicKeyList
+     * 
+     * @param Version $version Version that contains the resource
+     * @return \Twilio\Rest\Accounts\V1\Credential\PublicKeyList 
+     */
+    public function __construct(Version $version) {
+        parent::__construct($version);
+
+        // Path Solution
+        $this->solution = array();
+
+        $this->uri = '/Credentials/PublicKeys';
+    }
+
+    /**
+     * Streams PublicKeyInstance 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 PublicKeyInstance 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 PublicKeyInstance[] Array of results
+     */
+    public function read($limit = null, $pageSize = null) {
+        return iterator_to_array($this->stream($limit, $pageSize), false);
+    }
+
+    /**
+     * Retrieve a single page of PublicKeyInstance 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 PublicKeyInstance
+     */
+    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 PublicKeyPage($this->version, $response, $this->solution);
+    }
+
+    /**
+     * Retrieve a specific page of PublicKeyInstance records from the API.
+     * Request is executed immediately
+     * 
+     * @param string $targetUrl API-generated URL for the requested results page
+     * @return \Twilio\Page Page of PublicKeyInstance
+     */
+    public function getPage($targetUrl) {
+        $response = $this->version->getDomain()->getClient()->request(
+            'GET',
+            $targetUrl
+        );
+
+        return new PublicKeyPage($this->version, $response, $this->solution);
+    }
+
+    /**
+     * Create a new PublicKeyInstance
+     * 
+     * @param string $publicKey URL encoded representation of the public key
+     * @param array|Options $options Optional Arguments
+     * @return PublicKeyInstance Newly created PublicKeyInstance
+     */
+    public function create($publicKey, $options = array()) {
+        $options = new Values($options);
+
+        $data = Values::of(array(
+            'PublicKey' => $publicKey,
+            'FriendlyName' => $options['friendlyName'],
+            'AccountSid' => $options['accountSid'],
+        ));
+
+        $payload = $this->version->create(
+            'POST',
+            $this->uri,
+            array(),
+            $data
+        );
+
+        return new PublicKeyInstance($this->version, $payload);
+    }
+
+    /**
+     * Constructs a PublicKeyContext
+     * 
+     * @param string $sid Fetch by unique Credential Sid
+     * @return \Twilio\Rest\Accounts\V1\Credential\PublicKeyContext 
+     */
+    public function getContext($sid) {
+        return new PublicKeyContext($this->version, $sid);
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        return '[Twilio.Accounts.V1.PublicKeyList]';
+    }
+}

+ 118 - 0
plugins/Twilio/Rest/Accounts/V1/Credential/PublicKeyOptions.php

@@ -0,0 +1,118 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Accounts\V1\Credential;
+
+use Twilio\Options;
+use Twilio\Values;
+
+abstract class PublicKeyOptions {
+    /**
+     * @param string $friendlyName A human readable description of this resource
+     * @param string $accountSid The Subaccount this Credential should be
+     *                           associated with.
+     * @return CreatePublicKeyOptions Options builder
+     */
+    public static function create($friendlyName = Values::NONE, $accountSid = Values::NONE) {
+        return new CreatePublicKeyOptions($friendlyName, $accountSid);
+    }
+
+    /**
+     * @param string $friendlyName A human readable description of this resource
+     * @return UpdatePublicKeyOptions Options builder
+     */
+    public static function update($friendlyName = Values::NONE) {
+        return new UpdatePublicKeyOptions($friendlyName);
+    }
+}
+
+class CreatePublicKeyOptions extends Options {
+    /**
+     * @param string $friendlyName A human readable description of this resource
+     * @param string $accountSid The Subaccount this Credential should be
+     *                           associated with.
+     */
+    public function __construct($friendlyName = Values::NONE, $accountSid = Values::NONE) {
+        $this->options['friendlyName'] = $friendlyName;
+        $this->options['accountSid'] = $accountSid;
+    }
+
+    /**
+     * A human readable description of this resource, up to 64 characters.
+     * 
+     * @param string $friendlyName A human readable description of this resource
+     * @return $this Fluent Builder
+     */
+    public function setFriendlyName($friendlyName) {
+        $this->options['friendlyName'] = $friendlyName;
+        return $this;
+    }
+
+    /**
+     * The Subaccount this Credential should be associated with. Needs to be a valid Subaccount of the account issuing the request
+     * 
+     * @param string $accountSid The Subaccount this Credential should be
+     *                           associated with.
+     * @return $this Fluent Builder
+     */
+    public function setAccountSid($accountSid) {
+        $this->options['accountSid'] = $accountSid;
+        return $this;
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        $options = array();
+        foreach ($this->options as $key => $value) {
+            if ($value != Values::NONE) {
+                $options[] = "$key=$value";
+            }
+        }
+        return '[Twilio.Accounts.V1.CreatePublicKeyOptions ' . implode(' ', $options) . ']';
+    }
+}
+
+class UpdatePublicKeyOptions extends Options {
+    /**
+     * @param string $friendlyName A human readable description of this resource
+     */
+    public function __construct($friendlyName = Values::NONE) {
+        $this->options['friendlyName'] = $friendlyName;
+    }
+
+    /**
+     * A human readable description of this resource, up to 64 characters.
+     * 
+     * @param string $friendlyName A human readable description of this resource
+     * @return $this Fluent Builder
+     */
+    public function setFriendlyName($friendlyName) {
+        $this->options['friendlyName'] = $friendlyName;
+        return $this;
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        $options = array();
+        foreach ($this->options as $key => $value) {
+            if ($value != Values::NONE) {
+                $options[] = "$key=$value";
+            }
+        }
+        return '[Twilio.Accounts.V1.UpdatePublicKeyOptions ' . implode(' ', $options) . ']';
+    }
+}

+ 34 - 0
plugins/Twilio/Rest/Accounts/V1/Credential/PublicKeyPage.php

@@ -0,0 +1,34 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Accounts\V1\Credential;
+
+use Twilio\Page;
+
+class PublicKeyPage extends Page {
+    public function __construct($version, $response, $solution) {
+        parent::__construct($version, $response);
+
+        // Path Solution
+        $this->solution = $solution;
+    }
+
+    public function buildInstance(array $payload) {
+        return new PublicKeyInstance($this->version, $payload);
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        return '[Twilio.Accounts.V1.PublicKeyPage]';
+    }
+}

+ 59 - 0
plugins/Twilio/Rest/Accounts/V1/CredentialInstance.php

@@ -0,0 +1,59 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Accounts\V1;
+
+use Twilio\Exceptions\TwilioException;
+use Twilio\InstanceResource;
+use Twilio\Values;
+use Twilio\Version;
+
+class CredentialInstance extends InstanceResource {
+    /**
+     * Initialize the CredentialInstance
+     * 
+     * @param \Twilio\Version $version Version that contains the resource
+     * @param mixed[] $payload The response payload
+     * @return \Twilio\Rest\Accounts\V1\CredentialInstance 
+     */
+    public function __construct(Version $version, array $payload) {
+        parent::__construct($version);
+
+        $this->solution = array();
+    }
+
+    /**
+     * 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.Accounts.V1.CredentialInstance]';
+    }
+}

+ 104 - 0
plugins/Twilio/Rest/Accounts/V1/CredentialList.php

@@ -0,0 +1,104 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Accounts\V1;
+
+use Twilio\Exceptions\TwilioException;
+use Twilio\ListResource;
+use Twilio\Rest\Accounts\V1\Credential\AwsList;
+use Twilio\Rest\Accounts\V1\Credential\PublicKeyList;
+use Twilio\Version;
+
+/**
+ * @property \Twilio\Rest\Accounts\V1\Credential\PublicKeyList publicKey
+ * @property \Twilio\Rest\Accounts\V1\Credential\AwsList aws
+ * @method \Twilio\Rest\Accounts\V1\Credential\PublicKeyContext publicKey(string $sid)
+ * @method \Twilio\Rest\Accounts\V1\Credential\AwsContext aws(string $sid)
+ */
+class CredentialList extends ListResource {
+    protected $_publicKey = null;
+    protected $_aws = null;
+
+    /**
+     * Construct the CredentialList
+     * 
+     * @param Version $version Version that contains the resource
+     * @return \Twilio\Rest\Accounts\V1\CredentialList 
+     */
+    public function __construct(Version $version) {
+        parent::__construct($version);
+
+        // Path Solution
+        $this->solution = array();
+    }
+
+    /**
+     * Access the publicKey
+     */
+    protected function getPublicKey() {
+        if (!$this->_publicKey) {
+            $this->_publicKey = new PublicKeyList($this->version);
+        }
+
+        return $this->_publicKey;
+    }
+
+    /**
+     * Access the aws
+     */
+    protected function getAws() {
+        if (!$this->_aws) {
+            $this->_aws = new AwsList($this->version);
+        }
+
+        return $this->_aws;
+    }
+
+    /**
+     * 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() {
+        return '[Twilio.Accounts.V1.CredentialList]';
+    }
+}

+ 34 - 0
plugins/Twilio/Rest/Accounts/V1/CredentialPage.php

@@ -0,0 +1,34 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Accounts\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.Accounts.V1.CredentialPage]';
+    }
+}

+ 449 - 0
plugins/Twilio/Rest/Api.php

@@ -0,0 +1,449 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest;
+
+use Twilio\Domain;
+use Twilio\Exceptions\TwilioException;
+use Twilio\Rest\Api\V2010;
+
+/**
+ * @property \Twilio\Rest\Api\V2010 v2010
+ * @property \Twilio\Rest\Api\V2010\AccountList accounts
+ * @property \Twilio\Rest\Api\V2010\AccountContext account
+ * @property \Twilio\Rest\Api\V2010\Account\AddressList addresses
+ * @property \Twilio\Rest\Api\V2010\Account\ApplicationList applications
+ * @property \Twilio\Rest\Api\V2010\Account\AuthorizedConnectAppList authorizedConnectApps
+ * @property \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountryList availablePhoneNumbers
+ * @property \Twilio\Rest\Api\V2010\Account\CallList calls
+ * @property \Twilio\Rest\Api\V2010\Account\ConferenceList conferences
+ * @property \Twilio\Rest\Api\V2010\Account\ConnectAppList connectApps
+ * @property \Twilio\Rest\Api\V2010\Account\IncomingPhoneNumberList incomingPhoneNumbers
+ * @property \Twilio\Rest\Api\V2010\Account\KeyList keys
+ * @property \Twilio\Rest\Api\V2010\Account\MessageList messages
+ * @property \Twilio\Rest\Api\V2010\Account\NewKeyList newKeys
+ * @property \Twilio\Rest\Api\V2010\Account\NewSigningKeyList newSigningKeys
+ * @property \Twilio\Rest\Api\V2010\Account\NotificationList notifications
+ * @property \Twilio\Rest\Api\V2010\Account\OutgoingCallerIdList outgoingCallerIds
+ * @property \Twilio\Rest\Api\V2010\Account\QueueList queues
+ * @property \Twilio\Rest\Api\V2010\Account\RecordingList recordings
+ * @property \Twilio\Rest\Api\V2010\Account\SigningKeyList signingKeys
+ * @property \Twilio\Rest\Api\V2010\Account\SipList sip
+ * @property \Twilio\Rest\Api\V2010\Account\ShortCodeList shortCodes
+ * @property \Twilio\Rest\Api\V2010\Account\TokenList tokens
+ * @property \Twilio\Rest\Api\V2010\Account\TranscriptionList transcriptions
+ * @property \Twilio\Rest\Api\V2010\Account\UsageList usage
+ * @property \Twilio\Rest\Api\V2010\Account\ValidationRequestList validationRequests
+ * @method \Twilio\Rest\Api\V2010\Account\AddressContext addresses(string $sid)
+ * @method \Twilio\Rest\Api\V2010\Account\ApplicationContext applications(string $sid)
+ * @method \Twilio\Rest\Api\V2010\Account\AuthorizedConnectAppContext authorizedConnectApps(string $connectAppSid)
+ * @method \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountryContext availablePhoneNumbers(string $countryCode)
+ * @method \Twilio\Rest\Api\V2010\Account\CallContext calls(string $sid)
+ * @method \Twilio\Rest\Api\V2010\Account\ConferenceContext conferences(string $sid)
+ * @method \Twilio\Rest\Api\V2010\Account\ConnectAppContext connectApps(string $sid)
+ * @method \Twilio\Rest\Api\V2010\Account\IncomingPhoneNumberContext incomingPhoneNumbers(string $sid)
+ * @method \Twilio\Rest\Api\V2010\Account\KeyContext keys(string $sid)
+ * @method \Twilio\Rest\Api\V2010\Account\MessageContext messages(string $sid)
+ * @method \Twilio\Rest\Api\V2010\Account\NotificationContext notifications(string $sid)
+ * @method \Twilio\Rest\Api\V2010\Account\OutgoingCallerIdContext outgoingCallerIds(string $sid)
+ * @method \Twilio\Rest\Api\V2010\Account\QueueContext queues(string $sid)
+ * @method \Twilio\Rest\Api\V2010\Account\RecordingContext recordings(string $sid)
+ * @method \Twilio\Rest\Api\V2010\Account\SigningKeyContext signingKeys(string $sid)
+ * @method \Twilio\Rest\Api\V2010\Account\ShortCodeContext shortCodes(string $sid)
+ * @method \Twilio\Rest\Api\V2010\Account\TranscriptionContext transcriptions(string $sid)
+ * @method \Twilio\Rest\Api\V2010\AccountContext accounts(string $sid)
+ */
+class Api extends Domain {
+    protected $_v2010 = null;
+
+    /**
+     * Construct the Api Domain
+     * 
+     * @param \Twilio\Rest\Client $client Twilio\Rest\Client to communicate with
+     *                                    Twilio
+     * @return \Twilio\Rest\Api Domain for Api
+     */
+    public function __construct(Client $client) {
+        parent::__construct($client);
+
+        $this->baseUrl = 'https://api.twilio.com';
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010 Version v2010 of api
+     */
+    protected function getV2010() {
+        if (!$this->_v2010) {
+            $this->_v2010 = new V2010($this);
+        }
+        return $this->_v2010;
+    }
+
+    /**
+     * 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\Api\V2010\AccountContext Account provided as the
+     *                                               authenticating account
+     */
+    protected function getAccount() {
+        return $this->v2010->account;
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\AccountList 
+     */
+    protected function getAccounts() {
+        return $this->v2010->accounts;
+    }
+
+    /**
+     * @param string $sid Fetch by unique Account Sid
+     * @return \Twilio\Rest\Api\V2010\AccountContext 
+     */
+    protected function contextAccounts($sid) {
+        return $this->v2010->accounts($sid);
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\AddressList 
+     */
+    protected function getAddresses() {
+        return $this->v2010->account->addresses;
+    }
+
+    /**
+     * @param string $sid The sid
+     * @return \Twilio\Rest\Api\V2010\Account\AddressContext 
+     */
+    protected function contextAddresses($sid) {
+        return $this->v2010->account->addresses($sid);
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\ApplicationList 
+     */
+    protected function getApplications() {
+        return $this->v2010->account->applications;
+    }
+
+    /**
+     * @param string $sid Fetch by unique Application Sid
+     * @return \Twilio\Rest\Api\V2010\Account\ApplicationContext 
+     */
+    protected function contextApplications($sid) {
+        return $this->v2010->account->applications($sid);
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\AuthorizedConnectAppList 
+     */
+    protected function getAuthorizedConnectApps() {
+        return $this->v2010->account->authorizedConnectApps;
+    }
+
+    /**
+     * @param string $connectAppSid The connect_app_sid
+     * @return \Twilio\Rest\Api\V2010\Account\AuthorizedConnectAppContext 
+     */
+    protected function contextAuthorizedConnectApps($connectAppSid) {
+        return $this->v2010->account->authorizedConnectApps($connectAppSid);
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountryList 
+     */
+    protected function getAvailablePhoneNumbers() {
+        return $this->v2010->account->availablePhoneNumbers;
+    }
+
+    /**
+     * @param string $countryCode The country_code
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountryContext 
+     */
+    protected function contextAvailablePhoneNumbers($countryCode) {
+        return $this->v2010->account->availablePhoneNumbers($countryCode);
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\CallList 
+     */
+    protected function getCalls() {
+        return $this->v2010->account->calls;
+    }
+
+    /**
+     * @param string $sid Call Sid that uniquely identifies the Call to fetch
+     * @return \Twilio\Rest\Api\V2010\Account\CallContext 
+     */
+    protected function contextCalls($sid) {
+        return $this->v2010->account->calls($sid);
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\ConferenceList 
+     */
+    protected function getConferences() {
+        return $this->v2010->account->conferences;
+    }
+
+    /**
+     * @param string $sid Fetch by unique conference Sid
+     * @return \Twilio\Rest\Api\V2010\Account\ConferenceContext 
+     */
+    protected function contextConferences($sid) {
+        return $this->v2010->account->conferences($sid);
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\ConnectAppList 
+     */
+    protected function getConnectApps() {
+        return $this->v2010->account->connectApps;
+    }
+
+    /**
+     * @param string $sid Fetch by unique connect-app Sid
+     * @return \Twilio\Rest\Api\V2010\Account\ConnectAppContext 
+     */
+    protected function contextConnectApps($sid) {
+        return $this->v2010->account->connectApps($sid);
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\IncomingPhoneNumberList 
+     */
+    protected function getIncomingPhoneNumbers() {
+        return $this->v2010->account->incomingPhoneNumbers;
+    }
+
+    /**
+     * @param string $sid Fetch by unique incoming-phone-number Sid
+     * @return \Twilio\Rest\Api\V2010\Account\IncomingPhoneNumberContext 
+     */
+    protected function contextIncomingPhoneNumbers($sid) {
+        return $this->v2010->account->incomingPhoneNumbers($sid);
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\KeyList 
+     */
+    protected function getKeys() {
+        return $this->v2010->account->keys;
+    }
+
+    /**
+     * @param string $sid The sid
+     * @return \Twilio\Rest\Api\V2010\Account\KeyContext 
+     */
+    protected function contextKeys($sid) {
+        return $this->v2010->account->keys($sid);
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\MessageList 
+     */
+    protected function getMessages() {
+        return $this->v2010->account->messages;
+    }
+
+    /**
+     * @param string $sid Fetch by unique message Sid
+     * @return \Twilio\Rest\Api\V2010\Account\MessageContext 
+     */
+    protected function contextMessages($sid) {
+        return $this->v2010->account->messages($sid);
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\NewKeyList 
+     */
+    protected function getNewKeys() {
+        return $this->v2010->account->newKeys;
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\NewSigningKeyList 
+     */
+    protected function getNewSigningKeys() {
+        return $this->v2010->account->newSigningKeys;
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\NotificationList 
+     */
+    protected function getNotifications() {
+        return $this->v2010->account->notifications;
+    }
+
+    /**
+     * @param string $sid Fetch by unique notification Sid
+     * @return \Twilio\Rest\Api\V2010\Account\NotificationContext 
+     */
+    protected function contextNotifications($sid) {
+        return $this->v2010->account->notifications($sid);
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\OutgoingCallerIdList 
+     */
+    protected function getOutgoingCallerIds() {
+        return $this->v2010->account->outgoingCallerIds;
+    }
+
+    /**
+     * @param string $sid Fetch by unique outgoing-caller-id Sid
+     * @return \Twilio\Rest\Api\V2010\Account\OutgoingCallerIdContext 
+     */
+    protected function contextOutgoingCallerIds($sid) {
+        return $this->v2010->account->outgoingCallerIds($sid);
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\QueueList 
+     */
+    protected function getQueues() {
+        return $this->v2010->account->queues;
+    }
+
+    /**
+     * @param string $sid Fetch by unique queue Sid
+     * @return \Twilio\Rest\Api\V2010\Account\QueueContext 
+     */
+    protected function contextQueues($sid) {
+        return $this->v2010->account->queues($sid);
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\RecordingList 
+     */
+    protected function getRecordings() {
+        return $this->v2010->account->recordings;
+    }
+
+    /**
+     * @param string $sid Fetch by unique recording Sid
+     * @return \Twilio\Rest\Api\V2010\Account\RecordingContext 
+     */
+    protected function contextRecordings($sid) {
+        return $this->v2010->account->recordings($sid);
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\SigningKeyList 
+     */
+    protected function getSigningKeys() {
+        return $this->v2010->account->signingKeys;
+    }
+
+    /**
+     * @param string $sid The sid
+     * @return \Twilio\Rest\Api\V2010\Account\SigningKeyContext 
+     */
+    protected function contextSigningKeys($sid) {
+        return $this->v2010->account->signingKeys($sid);
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\SipList 
+     */
+    protected function getSip() {
+        return $this->v2010->account->sip;
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\ShortCodeList 
+     */
+    protected function getShortCodes() {
+        return $this->v2010->account->shortCodes;
+    }
+
+    /**
+     * @param string $sid Fetch by unique short-code Sid
+     * @return \Twilio\Rest\Api\V2010\Account\ShortCodeContext 
+     */
+    protected function contextShortCodes($sid) {
+        return $this->v2010->account->shortCodes($sid);
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\TokenList 
+     */
+    protected function getTokens() {
+        return $this->v2010->account->tokens;
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\TranscriptionList 
+     */
+    protected function getTranscriptions() {
+        return $this->v2010->account->transcriptions;
+    }
+
+    /**
+     * @param string $sid Fetch by unique transcription Sid
+     * @return \Twilio\Rest\Api\V2010\Account\TranscriptionContext 
+     */
+    protected function contextTranscriptions($sid) {
+        return $this->v2010->account->transcriptions($sid);
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\UsageList 
+     */
+    protected function getUsage() {
+        return $this->v2010->account->usage;
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\ValidationRequestList 
+     */
+    protected function getValidationRequests() {
+        return $this->v2010->account->validationRequests;
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        return '[Twilio.Api]';
+    }
+}

+ 338 - 0
plugins/Twilio/Rest/Api/V2010.php

@@ -0,0 +1,338 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api;
+
+use Twilio\Domain;
+use Twilio\Exceptions\TwilioException;
+use Twilio\Rest\Api\V2010\AccountContext;
+use Twilio\Rest\Api\V2010\AccountInstance;
+use Twilio\Rest\Api\V2010\AccountList;
+use Twilio\Version;
+
+/**
+ * @property \Twilio\Rest\Api\V2010\AccountList accounts
+ * @method \Twilio\Rest\Api\V2010\AccountContext accounts(string $sid)
+ * @property \Twilio\Rest\Api\V2010\AccountContext account
+ * @property \Twilio\Rest\Api\V2010\Account\AddressList addresses
+ * @property \Twilio\Rest\Api\V2010\Account\ApplicationList applications
+ * @property \Twilio\Rest\Api\V2010\Account\AuthorizedConnectAppList authorizedConnectApps
+ * @property \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountryList availablePhoneNumbers
+ * @property \Twilio\Rest\Api\V2010\Account\CallList calls
+ * @property \Twilio\Rest\Api\V2010\Account\ConferenceList conferences
+ * @property \Twilio\Rest\Api\V2010\Account\ConnectAppList connectApps
+ * @property \Twilio\Rest\Api\V2010\Account\IncomingPhoneNumberList incomingPhoneNumbers
+ * @property \Twilio\Rest\Api\V2010\Account\KeyList keys
+ * @property \Twilio\Rest\Api\V2010\Account\MessageList messages
+ * @property \Twilio\Rest\Api\V2010\Account\NewKeyList newKeys
+ * @property \Twilio\Rest\Api\V2010\Account\NewSigningKeyList newSigningKeys
+ * @property \Twilio\Rest\Api\V2010\Account\NotificationList notifications
+ * @property \Twilio\Rest\Api\V2010\Account\OutgoingCallerIdList outgoingCallerIds
+ * @property \Twilio\Rest\Api\V2010\Account\QueueList queues
+ * @property \Twilio\Rest\Api\V2010\Account\RecordingList recordings
+ * @property \Twilio\Rest\Api\V2010\Account\SigningKeyList signingKeys
+ * @property \Twilio\Rest\Api\V2010\Account\SipList sip
+ * @property \Twilio\Rest\Api\V2010\Account\ShortCodeList shortCodes
+ * @property \Twilio\Rest\Api\V2010\Account\TokenList tokens
+ * @property \Twilio\Rest\Api\V2010\Account\TranscriptionList transcriptions
+ * @property \Twilio\Rest\Api\V2010\Account\UsageList usage
+ * @property \Twilio\Rest\Api\V2010\Account\ValidationRequestList validationRequests
+ * @method \Twilio\Rest\Api\V2010\Account\AddressContext addresses(string $sid)
+ * @method \Twilio\Rest\Api\V2010\Account\ApplicationContext applications(string $sid)
+ * @method \Twilio\Rest\Api\V2010\Account\AuthorizedConnectAppContext authorizedConnectApps(string $connectAppSid)
+ * @method \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountryContext availablePhoneNumbers(string $countryCode)
+ * @method \Twilio\Rest\Api\V2010\Account\CallContext calls(string $sid)
+ * @method \Twilio\Rest\Api\V2010\Account\ConferenceContext conferences(string $sid)
+ * @method \Twilio\Rest\Api\V2010\Account\ConnectAppContext connectApps(string $sid)
+ * @method \Twilio\Rest\Api\V2010\Account\IncomingPhoneNumberContext incomingPhoneNumbers(string $sid)
+ * @method \Twilio\Rest\Api\V2010\Account\KeyContext keys(string $sid)
+ * @method \Twilio\Rest\Api\V2010\Account\MessageContext messages(string $sid)
+ * @method \Twilio\Rest\Api\V2010\Account\NotificationContext notifications(string $sid)
+ * @method \Twilio\Rest\Api\V2010\Account\OutgoingCallerIdContext outgoingCallerIds(string $sid)
+ * @method \Twilio\Rest\Api\V2010\Account\QueueContext queues(string $sid)
+ * @method \Twilio\Rest\Api\V2010\Account\RecordingContext recordings(string $sid)
+ * @method \Twilio\Rest\Api\V2010\Account\SigningKeyContext signingKeys(string $sid)
+ * @method \Twilio\Rest\Api\V2010\Account\ShortCodeContext shortCodes(string $sid)
+ * @method \Twilio\Rest\Api\V2010\Account\TranscriptionContext transcriptions(string $sid)
+ */
+class V2010 extends Version {
+    protected $_accounts = null;
+    protected $_account = null;
+    protected $_addresses = null;
+    protected $_applications = null;
+    protected $_authorizedConnectApps = null;
+    protected $_availablePhoneNumbers = null;
+    protected $_calls = null;
+    protected $_conferences = null;
+    protected $_connectApps = null;
+    protected $_incomingPhoneNumbers = null;
+    protected $_keys = null;
+    protected $_messages = null;
+    protected $_newKeys = null;
+    protected $_newSigningKeys = null;
+    protected $_notifications = null;
+    protected $_outgoingCallerIds = null;
+    protected $_queues = null;
+    protected $_recordings = null;
+    protected $_signingKeys = null;
+    protected $_sip = null;
+    protected $_shortCodes = null;
+    protected $_tokens = null;
+    protected $_transcriptions = null;
+    protected $_usage = null;
+    protected $_validationRequests = null;
+
+    /**
+     * Construct the V2010 version of Api
+     * 
+     * @param \Twilio\Domain $domain Domain that contains the version
+     * @return \Twilio\Rest\Api\V2010 V2010 version of Api
+     */
+    public function __construct(Domain $domain) {
+        parent::__construct($domain);
+        $this->version = '2010-04-01';
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\AccountList 
+     */
+    protected function getAccounts() {
+        if (!$this->_accounts) {
+            $this->_accounts = new AccountList($this);
+        }
+        return $this->_accounts;
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\AccountContext Account provided as the
+     *                                               authenticating account
+     */
+    protected function getAccount() {
+        if (!$this->_account) {
+            $this->_account = new AccountContext(
+                $this,
+                $this->domain->getClient()->getAccountSid()
+            );
+        }
+        return $this->_account;
+    }
+
+    /**
+     * Setter to override the primary account
+     * 
+     * @param AccountContext|AccountInstance $account account to use as the primary
+     *                                                account
+     */
+    public function setAccount($account) {
+        $this->_account = $account;
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\AddressList 
+     */
+    protected function getAddresses() {
+        return $this->account->addresses;
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\ApplicationList 
+     */
+    protected function getApplications() {
+        return $this->account->applications;
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\AuthorizedConnectAppList 
+     */
+    protected function getAuthorizedConnectApps() {
+        return $this->account->authorizedConnectApps;
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountryList 
+     */
+    protected function getAvailablePhoneNumbers() {
+        return $this->account->availablePhoneNumbers;
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\CallList 
+     */
+    protected function getCalls() {
+        return $this->account->calls;
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\ConferenceList 
+     */
+    protected function getConferences() {
+        return $this->account->conferences;
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\ConnectAppList 
+     */
+    protected function getConnectApps() {
+        return $this->account->connectApps;
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\IncomingPhoneNumberList 
+     */
+    protected function getIncomingPhoneNumbers() {
+        return $this->account->incomingPhoneNumbers;
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\KeyList 
+     */
+    protected function getKeys() {
+        return $this->account->keys;
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\MessageList 
+     */
+    protected function getMessages() {
+        return $this->account->messages;
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\NewKeyList 
+     */
+    protected function getNewKeys() {
+        return $this->account->newKeys;
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\NewSigningKeyList 
+     */
+    protected function getNewSigningKeys() {
+        return $this->account->newSigningKeys;
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\NotificationList 
+     */
+    protected function getNotifications() {
+        return $this->account->notifications;
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\OutgoingCallerIdList 
+     */
+    protected function getOutgoingCallerIds() {
+        return $this->account->outgoingCallerIds;
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\QueueList 
+     */
+    protected function getQueues() {
+        return $this->account->queues;
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\RecordingList 
+     */
+    protected function getRecordings() {
+        return $this->account->recordings;
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\SigningKeyList 
+     */
+    protected function getSigningKeys() {
+        return $this->account->signingKeys;
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\SipList 
+     */
+    protected function getSip() {
+        return $this->account->sip;
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\ShortCodeList 
+     */
+    protected function getShortCodes() {
+        return $this->account->shortCodes;
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\TokenList 
+     */
+    protected function getTokens() {
+        return $this->account->tokens;
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\TranscriptionList 
+     */
+    protected function getTranscriptions() {
+        return $this->account->transcriptions;
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\UsageList 
+     */
+    protected function getUsage() {
+        return $this->account->usage;
+    }
+
+    /**
+     * @return \Twilio\Rest\Api\V2010\Account\ValidationRequestList 
+     */
+    protected function getValidationRequests() {
+        return $this->account->validationRequests;
+    }
+
+    /**
+     * 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.Api.V2010]';
+    }
+}

+ 120 - 0
plugins/Twilio/Rest/Api/V2010/Account/Address/DependentPhoneNumberInstance.php

@@ -0,0 +1,120 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account\Address;
+
+use Twilio\Deserialize;
+use Twilio\Exceptions\TwilioException;
+use Twilio\InstanceResource;
+use Twilio\Values;
+use Twilio\Version;
+
+/**
+ * @property string sid
+ * @property string accountSid
+ * @property string friendlyName
+ * @property string phoneNumber
+ * @property string voiceUrl
+ * @property string voiceMethod
+ * @property string voiceFallbackMethod
+ * @property string voiceFallbackUrl
+ * @property boolean voiceCallerIdLookup
+ * @property \DateTime dateCreated
+ * @property \DateTime dateUpdated
+ * @property string smsFallbackMethod
+ * @property string smsFallbackUrl
+ * @property string smsMethod
+ * @property string smsUrl
+ * @property string addressRequirements
+ * @property array capabilities
+ * @property string statusCallback
+ * @property string statusCallbackMethod
+ * @property string apiVersion
+ * @property string smsApplicationSid
+ * @property string voiceApplicationSid
+ * @property string trunkSid
+ * @property string emergencyStatus
+ * @property string emergencyAddressSid
+ * @property string uri
+ */
+class DependentPhoneNumberInstance extends InstanceResource {
+    /**
+     * Initialize the DependentPhoneNumberInstance
+     * 
+     * @param \Twilio\Version $version Version that contains the resource
+     * @param mixed[] $payload The response payload
+     * @param string $accountSid The account_sid
+     * @param string $addressSid The sid
+     * @return \Twilio\Rest\Api\V2010\Account\Address\DependentPhoneNumberInstance 
+     */
+    public function __construct(Version $version, array $payload, $accountSid, $addressSid) {
+        parent::__construct($version);
+
+        // Marshaled Properties
+        $this->properties = array(
+            'sid' => Values::array_get($payload, 'sid'),
+            'accountSid' => Values::array_get($payload, 'account_sid'),
+            'friendlyName' => Values::array_get($payload, 'friendly_name'),
+            'phoneNumber' => Values::array_get($payload, 'phone_number'),
+            'voiceUrl' => Values::array_get($payload, 'voice_url'),
+            'voiceMethod' => Values::array_get($payload, 'voice_method'),
+            'voiceFallbackMethod' => Values::array_get($payload, 'voice_fallback_method'),
+            'voiceFallbackUrl' => Values::array_get($payload, 'voice_fallback_url'),
+            'voiceCallerIdLookup' => Values::array_get($payload, 'voice_caller_id_lookup'),
+            'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')),
+            'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')),
+            'smsFallbackMethod' => Values::array_get($payload, 'sms_fallback_method'),
+            'smsFallbackUrl' => Values::array_get($payload, 'sms_fallback_url'),
+            'smsMethod' => Values::array_get($payload, 'sms_method'),
+            'smsUrl' => Values::array_get($payload, 'sms_url'),
+            'addressRequirements' => Values::array_get($payload, 'address_requirements'),
+            'capabilities' => Values::array_get($payload, 'capabilities'),
+            'statusCallback' => Values::array_get($payload, 'status_callback'),
+            'statusCallbackMethod' => Values::array_get($payload, 'status_callback_method'),
+            'apiVersion' => Values::array_get($payload, 'api_version'),
+            'smsApplicationSid' => Values::array_get($payload, 'sms_application_sid'),
+            'voiceApplicationSid' => Values::array_get($payload, 'voice_application_sid'),
+            'trunkSid' => Values::array_get($payload, 'trunk_sid'),
+            'emergencyStatus' => Values::array_get($payload, 'emergency_status'),
+            'emergencyAddressSid' => Values::array_get($payload, 'emergency_address_sid'),
+            'uri' => Values::array_get($payload, 'uri'),
+        );
+
+        $this->solution = array('accountSid' => $accountSid, 'addressSid' => $addressSid, );
+    }
+
+    /**
+     * 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.Api.V2010.DependentPhoneNumberInstance]';
+    }
+}

+ 130 - 0
plugins/Twilio/Rest/Api/V2010/Account/Address/DependentPhoneNumberList.php

@@ -0,0 +1,130 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account\Address;
+
+use Twilio\ListResource;
+use Twilio\Values;
+use Twilio\Version;
+
+class DependentPhoneNumberList extends ListResource {
+    /**
+     * Construct the DependentPhoneNumberList
+     * 
+     * @param Version $version Version that contains the resource
+     * @param string $accountSid The account_sid
+     * @param string $addressSid The sid
+     * @return \Twilio\Rest\Api\V2010\Account\Address\DependentPhoneNumberList 
+     */
+    public function __construct(Version $version, $accountSid, $addressSid) {
+        parent::__construct($version);
+
+        // Path Solution
+        $this->solution = array('accountSid' => $accountSid, 'addressSid' => $addressSid, );
+
+        $this->uri = '/Accounts/' . rawurlencode($accountSid) . '/Addresses/' . rawurlencode($addressSid) . '/DependentPhoneNumbers.json';
+    }
+
+    /**
+     * Streams DependentPhoneNumberInstance 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 DependentPhoneNumberInstance 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 DependentPhoneNumberInstance[] Array of results
+     */
+    public function read($limit = null, $pageSize = null) {
+        return iterator_to_array($this->stream($limit, $pageSize), false);
+    }
+
+    /**
+     * Retrieve a single page of DependentPhoneNumberInstance 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 DependentPhoneNumberInstance
+     */
+    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 DependentPhoneNumberPage($this->version, $response, $this->solution);
+    }
+
+    /**
+     * Retrieve a specific page of DependentPhoneNumberInstance records from the
+     * API.
+     * Request is executed immediately
+     * 
+     * @param string $targetUrl API-generated URL for the requested results page
+     * @return \Twilio\Page Page of DependentPhoneNumberInstance
+     */
+    public function getPage($targetUrl) {
+        $response = $this->version->getDomain()->getClient()->request(
+            'GET',
+            $targetUrl
+        );
+
+        return new DependentPhoneNumberPage($this->version, $response, $this->solution);
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        return '[Twilio.Api.V2010.DependentPhoneNumberList]';
+    }
+}

+ 39 - 0
plugins/Twilio/Rest/Api/V2010/Account/Address/DependentPhoneNumberPage.php

@@ -0,0 +1,39 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account\Address;
+
+use Twilio\Page;
+
+class DependentPhoneNumberPage extends Page {
+    public function __construct($version, $response, $solution) {
+        parent::__construct($version, $response);
+
+        // Path Solution
+        $this->solution = $solution;
+    }
+
+    public function buildInstance(array $payload) {
+        return new DependentPhoneNumberInstance(
+            $this->version,
+            $payload,
+            $this->solution['accountSid'],
+            $this->solution['addressSid']
+        );
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        return '[Twilio.Api.V2010.DependentPhoneNumberPage]';
+    }
+}

+ 171 - 0
plugins/Twilio/Rest/Api/V2010/Account/AddressContext.php

@@ -0,0 +1,171 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account;
+
+use Twilio\Exceptions\TwilioException;
+use Twilio\InstanceContext;
+use Twilio\Options;
+use Twilio\Rest\Api\V2010\Account\Address\DependentPhoneNumberList;
+use Twilio\Serialize;
+use Twilio\Values;
+use Twilio\Version;
+
+/**
+ * @property \Twilio\Rest\Api\V2010\Account\Address\DependentPhoneNumberList dependentPhoneNumbers
+ */
+class AddressContext extends InstanceContext {
+    protected $_dependentPhoneNumbers = null;
+
+    /**
+     * Initialize the AddressContext
+     * 
+     * @param \Twilio\Version $version Version that contains the resource
+     * @param string $accountSid The account_sid
+     * @param string $sid The sid
+     * @return \Twilio\Rest\Api\V2010\Account\AddressContext 
+     */
+    public function __construct(Version $version, $accountSid, $sid) {
+        parent::__construct($version);
+
+        // Path Solution
+        $this->solution = array('accountSid' => $accountSid, 'sid' => $sid, );
+
+        $this->uri = '/Accounts/' . rawurlencode($accountSid) . '/Addresses/' . rawurlencode($sid) . '.json';
+    }
+
+    /**
+     * Deletes the AddressInstance
+     * 
+     * @return boolean True if delete succeeds, false otherwise
+     */
+    public function delete() {
+        return $this->version->delete('delete', $this->uri);
+    }
+
+    /**
+     * Fetch a AddressInstance
+     * 
+     * @return AddressInstance Fetched AddressInstance
+     */
+    public function fetch() {
+        $params = Values::of(array());
+
+        $payload = $this->version->fetch(
+            'GET',
+            $this->uri,
+            $params
+        );
+
+        return new AddressInstance(
+            $this->version,
+            $payload,
+            $this->solution['accountSid'],
+            $this->solution['sid']
+        );
+    }
+
+    /**
+     * Update the AddressInstance
+     * 
+     * @param array|Options $options Optional Arguments
+     * @return AddressInstance Updated AddressInstance
+     */
+    public function update($options = array()) {
+        $options = new Values($options);
+
+        $data = Values::of(array(
+            'FriendlyName' => $options['friendlyName'],
+            'CustomerName' => $options['customerName'],
+            'Street' => $options['street'],
+            'City' => $options['city'],
+            'Region' => $options['region'],
+            'PostalCode' => $options['postalCode'],
+            'EmergencyEnabled' => Serialize::booleanToString($options['emergencyEnabled']),
+            'AutoCorrectAddress' => Serialize::booleanToString($options['autoCorrectAddress']),
+        ));
+
+        $payload = $this->version->update(
+            'POST',
+            $this->uri,
+            array(),
+            $data
+        );
+
+        return new AddressInstance(
+            $this->version,
+            $payload,
+            $this->solution['accountSid'],
+            $this->solution['sid']
+        );
+    }
+
+    /**
+     * Access the dependentPhoneNumbers
+     * 
+     * @return \Twilio\Rest\Api\V2010\Account\Address\DependentPhoneNumberList 
+     */
+    protected function getDependentPhoneNumbers() {
+        if (!$this->_dependentPhoneNumbers) {
+            $this->_dependentPhoneNumbers = new DependentPhoneNumberList(
+                $this->version,
+                $this->solution['accountSid'],
+                $this->solution['sid']
+            );
+        }
+
+        return $this->_dependentPhoneNumbers;
+    }
+
+    /**
+     * 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.Api.V2010.AddressContext ' . implode(' ', $context) . ']';
+    }
+}

+ 159 - 0
plugins/Twilio/Rest/Api/V2010/Account/AddressInstance.php

@@ -0,0 +1,159 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account;
+
+use Twilio\Deserialize;
+use Twilio\Exceptions\TwilioException;
+use Twilio\InstanceResource;
+use Twilio\Options;
+use Twilio\Values;
+use Twilio\Version;
+
+/**
+ * @property string accountSid
+ * @property string city
+ * @property string customerName
+ * @property \DateTime dateCreated
+ * @property \DateTime dateUpdated
+ * @property string friendlyName
+ * @property string isoCountry
+ * @property string postalCode
+ * @property string region
+ * @property string sid
+ * @property string street
+ * @property string uri
+ * @property boolean emergencyEnabled
+ * @property boolean validated
+ */
+class AddressInstance extends InstanceResource {
+    protected $_dependentPhoneNumbers = null;
+
+    /**
+     * Initialize the AddressInstance
+     * 
+     * @param \Twilio\Version $version Version that contains the resource
+     * @param mixed[] $payload The response payload
+     * @param string $accountSid The account_sid
+     * @param string $sid The sid
+     * @return \Twilio\Rest\Api\V2010\Account\AddressInstance 
+     */
+    public function __construct(Version $version, array $payload, $accountSid, $sid = null) {
+        parent::__construct($version);
+
+        // Marshaled Properties
+        $this->properties = array(
+            'accountSid' => Values::array_get($payload, 'account_sid'),
+            'city' => Values::array_get($payload, 'city'),
+            'customerName' => Values::array_get($payload, 'customer_name'),
+            'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')),
+            'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')),
+            'friendlyName' => Values::array_get($payload, 'friendly_name'),
+            'isoCountry' => Values::array_get($payload, 'iso_country'),
+            'postalCode' => Values::array_get($payload, 'postal_code'),
+            'region' => Values::array_get($payload, 'region'),
+            'sid' => Values::array_get($payload, 'sid'),
+            'street' => Values::array_get($payload, 'street'),
+            'uri' => Values::array_get($payload, 'uri'),
+            'emergencyEnabled' => Values::array_get($payload, 'emergency_enabled'),
+            'validated' => Values::array_get($payload, 'validated'),
+        );
+
+        $this->solution = array('accountSid' => $accountSid, '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\Api\V2010\Account\AddressContext Context for this
+     *                                                       AddressInstance
+     */
+    protected function proxy() {
+        if (!$this->context) {
+            $this->context = new AddressContext(
+                $this->version,
+                $this->solution['accountSid'],
+                $this->solution['sid']
+            );
+        }
+
+        return $this->context;
+    }
+
+    /**
+     * Deletes the AddressInstance
+     * 
+     * @return boolean True if delete succeeds, false otherwise
+     */
+    public function delete() {
+        return $this->proxy()->delete();
+    }
+
+    /**
+     * Fetch a AddressInstance
+     * 
+     * @return AddressInstance Fetched AddressInstance
+     */
+    public function fetch() {
+        return $this->proxy()->fetch();
+    }
+
+    /**
+     * Update the AddressInstance
+     * 
+     * @param array|Options $options Optional Arguments
+     * @return AddressInstance Updated AddressInstance
+     */
+    public function update($options = array()) {
+        return $this->proxy()->update($options);
+    }
+
+    /**
+     * Access the dependentPhoneNumbers
+     * 
+     * @return \Twilio\Rest\Api\V2010\Account\Address\DependentPhoneNumberList 
+     */
+    protected function getDependentPhoneNumbers() {
+        return $this->proxy()->dependentPhoneNumbers;
+    }
+
+    /**
+     * 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.Api.V2010.AddressInstance ' . implode(' ', $context) . ']';
+    }
+}

+ 183 - 0
plugins/Twilio/Rest/Api/V2010/Account/AddressList.php

@@ -0,0 +1,183 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account;
+
+use Twilio\ListResource;
+use Twilio\Options;
+use Twilio\Serialize;
+use Twilio\Values;
+use Twilio\Version;
+
+class AddressList extends ListResource {
+    /**
+     * Construct the AddressList
+     * 
+     * @param Version $version Version that contains the resource
+     * @param string $accountSid The account_sid
+     * @return \Twilio\Rest\Api\V2010\Account\AddressList 
+     */
+    public function __construct(Version $version, $accountSid) {
+        parent::__construct($version);
+
+        // Path Solution
+        $this->solution = array('accountSid' => $accountSid, );
+
+        $this->uri = '/Accounts/' . rawurlencode($accountSid) . '/Addresses.json';
+    }
+
+    /**
+     * Create a new AddressInstance
+     * 
+     * @param string $customerName The customer_name
+     * @param string $street The street
+     * @param string $city The city
+     * @param string $region The region
+     * @param string $postalCode The postal_code
+     * @param string $isoCountry The iso_country
+     * @param array|Options $options Optional Arguments
+     * @return AddressInstance Newly created AddressInstance
+     */
+    public function create($customerName, $street, $city, $region, $postalCode, $isoCountry, $options = array()) {
+        $options = new Values($options);
+
+        $data = Values::of(array(
+            'CustomerName' => $customerName,
+            'Street' => $street,
+            'City' => $city,
+            'Region' => $region,
+            'PostalCode' => $postalCode,
+            'IsoCountry' => $isoCountry,
+            'FriendlyName' => $options['friendlyName'],
+            'EmergencyEnabled' => Serialize::booleanToString($options['emergencyEnabled']),
+            'AutoCorrectAddress' => Serialize::booleanToString($options['autoCorrectAddress']),
+        ));
+
+        $payload = $this->version->create(
+            'POST',
+            $this->uri,
+            array(),
+            $data
+        );
+
+        return new AddressInstance($this->version, $payload, $this->solution['accountSid']);
+    }
+
+    /**
+     * Streams AddressInstance records from the API as a generator stream.
+     * This operation lazily loads records as efficiently as possible until the
+     * limit
+     * is reached.
+     * The results are returned as a generator, so this operation is memory
+     * efficient.
+     * 
+     * @param array|Options $options Optional Arguments
+     * @param int $limit Upper limit for the number of records to return. stream()
+     *                   guarantees to never return more than limit.  Default is no
+     *                   limit
+     * @param mixed $pageSize Number of records to fetch per request, when not set
+     *                        will use the default value of 50 records.  If no
+     *                        page_size is defined but a limit is defined, stream()
+     *                        will attempt to read the limit with the most
+     *                        efficient page size, i.e. min(limit, 1000)
+     * @return \Twilio\Stream stream of results
+     */
+    public function stream($options = array(), $limit = null, $pageSize = null) {
+        $limits = $this->version->readLimits($limit, $pageSize);
+
+        $page = $this->page($options, $limits['pageSize']);
+
+        return $this->version->stream($page, $limits['limit'], $limits['pageLimit']);
+    }
+
+    /**
+     * Reads AddressInstance records from the API as a list.
+     * Unlike stream(), this operation is eager and will load `limit` records into
+     * memory before returning.
+     * 
+     * @param array|Options $options Optional Arguments
+     * @param int $limit Upper limit for the number of records to return. read()
+     *                   guarantees to never return more than limit.  Default is no
+     *                   limit
+     * @param mixed $pageSize Number of records to fetch per request, when not set
+     *                        will use the default value of 50 records.  If no
+     *                        page_size is defined but a limit is defined, read()
+     *                        will attempt to read the limit with the most
+     *                        efficient page size, i.e. min(limit, 1000)
+     * @return AddressInstance[] Array of results
+     */
+    public function read($options = array(), $limit = null, $pageSize = null) {
+        return iterator_to_array($this->stream($options, $limit, $pageSize), false);
+    }
+
+    /**
+     * Retrieve a single page of AddressInstance records from the API.
+     * Request is executed immediately
+     * 
+     * @param array|Options $options Optional Arguments
+     * @param mixed $pageSize Number of records to return, defaults to 50
+     * @param string $pageToken PageToken provided by the API
+     * @param mixed $pageNumber Page Number, this value is simply for client state
+     * @return \Twilio\Page Page of AddressInstance
+     */
+    public function page($options = array(), $pageSize = Values::NONE, $pageToken = Values::NONE, $pageNumber = Values::NONE) {
+        $options = new Values($options);
+        $params = Values::of(array(
+            'CustomerName' => $options['customerName'],
+            'FriendlyName' => $options['friendlyName'],
+            'IsoCountry' => $options['isoCountry'],
+            'PageToken' => $pageToken,
+            'Page' => $pageNumber,
+            'PageSize' => $pageSize,
+        ));
+
+        $response = $this->version->page(
+            'GET',
+            $this->uri,
+            $params
+        );
+
+        return new AddressPage($this->version, $response, $this->solution);
+    }
+
+    /**
+     * Retrieve a specific page of AddressInstance records from the API.
+     * Request is executed immediately
+     * 
+     * @param string $targetUrl API-generated URL for the requested results page
+     * @return \Twilio\Page Page of AddressInstance
+     */
+    public function getPage($targetUrl) {
+        $response = $this->version->getDomain()->getClient()->request(
+            'GET',
+            $targetUrl
+        );
+
+        return new AddressPage($this->version, $response, $this->solution);
+    }
+
+    /**
+     * Constructs a AddressContext
+     * 
+     * @param string $sid The sid
+     * @return \Twilio\Rest\Api\V2010\Account\AddressContext 
+     */
+    public function getContext($sid) {
+        return new AddressContext($this->version, $this->solution['accountSid'], $sid);
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        return '[Twilio.Api.V2010.AddressList]';
+    }
+}

+ 298 - 0
plugins/Twilio/Rest/Api/V2010/Account/AddressOptions.php

@@ -0,0 +1,298 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account;
+
+use Twilio\Options;
+use Twilio\Values;
+
+abstract class AddressOptions {
+    /**
+     * @param string $friendlyName The friendly_name
+     * @param boolean $emergencyEnabled The emergency_enabled
+     * @param boolean $autoCorrectAddress The auto_correct_address
+     * @return CreateAddressOptions Options builder
+     */
+    public static function create($friendlyName = Values::NONE, $emergencyEnabled = Values::NONE, $autoCorrectAddress = Values::NONE) {
+        return new CreateAddressOptions($friendlyName, $emergencyEnabled, $autoCorrectAddress);
+    }
+
+    /**
+     * @param string $friendlyName The friendly_name
+     * @param string $customerName The customer_name
+     * @param string $street The street
+     * @param string $city The city
+     * @param string $region The region
+     * @param string $postalCode The postal_code
+     * @param boolean $emergencyEnabled The emergency_enabled
+     * @param boolean $autoCorrectAddress The auto_correct_address
+     * @return UpdateAddressOptions Options builder
+     */
+    public static function update($friendlyName = Values::NONE, $customerName = Values::NONE, $street = Values::NONE, $city = Values::NONE, $region = Values::NONE, $postalCode = Values::NONE, $emergencyEnabled = Values::NONE, $autoCorrectAddress = Values::NONE) {
+        return new UpdateAddressOptions($friendlyName, $customerName, $street, $city, $region, $postalCode, $emergencyEnabled, $autoCorrectAddress);
+    }
+
+    /**
+     * @param string $customerName The customer_name
+     * @param string $friendlyName The friendly_name
+     * @param string $isoCountry The iso_country
+     * @return ReadAddressOptions Options builder
+     */
+    public static function read($customerName = Values::NONE, $friendlyName = Values::NONE, $isoCountry = Values::NONE) {
+        return new ReadAddressOptions($customerName, $friendlyName, $isoCountry);
+    }
+}
+
+class CreateAddressOptions extends Options {
+    /**
+     * @param string $friendlyName The friendly_name
+     * @param boolean $emergencyEnabled The emergency_enabled
+     * @param boolean $autoCorrectAddress The auto_correct_address
+     */
+    public function __construct($friendlyName = Values::NONE, $emergencyEnabled = Values::NONE, $autoCorrectAddress = Values::NONE) {
+        $this->options['friendlyName'] = $friendlyName;
+        $this->options['emergencyEnabled'] = $emergencyEnabled;
+        $this->options['autoCorrectAddress'] = $autoCorrectAddress;
+    }
+
+    /**
+     * The friendly_name
+     * 
+     * @param string $friendlyName The friendly_name
+     * @return $this Fluent Builder
+     */
+    public function setFriendlyName($friendlyName) {
+        $this->options['friendlyName'] = $friendlyName;
+        return $this;
+    }
+
+    /**
+     * The emergency_enabled
+     * 
+     * @param boolean $emergencyEnabled The emergency_enabled
+     * @return $this Fluent Builder
+     */
+    public function setEmergencyEnabled($emergencyEnabled) {
+        $this->options['emergencyEnabled'] = $emergencyEnabled;
+        return $this;
+    }
+
+    /**
+     * The auto_correct_address
+     * 
+     * @param boolean $autoCorrectAddress The auto_correct_address
+     * @return $this Fluent Builder
+     */
+    public function setAutoCorrectAddress($autoCorrectAddress) {
+        $this->options['autoCorrectAddress'] = $autoCorrectAddress;
+        return $this;
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        $options = array();
+        foreach ($this->options as $key => $value) {
+            if ($value != Values::NONE) {
+                $options[] = "$key=$value";
+            }
+        }
+        return '[Twilio.Api.V2010.CreateAddressOptions ' . implode(' ', $options) . ']';
+    }
+}
+
+class UpdateAddressOptions extends Options {
+    /**
+     * @param string $friendlyName The friendly_name
+     * @param string $customerName The customer_name
+     * @param string $street The street
+     * @param string $city The city
+     * @param string $region The region
+     * @param string $postalCode The postal_code
+     * @param boolean $emergencyEnabled The emergency_enabled
+     * @param boolean $autoCorrectAddress The auto_correct_address
+     */
+    public function __construct($friendlyName = Values::NONE, $customerName = Values::NONE, $street = Values::NONE, $city = Values::NONE, $region = Values::NONE, $postalCode = Values::NONE, $emergencyEnabled = Values::NONE, $autoCorrectAddress = Values::NONE) {
+        $this->options['friendlyName'] = $friendlyName;
+        $this->options['customerName'] = $customerName;
+        $this->options['street'] = $street;
+        $this->options['city'] = $city;
+        $this->options['region'] = $region;
+        $this->options['postalCode'] = $postalCode;
+        $this->options['emergencyEnabled'] = $emergencyEnabled;
+        $this->options['autoCorrectAddress'] = $autoCorrectAddress;
+    }
+
+    /**
+     * The friendly_name
+     * 
+     * @param string $friendlyName The friendly_name
+     * @return $this Fluent Builder
+     */
+    public function setFriendlyName($friendlyName) {
+        $this->options['friendlyName'] = $friendlyName;
+        return $this;
+    }
+
+    /**
+     * The customer_name
+     * 
+     * @param string $customerName The customer_name
+     * @return $this Fluent Builder
+     */
+    public function setCustomerName($customerName) {
+        $this->options['customerName'] = $customerName;
+        return $this;
+    }
+
+    /**
+     * The street
+     * 
+     * @param string $street The street
+     * @return $this Fluent Builder
+     */
+    public function setStreet($street) {
+        $this->options['street'] = $street;
+        return $this;
+    }
+
+    /**
+     * The city
+     * 
+     * @param string $city The city
+     * @return $this Fluent Builder
+     */
+    public function setCity($city) {
+        $this->options['city'] = $city;
+        return $this;
+    }
+
+    /**
+     * The region
+     * 
+     * @param string $region The region
+     * @return $this Fluent Builder
+     */
+    public function setRegion($region) {
+        $this->options['region'] = $region;
+        return $this;
+    }
+
+    /**
+     * The postal_code
+     * 
+     * @param string $postalCode The postal_code
+     * @return $this Fluent Builder
+     */
+    public function setPostalCode($postalCode) {
+        $this->options['postalCode'] = $postalCode;
+        return $this;
+    }
+
+    /**
+     * The emergency_enabled
+     * 
+     * @param boolean $emergencyEnabled The emergency_enabled
+     * @return $this Fluent Builder
+     */
+    public function setEmergencyEnabled($emergencyEnabled) {
+        $this->options['emergencyEnabled'] = $emergencyEnabled;
+        return $this;
+    }
+
+    /**
+     * The auto_correct_address
+     * 
+     * @param boolean $autoCorrectAddress The auto_correct_address
+     * @return $this Fluent Builder
+     */
+    public function setAutoCorrectAddress($autoCorrectAddress) {
+        $this->options['autoCorrectAddress'] = $autoCorrectAddress;
+        return $this;
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        $options = array();
+        foreach ($this->options as $key => $value) {
+            if ($value != Values::NONE) {
+                $options[] = "$key=$value";
+            }
+        }
+        return '[Twilio.Api.V2010.UpdateAddressOptions ' . implode(' ', $options) . ']';
+    }
+}
+
+class ReadAddressOptions extends Options {
+    /**
+     * @param string $customerName The customer_name
+     * @param string $friendlyName The friendly_name
+     * @param string $isoCountry The iso_country
+     */
+    public function __construct($customerName = Values::NONE, $friendlyName = Values::NONE, $isoCountry = Values::NONE) {
+        $this->options['customerName'] = $customerName;
+        $this->options['friendlyName'] = $friendlyName;
+        $this->options['isoCountry'] = $isoCountry;
+    }
+
+    /**
+     * The customer_name
+     * 
+     * @param string $customerName The customer_name
+     * @return $this Fluent Builder
+     */
+    public function setCustomerName($customerName) {
+        $this->options['customerName'] = $customerName;
+        return $this;
+    }
+
+    /**
+     * The friendly_name
+     * 
+     * @param string $friendlyName The friendly_name
+     * @return $this Fluent Builder
+     */
+    public function setFriendlyName($friendlyName) {
+        $this->options['friendlyName'] = $friendlyName;
+        return $this;
+    }
+
+    /**
+     * The iso_country
+     * 
+     * @param string $isoCountry The iso_country
+     * @return $this Fluent Builder
+     */
+    public function setIsoCountry($isoCountry) {
+        $this->options['isoCountry'] = $isoCountry;
+        return $this;
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        $options = array();
+        foreach ($this->options as $key => $value) {
+            if ($value != Values::NONE) {
+                $options[] = "$key=$value";
+            }
+        }
+        return '[Twilio.Api.V2010.ReadAddressOptions ' . implode(' ', $options) . ']';
+    }
+}

+ 34 - 0
plugins/Twilio/Rest/Api/V2010/Account/AddressPage.php

@@ -0,0 +1,34 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account;
+
+use Twilio\Page;
+
+class AddressPage extends Page {
+    public function __construct($version, $response, $solution) {
+        parent::__construct($version, $response);
+
+        // Path Solution
+        $this->solution = $solution;
+    }
+
+    public function buildInstance(array $payload) {
+        return new AddressInstance($this->version, $payload, $this->solution['accountSid']);
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        return '[Twilio.Api.V2010.AddressPage]';
+    }
+}

+ 121 - 0
plugins/Twilio/Rest/Api/V2010/Account/ApplicationContext.php

@@ -0,0 +1,121 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account;
+
+use Twilio\InstanceContext;
+use Twilio\Options;
+use Twilio\Serialize;
+use Twilio\Values;
+use Twilio\Version;
+
+class ApplicationContext extends InstanceContext {
+    /**
+     * Initialize the ApplicationContext
+     * 
+     * @param \Twilio\Version $version Version that contains the resource
+     * @param string $accountSid The account_sid
+     * @param string $sid Fetch by unique Application Sid
+     * @return \Twilio\Rest\Api\V2010\Account\ApplicationContext 
+     */
+    public function __construct(Version $version, $accountSid, $sid) {
+        parent::__construct($version);
+
+        // Path Solution
+        $this->solution = array('accountSid' => $accountSid, 'sid' => $sid, );
+
+        $this->uri = '/Accounts/' . rawurlencode($accountSid) . '/Applications/' . rawurlencode($sid) . '.json';
+    }
+
+    /**
+     * Deletes the ApplicationInstance
+     * 
+     * @return boolean True if delete succeeds, false otherwise
+     */
+    public function delete() {
+        return $this->version->delete('delete', $this->uri);
+    }
+
+    /**
+     * Fetch a ApplicationInstance
+     * 
+     * @return ApplicationInstance Fetched ApplicationInstance
+     */
+    public function fetch() {
+        $params = Values::of(array());
+
+        $payload = $this->version->fetch(
+            'GET',
+            $this->uri,
+            $params
+        );
+
+        return new ApplicationInstance(
+            $this->version,
+            $payload,
+            $this->solution['accountSid'],
+            $this->solution['sid']
+        );
+    }
+
+    /**
+     * Update the ApplicationInstance
+     * 
+     * @param array|Options $options Optional Arguments
+     * @return ApplicationInstance Updated ApplicationInstance
+     */
+    public function update($options = array()) {
+        $options = new Values($options);
+
+        $data = Values::of(array(
+            'FriendlyName' => $options['friendlyName'],
+            'ApiVersion' => $options['apiVersion'],
+            'VoiceUrl' => $options['voiceUrl'],
+            'VoiceMethod' => $options['voiceMethod'],
+            'VoiceFallbackUrl' => $options['voiceFallbackUrl'],
+            'VoiceFallbackMethod' => $options['voiceFallbackMethod'],
+            'StatusCallback' => $options['statusCallback'],
+            'StatusCallbackMethod' => $options['statusCallbackMethod'],
+            'VoiceCallerIdLookup' => Serialize::booleanToString($options['voiceCallerIdLookup']),
+            'SmsUrl' => $options['smsUrl'],
+            'SmsMethod' => $options['smsMethod'],
+            'SmsFallbackUrl' => $options['smsFallbackUrl'],
+            'SmsFallbackMethod' => $options['smsFallbackMethod'],
+            'SmsStatusCallback' => $options['smsStatusCallback'],
+            'MessageStatusCallback' => $options['messageStatusCallback'],
+        ));
+
+        $payload = $this->version->update(
+            'POST',
+            $this->uri,
+            array(),
+            $data
+        );
+
+        return new ApplicationInstance(
+            $this->version,
+            $payload,
+            $this->solution['accountSid'],
+            $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.Api.V2010.ApplicationContext ' . implode(' ', $context) . ']';
+    }
+}

+ 160 - 0
plugins/Twilio/Rest/Api/V2010/Account/ApplicationInstance.php

@@ -0,0 +1,160 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account;
+
+use Twilio\Deserialize;
+use Twilio\Exceptions\TwilioException;
+use Twilio\InstanceResource;
+use Twilio\Options;
+use Twilio\Values;
+use Twilio\Version;
+
+/**
+ * @property string accountSid
+ * @property string apiVersion
+ * @property \DateTime dateCreated
+ * @property \DateTime dateUpdated
+ * @property string friendlyName
+ * @property string messageStatusCallback
+ * @property string sid
+ * @property string smsFallbackMethod
+ * @property string smsFallbackUrl
+ * @property string smsMethod
+ * @property string smsStatusCallback
+ * @property string smsUrl
+ * @property string statusCallback
+ * @property string statusCallbackMethod
+ * @property string uri
+ * @property boolean voiceCallerIdLookup
+ * @property string voiceFallbackMethod
+ * @property string voiceFallbackUrl
+ * @property string voiceMethod
+ * @property string voiceUrl
+ */
+class ApplicationInstance extends InstanceResource {
+    /**
+     * Initialize the ApplicationInstance
+     * 
+     * @param \Twilio\Version $version Version that contains the resource
+     * @param mixed[] $payload The response payload
+     * @param string $accountSid A string that uniquely identifies this resource
+     * @param string $sid Fetch by unique Application Sid
+     * @return \Twilio\Rest\Api\V2010\Account\ApplicationInstance 
+     */
+    public function __construct(Version $version, array $payload, $accountSid, $sid = null) {
+        parent::__construct($version);
+
+        // Marshaled Properties
+        $this->properties = array(
+            'accountSid' => Values::array_get($payload, 'account_sid'),
+            'apiVersion' => Values::array_get($payload, 'api_version'),
+            'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')),
+            'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')),
+            'friendlyName' => Values::array_get($payload, 'friendly_name'),
+            'messageStatusCallback' => Values::array_get($payload, 'message_status_callback'),
+            'sid' => Values::array_get($payload, 'sid'),
+            'smsFallbackMethod' => Values::array_get($payload, 'sms_fallback_method'),
+            'smsFallbackUrl' => Values::array_get($payload, 'sms_fallback_url'),
+            'smsMethod' => Values::array_get($payload, 'sms_method'),
+            'smsStatusCallback' => Values::array_get($payload, 'sms_status_callback'),
+            'smsUrl' => Values::array_get($payload, 'sms_url'),
+            'statusCallback' => Values::array_get($payload, 'status_callback'),
+            'statusCallbackMethod' => Values::array_get($payload, 'status_callback_method'),
+            'uri' => Values::array_get($payload, 'uri'),
+            'voiceCallerIdLookup' => Values::array_get($payload, 'voice_caller_id_lookup'),
+            'voiceFallbackMethod' => Values::array_get($payload, 'voice_fallback_method'),
+            'voiceFallbackUrl' => Values::array_get($payload, 'voice_fallback_url'),
+            'voiceMethod' => Values::array_get($payload, 'voice_method'),
+            'voiceUrl' => Values::array_get($payload, 'voice_url'),
+        );
+
+        $this->solution = array('accountSid' => $accountSid, '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\Api\V2010\Account\ApplicationContext Context for this
+     *                                                           ApplicationInstance
+     */
+    protected function proxy() {
+        if (!$this->context) {
+            $this->context = new ApplicationContext(
+                $this->version,
+                $this->solution['accountSid'],
+                $this->solution['sid']
+            );
+        }
+
+        return $this->context;
+    }
+
+    /**
+     * Deletes the ApplicationInstance
+     * 
+     * @return boolean True if delete succeeds, false otherwise
+     */
+    public function delete() {
+        return $this->proxy()->delete();
+    }
+
+    /**
+     * Fetch a ApplicationInstance
+     * 
+     * @return ApplicationInstance Fetched ApplicationInstance
+     */
+    public function fetch() {
+        return $this->proxy()->fetch();
+    }
+
+    /**
+     * Update the ApplicationInstance
+     * 
+     * @param array|Options $options Optional Arguments
+     * @return ApplicationInstance Updated ApplicationInstance
+     */
+    public function update($options = array()) {
+        return $this->proxy()->update($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.Api.V2010.ApplicationInstance ' . implode(' ', $context) . ']';
+    }
+}

+ 182 - 0
plugins/Twilio/Rest/Api/V2010/Account/ApplicationList.php

@@ -0,0 +1,182 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account;
+
+use Twilio\ListResource;
+use Twilio\Options;
+use Twilio\Serialize;
+use Twilio\Values;
+use Twilio\Version;
+
+class ApplicationList extends ListResource {
+    /**
+     * Construct the ApplicationList
+     * 
+     * @param Version $version Version that contains the resource
+     * @param string $accountSid A string that uniquely identifies this resource
+     * @return \Twilio\Rest\Api\V2010\Account\ApplicationList 
+     */
+    public function __construct(Version $version, $accountSid) {
+        parent::__construct($version);
+
+        // Path Solution
+        $this->solution = array('accountSid' => $accountSid, );
+
+        $this->uri = '/Accounts/' . rawurlencode($accountSid) . '/Applications.json';
+    }
+
+    /**
+     * Create a new ApplicationInstance
+     * 
+     * @param string $friendlyName The friendly_name
+     * @param array|Options $options Optional Arguments
+     * @return ApplicationInstance Newly created ApplicationInstance
+     */
+    public function create($friendlyName, $options = array()) {
+        $options = new Values($options);
+
+        $data = Values::of(array(
+            'FriendlyName' => $friendlyName,
+            'ApiVersion' => $options['apiVersion'],
+            'VoiceUrl' => $options['voiceUrl'],
+            'VoiceMethod' => $options['voiceMethod'],
+            'VoiceFallbackUrl' => $options['voiceFallbackUrl'],
+            'VoiceFallbackMethod' => $options['voiceFallbackMethod'],
+            'StatusCallback' => $options['statusCallback'],
+            'StatusCallbackMethod' => $options['statusCallbackMethod'],
+            'VoiceCallerIdLookup' => Serialize::booleanToString($options['voiceCallerIdLookup']),
+            'SmsUrl' => $options['smsUrl'],
+            'SmsMethod' => $options['smsMethod'],
+            'SmsFallbackUrl' => $options['smsFallbackUrl'],
+            'SmsFallbackMethod' => $options['smsFallbackMethod'],
+            'SmsStatusCallback' => $options['smsStatusCallback'],
+            'MessageStatusCallback' => $options['messageStatusCallback'],
+        ));
+
+        $payload = $this->version->create(
+            'POST',
+            $this->uri,
+            array(),
+            $data
+        );
+
+        return new ApplicationInstance($this->version, $payload, $this->solution['accountSid']);
+    }
+
+    /**
+     * Streams ApplicationInstance records from the API as a generator stream.
+     * This operation lazily loads records as efficiently as possible until the
+     * limit
+     * is reached.
+     * The results are returned as a generator, so this operation is memory
+     * efficient.
+     * 
+     * @param array|Options $options Optional Arguments
+     * @param int $limit Upper limit for the number of records to return. stream()
+     *                   guarantees to never return more than limit.  Default is no
+     *                   limit
+     * @param mixed $pageSize Number of records to fetch per request, when not set
+     *                        will use the default value of 50 records.  If no
+     *                        page_size is defined but a limit is defined, stream()
+     *                        will attempt to read the limit with the most
+     *                        efficient page size, i.e. min(limit, 1000)
+     * @return \Twilio\Stream stream of results
+     */
+    public function stream($options = array(), $limit = null, $pageSize = null) {
+        $limits = $this->version->readLimits($limit, $pageSize);
+
+        $page = $this->page($options, $limits['pageSize']);
+
+        return $this->version->stream($page, $limits['limit'], $limits['pageLimit']);
+    }
+
+    /**
+     * Reads ApplicationInstance records from the API as a list.
+     * Unlike stream(), this operation is eager and will load `limit` records into
+     * memory before returning.
+     * 
+     * @param array|Options $options Optional Arguments
+     * @param int $limit Upper limit for the number of records to return. read()
+     *                   guarantees to never return more than limit.  Default is no
+     *                   limit
+     * @param mixed $pageSize Number of records to fetch per request, when not set
+     *                        will use the default value of 50 records.  If no
+     *                        page_size is defined but a limit is defined, read()
+     *                        will attempt to read the limit with the most
+     *                        efficient page size, i.e. min(limit, 1000)
+     * @return ApplicationInstance[] Array of results
+     */
+    public function read($options = array(), $limit = null, $pageSize = null) {
+        return iterator_to_array($this->stream($options, $limit, $pageSize), false);
+    }
+
+    /**
+     * Retrieve a single page of ApplicationInstance records from the API.
+     * Request is executed immediately
+     * 
+     * @param array|Options $options Optional Arguments
+     * @param mixed $pageSize Number of records to return, defaults to 50
+     * @param string $pageToken PageToken provided by the API
+     * @param mixed $pageNumber Page Number, this value is simply for client state
+     * @return \Twilio\Page Page of ApplicationInstance
+     */
+    public function page($options = array(), $pageSize = Values::NONE, $pageToken = Values::NONE, $pageNumber = Values::NONE) {
+        $options = new Values($options);
+        $params = Values::of(array(
+            'FriendlyName' => $options['friendlyName'],
+            'PageToken' => $pageToken,
+            'Page' => $pageNumber,
+            'PageSize' => $pageSize,
+        ));
+
+        $response = $this->version->page(
+            'GET',
+            $this->uri,
+            $params
+        );
+
+        return new ApplicationPage($this->version, $response, $this->solution);
+    }
+
+    /**
+     * Retrieve a specific page of ApplicationInstance records from the API.
+     * Request is executed immediately
+     * 
+     * @param string $targetUrl API-generated URL for the requested results page
+     * @return \Twilio\Page Page of ApplicationInstance
+     */
+    public function getPage($targetUrl) {
+        $response = $this->version->getDomain()->getClient()->request(
+            'GET',
+            $targetUrl
+        );
+
+        return new ApplicationPage($this->version, $response, $this->solution);
+    }
+
+    /**
+     * Constructs a ApplicationContext
+     * 
+     * @param string $sid Fetch by unique Application Sid
+     * @return \Twilio\Rest\Api\V2010\Account\ApplicationContext 
+     */
+    public function getContext($sid) {
+        return new ApplicationContext($this->version, $this->solution['accountSid'], $sid);
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        return '[Twilio.Api.V2010.ApplicationList]';
+    }
+}

+ 540 - 0
plugins/Twilio/Rest/Api/V2010/Account/ApplicationOptions.php

@@ -0,0 +1,540 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account;
+
+use Twilio\Options;
+use Twilio\Values;
+
+abstract class ApplicationOptions {
+    /**
+     * @param string $apiVersion The API version to use
+     * @param string $voiceUrl URL Twilio will make requests to when relieving a
+     *                         call
+     * @param string $voiceMethod HTTP method to use with the URL
+     * @param string $voiceFallbackUrl Fallback URL
+     * @param string $voiceFallbackMethod HTTP method to use with the fallback url
+     * @param string $statusCallback URL to hit with status updates
+     * @param string $statusCallbackMethod HTTP method to use with the status
+     *                                     callback
+     * @param boolean $voiceCallerIdLookup True or False
+     * @param string $smsUrl URL Twilio will request when receiving an SMS
+     * @param string $smsMethod HTTP method to use with sms_url
+     * @param string $smsFallbackUrl Fallback URL if there's an error parsing TwiML
+     * @param string $smsFallbackMethod HTTP method to use with sms_fallback_method
+     * @param string $smsStatusCallback URL Twilio with request with status updates
+     * @param string $messageStatusCallback URL to make requests to with status
+     *                                      updates
+     * @return CreateApplicationOptions Options builder
+     */
+    public static function create($apiVersion = Values::NONE, $voiceUrl = Values::NONE, $voiceMethod = Values::NONE, $voiceFallbackUrl = Values::NONE, $voiceFallbackMethod = Values::NONE, $statusCallback = Values::NONE, $statusCallbackMethod = Values::NONE, $voiceCallerIdLookup = Values::NONE, $smsUrl = Values::NONE, $smsMethod = Values::NONE, $smsFallbackUrl = Values::NONE, $smsFallbackMethod = Values::NONE, $smsStatusCallback = Values::NONE, $messageStatusCallback = Values::NONE) {
+        return new CreateApplicationOptions($apiVersion, $voiceUrl, $voiceMethod, $voiceFallbackUrl, $voiceFallbackMethod, $statusCallback, $statusCallbackMethod, $voiceCallerIdLookup, $smsUrl, $smsMethod, $smsFallbackUrl, $smsFallbackMethod, $smsStatusCallback, $messageStatusCallback);
+    }
+
+    /**
+     * @param string $friendlyName Filter by friendly name
+     * @return ReadApplicationOptions Options builder
+     */
+    public static function read($friendlyName = Values::NONE) {
+        return new ReadApplicationOptions($friendlyName);
+    }
+
+    /**
+     * @param string $friendlyName Human readable description of this resource
+     * @param string $apiVersion The API version to use
+     * @param string $voiceUrl URL Twilio will make requests to when relieving a
+     *                         call
+     * @param string $voiceMethod HTTP method to use with the URL
+     * @param string $voiceFallbackUrl Fallback URL
+     * @param string $voiceFallbackMethod HTTP method to use with the fallback url
+     * @param string $statusCallback URL to hit with status updates
+     * @param string $statusCallbackMethod HTTP method to use with the status
+     *                                     callback
+     * @param boolean $voiceCallerIdLookup True or False
+     * @param string $smsUrl URL Twilio will request when receiving an SMS
+     * @param string $smsMethod HTTP method to use with sms_url
+     * @param string $smsFallbackUrl Fallback URL if there's an error parsing TwiML
+     * @param string $smsFallbackMethod HTTP method to use with sms_fallback_method
+     * @param string $smsStatusCallback URL Twilio with request with status updates
+     * @param string $messageStatusCallback URL to make requests to with status
+     *                                      updates
+     * @return UpdateApplicationOptions Options builder
+     */
+    public static function update($friendlyName = Values::NONE, $apiVersion = Values::NONE, $voiceUrl = Values::NONE, $voiceMethod = Values::NONE, $voiceFallbackUrl = Values::NONE, $voiceFallbackMethod = Values::NONE, $statusCallback = Values::NONE, $statusCallbackMethod = Values::NONE, $voiceCallerIdLookup = Values::NONE, $smsUrl = Values::NONE, $smsMethod = Values::NONE, $smsFallbackUrl = Values::NONE, $smsFallbackMethod = Values::NONE, $smsStatusCallback = Values::NONE, $messageStatusCallback = Values::NONE) {
+        return new UpdateApplicationOptions($friendlyName, $apiVersion, $voiceUrl, $voiceMethod, $voiceFallbackUrl, $voiceFallbackMethod, $statusCallback, $statusCallbackMethod, $voiceCallerIdLookup, $smsUrl, $smsMethod, $smsFallbackUrl, $smsFallbackMethod, $smsStatusCallback, $messageStatusCallback);
+    }
+}
+
+class CreateApplicationOptions extends Options {
+    /**
+     * @param string $apiVersion The API version to use
+     * @param string $voiceUrl URL Twilio will make requests to when relieving a
+     *                         call
+     * @param string $voiceMethod HTTP method to use with the URL
+     * @param string $voiceFallbackUrl Fallback URL
+     * @param string $voiceFallbackMethod HTTP method to use with the fallback url
+     * @param string $statusCallback URL to hit with status updates
+     * @param string $statusCallbackMethod HTTP method to use with the status
+     *                                     callback
+     * @param boolean $voiceCallerIdLookup True or False
+     * @param string $smsUrl URL Twilio will request when receiving an SMS
+     * @param string $smsMethod HTTP method to use with sms_url
+     * @param string $smsFallbackUrl Fallback URL if there's an error parsing TwiML
+     * @param string $smsFallbackMethod HTTP method to use with sms_fallback_method
+     * @param string $smsStatusCallback URL Twilio with request with status updates
+     * @param string $messageStatusCallback URL to make requests to with status
+     *                                      updates
+     */
+    public function __construct($apiVersion = Values::NONE, $voiceUrl = Values::NONE, $voiceMethod = Values::NONE, $voiceFallbackUrl = Values::NONE, $voiceFallbackMethod = Values::NONE, $statusCallback = Values::NONE, $statusCallbackMethod = Values::NONE, $voiceCallerIdLookup = Values::NONE, $smsUrl = Values::NONE, $smsMethod = Values::NONE, $smsFallbackUrl = Values::NONE, $smsFallbackMethod = Values::NONE, $smsStatusCallback = Values::NONE, $messageStatusCallback = Values::NONE) {
+        $this->options['apiVersion'] = $apiVersion;
+        $this->options['voiceUrl'] = $voiceUrl;
+        $this->options['voiceMethod'] = $voiceMethod;
+        $this->options['voiceFallbackUrl'] = $voiceFallbackUrl;
+        $this->options['voiceFallbackMethod'] = $voiceFallbackMethod;
+        $this->options['statusCallback'] = $statusCallback;
+        $this->options['statusCallbackMethod'] = $statusCallbackMethod;
+        $this->options['voiceCallerIdLookup'] = $voiceCallerIdLookup;
+        $this->options['smsUrl'] = $smsUrl;
+        $this->options['smsMethod'] = $smsMethod;
+        $this->options['smsFallbackUrl'] = $smsFallbackUrl;
+        $this->options['smsFallbackMethod'] = $smsFallbackMethod;
+        $this->options['smsStatusCallback'] = $smsStatusCallback;
+        $this->options['messageStatusCallback'] = $messageStatusCallback;
+    }
+
+    /**
+     * Requests to this application will start a new TwiML session with this API version.
+     * 
+     * @param string $apiVersion The API version to use
+     * @return $this Fluent Builder
+     */
+    public function setApiVersion($apiVersion) {
+        $this->options['apiVersion'] = $apiVersion;
+        return $this;
+    }
+
+    /**
+     * The URL Twilio will request when a phone number assigned to this application receives a call.
+     * 
+     * @param string $voiceUrl URL Twilio will make requests to when relieving a
+     *                         call
+     * @return $this Fluent Builder
+     */
+    public function setVoiceUrl($voiceUrl) {
+        $this->options['voiceUrl'] = $voiceUrl;
+        return $this;
+    }
+
+    /**
+     * The HTTP method Twilio will use when requesting the above `Url`. Either `GET` or `POST`.
+     * 
+     * @param string $voiceMethod HTTP method to use with the URL
+     * @return $this Fluent Builder
+     */
+    public function setVoiceMethod($voiceMethod) {
+        $this->options['voiceMethod'] = $voiceMethod;
+        return $this;
+    }
+
+    /**
+     * The URL that Twilio will request if an error occurs retrieving or executing the TwiML requested by `Url`.
+     * 
+     * @param string $voiceFallbackUrl Fallback URL
+     * @return $this Fluent Builder
+     */
+    public function setVoiceFallbackUrl($voiceFallbackUrl) {
+        $this->options['voiceFallbackUrl'] = $voiceFallbackUrl;
+        return $this;
+    }
+
+    /**
+     * The HTTP method Twilio will use when requesting the `VoiceFallbackUrl`. Either `GET` or `POST`.
+     * 
+     * @param string $voiceFallbackMethod HTTP method to use with the fallback url
+     * @return $this Fluent Builder
+     */
+    public function setVoiceFallbackMethod($voiceFallbackMethod) {
+        $this->options['voiceFallbackMethod'] = $voiceFallbackMethod;
+        return $this;
+    }
+
+    /**
+     * The URL that Twilio will request to pass status parameters (such as call ended) to your application.
+     * 
+     * @param string $statusCallback URL to hit with status updates
+     * @return $this Fluent Builder
+     */
+    public function setStatusCallback($statusCallback) {
+        $this->options['statusCallback'] = $statusCallback;
+        return $this;
+    }
+
+    /**
+     * The HTTP method Twilio will use to make requests to the `StatusCallback` URL. Either `GET` or `POST`.
+     * 
+     * @param string $statusCallbackMethod HTTP method to use with the status
+     *                                     callback
+     * @return $this Fluent Builder
+     */
+    public function setStatusCallbackMethod($statusCallbackMethod) {
+        $this->options['statusCallbackMethod'] = $statusCallbackMethod;
+        return $this;
+    }
+
+    /**
+     * Look up the caller's caller-ID name from the CNAM database (additional charges apply). Either `true` or `false`.
+     * 
+     * @param boolean $voiceCallerIdLookup True or False
+     * @return $this Fluent Builder
+     */
+    public function setVoiceCallerIdLookup($voiceCallerIdLookup) {
+        $this->options['voiceCallerIdLookup'] = $voiceCallerIdLookup;
+        return $this;
+    }
+
+    /**
+     * The URL Twilio will request when a phone number assigned to this application receives an incoming SMS message.
+     * 
+     * @param string $smsUrl URL Twilio will request when receiving an SMS
+     * @return $this Fluent Builder
+     */
+    public function setSmsUrl($smsUrl) {
+        $this->options['smsUrl'] = $smsUrl;
+        return $this;
+    }
+
+    /**
+     * The HTTP method Twilio will use when making requests to the `SmsUrl`. Either `GET` or `POST`.
+     * 
+     * @param string $smsMethod HTTP method to use with sms_url
+     * @return $this Fluent Builder
+     */
+    public function setSmsMethod($smsMethod) {
+        $this->options['smsMethod'] = $smsMethod;
+        return $this;
+    }
+
+    /**
+     * The URL that Twilio will request if an error occurs retrieving or executing the TwiML from `SmsUrl`.
+     * 
+     * @param string $smsFallbackUrl Fallback URL if there's an error parsing TwiML
+     * @return $this Fluent Builder
+     */
+    public function setSmsFallbackUrl($smsFallbackUrl) {
+        $this->options['smsFallbackUrl'] = $smsFallbackUrl;
+        return $this;
+    }
+
+    /**
+     * The HTTP method Twilio will use when requesting the above URL. Either `GET` or `POST`.
+     * 
+     * @param string $smsFallbackMethod HTTP method to use with sms_fallback_method
+     * @return $this Fluent Builder
+     */
+    public function setSmsFallbackMethod($smsFallbackMethod) {
+        $this->options['smsFallbackMethod'] = $smsFallbackMethod;
+        return $this;
+    }
+
+    /**
+     * The URL that Twilio will `POST` to when a message is sent via the `/SMS/Messages` endpoint if you specify the `Sid` of this application on an outgoing SMS request.
+     * 
+     * @param string $smsStatusCallback URL Twilio with request with status updates
+     * @return $this Fluent Builder
+     */
+    public function setSmsStatusCallback($smsStatusCallback) {
+        $this->options['smsStatusCallback'] = $smsStatusCallback;
+        return $this;
+    }
+
+    /**
+     * Twilio will make a `POST` request to this URL to pass status parameters (such as sent or failed) to your application if you use the `/Messages` endpoint to send the message and specify this application's `Sid` as the `ApplicationSid` on an outgoing SMS request.
+     * 
+     * @param string $messageStatusCallback URL to make requests to with status
+     *                                      updates
+     * @return $this Fluent Builder
+     */
+    public function setMessageStatusCallback($messageStatusCallback) {
+        $this->options['messageStatusCallback'] = $messageStatusCallback;
+        return $this;
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        $options = array();
+        foreach ($this->options as $key => $value) {
+            if ($value != Values::NONE) {
+                $options[] = "$key=$value";
+            }
+        }
+        return '[Twilio.Api.V2010.CreateApplicationOptions ' . implode(' ', $options) . ']';
+    }
+}
+
+class ReadApplicationOptions extends Options {
+    /**
+     * @param string $friendlyName Filter by friendly name
+     */
+    public function __construct($friendlyName = Values::NONE) {
+        $this->options['friendlyName'] = $friendlyName;
+    }
+
+    /**
+     * Only return application resources with friendly names that match exactly with this name
+     * 
+     * @param string $friendlyName Filter by friendly name
+     * @return $this Fluent Builder
+     */
+    public function setFriendlyName($friendlyName) {
+        $this->options['friendlyName'] = $friendlyName;
+        return $this;
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        $options = array();
+        foreach ($this->options as $key => $value) {
+            if ($value != Values::NONE) {
+                $options[] = "$key=$value";
+            }
+        }
+        return '[Twilio.Api.V2010.ReadApplicationOptions ' . implode(' ', $options) . ']';
+    }
+}
+
+class UpdateApplicationOptions extends Options {
+    /**
+     * @param string $friendlyName Human readable description of this resource
+     * @param string $apiVersion The API version to use
+     * @param string $voiceUrl URL Twilio will make requests to when relieving a
+     *                         call
+     * @param string $voiceMethod HTTP method to use with the URL
+     * @param string $voiceFallbackUrl Fallback URL
+     * @param string $voiceFallbackMethod HTTP method to use with the fallback url
+     * @param string $statusCallback URL to hit with status updates
+     * @param string $statusCallbackMethod HTTP method to use with the status
+     *                                     callback
+     * @param boolean $voiceCallerIdLookup True or False
+     * @param string $smsUrl URL Twilio will request when receiving an SMS
+     * @param string $smsMethod HTTP method to use with sms_url
+     * @param string $smsFallbackUrl Fallback URL if there's an error parsing TwiML
+     * @param string $smsFallbackMethod HTTP method to use with sms_fallback_method
+     * @param string $smsStatusCallback URL Twilio with request with status updates
+     * @param string $messageStatusCallback URL to make requests to with status
+     *                                      updates
+     */
+    public function __construct($friendlyName = Values::NONE, $apiVersion = Values::NONE, $voiceUrl = Values::NONE, $voiceMethod = Values::NONE, $voiceFallbackUrl = Values::NONE, $voiceFallbackMethod = Values::NONE, $statusCallback = Values::NONE, $statusCallbackMethod = Values::NONE, $voiceCallerIdLookup = Values::NONE, $smsUrl = Values::NONE, $smsMethod = Values::NONE, $smsFallbackUrl = Values::NONE, $smsFallbackMethod = Values::NONE, $smsStatusCallback = Values::NONE, $messageStatusCallback = Values::NONE) {
+        $this->options['friendlyName'] = $friendlyName;
+        $this->options['apiVersion'] = $apiVersion;
+        $this->options['voiceUrl'] = $voiceUrl;
+        $this->options['voiceMethod'] = $voiceMethod;
+        $this->options['voiceFallbackUrl'] = $voiceFallbackUrl;
+        $this->options['voiceFallbackMethod'] = $voiceFallbackMethod;
+        $this->options['statusCallback'] = $statusCallback;
+        $this->options['statusCallbackMethod'] = $statusCallbackMethod;
+        $this->options['voiceCallerIdLookup'] = $voiceCallerIdLookup;
+        $this->options['smsUrl'] = $smsUrl;
+        $this->options['smsMethod'] = $smsMethod;
+        $this->options['smsFallbackUrl'] = $smsFallbackUrl;
+        $this->options['smsFallbackMethod'] = $smsFallbackMethod;
+        $this->options['smsStatusCallback'] = $smsStatusCallback;
+        $this->options['messageStatusCallback'] = $messageStatusCallback;
+    }
+
+    /**
+     * A human readable descriptive text for this resource, up to 64 characters long.
+     * 
+     * @param string $friendlyName Human readable description of this resource
+     * @return $this Fluent Builder
+     */
+    public function setFriendlyName($friendlyName) {
+        $this->options['friendlyName'] = $friendlyName;
+        return $this;
+    }
+
+    /**
+     * Requests to this application will start a new TwiML session with this API version.
+     * 
+     * @param string $apiVersion The API version to use
+     * @return $this Fluent Builder
+     */
+    public function setApiVersion($apiVersion) {
+        $this->options['apiVersion'] = $apiVersion;
+        return $this;
+    }
+
+    /**
+     * The URL Twilio will request when a phone number assigned to this application receives a call.
+     * 
+     * @param string $voiceUrl URL Twilio will make requests to when relieving a
+     *                         call
+     * @return $this Fluent Builder
+     */
+    public function setVoiceUrl($voiceUrl) {
+        $this->options['voiceUrl'] = $voiceUrl;
+        return $this;
+    }
+
+    /**
+     * The HTTP method Twilio will use when requesting the above `Url`. Either `GET` or `POST`.
+     * 
+     * @param string $voiceMethod HTTP method to use with the URL
+     * @return $this Fluent Builder
+     */
+    public function setVoiceMethod($voiceMethod) {
+        $this->options['voiceMethod'] = $voiceMethod;
+        return $this;
+    }
+
+    /**
+     * The URL that Twilio will request if an error occurs retrieving or executing the TwiML requested by `Url`.
+     * 
+     * @param string $voiceFallbackUrl Fallback URL
+     * @return $this Fluent Builder
+     */
+    public function setVoiceFallbackUrl($voiceFallbackUrl) {
+        $this->options['voiceFallbackUrl'] = $voiceFallbackUrl;
+        return $this;
+    }
+
+    /**
+     * The HTTP method Twilio will use when requesting the `VoiceFallbackUrl`. Either `GET` or `POST`.
+     * 
+     * @param string $voiceFallbackMethod HTTP method to use with the fallback url
+     * @return $this Fluent Builder
+     */
+    public function setVoiceFallbackMethod($voiceFallbackMethod) {
+        $this->options['voiceFallbackMethod'] = $voiceFallbackMethod;
+        return $this;
+    }
+
+    /**
+     * The URL that Twilio will request to pass status parameters (such as call ended) to your application.
+     * 
+     * @param string $statusCallback URL to hit with status updates
+     * @return $this Fluent Builder
+     */
+    public function setStatusCallback($statusCallback) {
+        $this->options['statusCallback'] = $statusCallback;
+        return $this;
+    }
+
+    /**
+     * The HTTP method Twilio will use to make requests to the `StatusCallback` URL. Either `GET` or `POST`.
+     * 
+     * @param string $statusCallbackMethod HTTP method to use with the status
+     *                                     callback
+     * @return $this Fluent Builder
+     */
+    public function setStatusCallbackMethod($statusCallbackMethod) {
+        $this->options['statusCallbackMethod'] = $statusCallbackMethod;
+        return $this;
+    }
+
+    /**
+     * Look up the caller's caller-ID name from the CNAM database (additional charges apply). Either `true` or `false`.
+     * 
+     * @param boolean $voiceCallerIdLookup True or False
+     * @return $this Fluent Builder
+     */
+    public function setVoiceCallerIdLookup($voiceCallerIdLookup) {
+        $this->options['voiceCallerIdLookup'] = $voiceCallerIdLookup;
+        return $this;
+    }
+
+    /**
+     * The URL Twilio will request when a phone number assigned to this application receives an incoming SMS message.
+     * 
+     * @param string $smsUrl URL Twilio will request when receiving an SMS
+     * @return $this Fluent Builder
+     */
+    public function setSmsUrl($smsUrl) {
+        $this->options['smsUrl'] = $smsUrl;
+        return $this;
+    }
+
+    /**
+     * The HTTP method Twilio will use when making requests to the `SmsUrl`. Either `GET` or `POST`.
+     * 
+     * @param string $smsMethod HTTP method to use with sms_url
+     * @return $this Fluent Builder
+     */
+    public function setSmsMethod($smsMethod) {
+        $this->options['smsMethod'] = $smsMethod;
+        return $this;
+    }
+
+    /**
+     * The URL that Twilio will request if an error occurs retrieving or executing the TwiML from `SmsUrl`.
+     * 
+     * @param string $smsFallbackUrl Fallback URL if there's an error parsing TwiML
+     * @return $this Fluent Builder
+     */
+    public function setSmsFallbackUrl($smsFallbackUrl) {
+        $this->options['smsFallbackUrl'] = $smsFallbackUrl;
+        return $this;
+    }
+
+    /**
+     * The HTTP method Twilio will use when requesting the above URL. Either `GET` or `POST`.
+     * 
+     * @param string $smsFallbackMethod HTTP method to use with sms_fallback_method
+     * @return $this Fluent Builder
+     */
+    public function setSmsFallbackMethod($smsFallbackMethod) {
+        $this->options['smsFallbackMethod'] = $smsFallbackMethod;
+        return $this;
+    }
+
+    /**
+     * The URL that Twilio will `POST` to when a message is sent via the `/SMS/Messages` endpoint if you specify the `Sid` of this application on an outgoing SMS request.
+     * 
+     * @param string $smsStatusCallback URL Twilio with request with status updates
+     * @return $this Fluent Builder
+     */
+    public function setSmsStatusCallback($smsStatusCallback) {
+        $this->options['smsStatusCallback'] = $smsStatusCallback;
+        return $this;
+    }
+
+    /**
+     * Twilio will make a `POST` request to this URL to pass status parameters (such as sent or failed) to your application if you use the `/Messages` endpoint to send the message and specify this application's `Sid` as the `ApplicationSid` on an outgoing SMS request.
+     * 
+     * @param string $messageStatusCallback URL to make requests to with status
+     *                                      updates
+     * @return $this Fluent Builder
+     */
+    public function setMessageStatusCallback($messageStatusCallback) {
+        $this->options['messageStatusCallback'] = $messageStatusCallback;
+        return $this;
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        $options = array();
+        foreach ($this->options as $key => $value) {
+            if ($value != Values::NONE) {
+                $options[] = "$key=$value";
+            }
+        }
+        return '[Twilio.Api.V2010.UpdateApplicationOptions ' . implode(' ', $options) . ']';
+    }
+}

+ 34 - 0
plugins/Twilio/Rest/Api/V2010/Account/ApplicationPage.php

@@ -0,0 +1,34 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account;
+
+use Twilio\Page;
+
+class ApplicationPage extends Page {
+    public function __construct($version, $response, $solution) {
+        parent::__construct($version, $response);
+
+        // Path Solution
+        $this->solution = $solution;
+    }
+
+    public function buildInstance(array $payload) {
+        return new ApplicationInstance($this->version, $payload, $this->solution['accountSid']);
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        return '[Twilio.Api.V2010.ApplicationPage]';
+    }
+}

+ 68 - 0
plugins/Twilio/Rest/Api/V2010/Account/AuthorizedConnectAppContext.php

@@ -0,0 +1,68 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account;
+
+use Twilio\InstanceContext;
+use Twilio\Values;
+use Twilio\Version;
+
+class AuthorizedConnectAppContext extends InstanceContext {
+    /**
+     * Initialize the AuthorizedConnectAppContext
+     * 
+     * @param \Twilio\Version $version Version that contains the resource
+     * @param string $accountSid The account_sid
+     * @param string $connectAppSid The connect_app_sid
+     * @return \Twilio\Rest\Api\V2010\Account\AuthorizedConnectAppContext 
+     */
+    public function __construct(Version $version, $accountSid, $connectAppSid) {
+        parent::__construct($version);
+
+        // Path Solution
+        $this->solution = array('accountSid' => $accountSid, 'connectAppSid' => $connectAppSid, );
+
+        $this->uri = '/Accounts/' . rawurlencode($accountSid) . '/AuthorizedConnectApps/' . rawurlencode($connectAppSid) . '.json';
+    }
+
+    /**
+     * Fetch a AuthorizedConnectAppInstance
+     * 
+     * @return AuthorizedConnectAppInstance Fetched AuthorizedConnectAppInstance
+     */
+    public function fetch() {
+        $params = Values::of(array());
+
+        $payload = $this->version->fetch(
+            'GET',
+            $this->uri,
+            $params
+        );
+
+        return new AuthorizedConnectAppInstance(
+            $this->version,
+            $payload,
+            $this->solution['accountSid'],
+            $this->solution['connectAppSid']
+        );
+    }
+
+    /**
+     * 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.Api.V2010.AuthorizedConnectAppContext ' . implode(' ', $context) . ']';
+    }
+}

+ 124 - 0
plugins/Twilio/Rest/Api/V2010/Account/AuthorizedConnectAppInstance.php

@@ -0,0 +1,124 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account;
+
+use Twilio\Deserialize;
+use Twilio\Exceptions\TwilioException;
+use Twilio\InstanceResource;
+use Twilio\Values;
+use Twilio\Version;
+
+/**
+ * @property string accountSid
+ * @property string connectAppCompanyName
+ * @property string connectAppDescription
+ * @property string connectAppFriendlyName
+ * @property string connectAppHomepageUrl
+ * @property string connectAppSid
+ * @property \DateTime dateCreated
+ * @property \DateTime dateUpdated
+ * @property string permissions
+ * @property string uri
+ */
+class AuthorizedConnectAppInstance extends InstanceResource {
+    /**
+     * Initialize the AuthorizedConnectAppInstance
+     * 
+     * @param \Twilio\Version $version Version that contains the resource
+     * @param mixed[] $payload The response payload
+     * @param string $accountSid The unique sid that identifies this account
+     * @param string $connectAppSid The connect_app_sid
+     * @return \Twilio\Rest\Api\V2010\Account\AuthorizedConnectAppInstance 
+     */
+    public function __construct(Version $version, array $payload, $accountSid, $connectAppSid = null) {
+        parent::__construct($version);
+
+        // Marshaled Properties
+        $this->properties = array(
+            'accountSid' => Values::array_get($payload, 'account_sid'),
+            'connectAppCompanyName' => Values::array_get($payload, 'connect_app_company_name'),
+            'connectAppDescription' => Values::array_get($payload, 'connect_app_description'),
+            'connectAppFriendlyName' => Values::array_get($payload, 'connect_app_friendly_name'),
+            'connectAppHomepageUrl' => Values::array_get($payload, 'connect_app_homepage_url'),
+            'connectAppSid' => Values::array_get($payload, 'connect_app_sid'),
+            'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')),
+            'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')),
+            'permissions' => Values::array_get($payload, 'permissions'),
+            'uri' => Values::array_get($payload, 'uri'),
+        );
+
+        $this->solution = array(
+            'accountSid' => $accountSid,
+            'connectAppSid' => $connectAppSid ?: $this->properties['connectAppSid'],
+        );
+    }
+
+    /**
+     * 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\Api\V2010\Account\AuthorizedConnectAppContext Context
+     *                                                                    for this
+     *                                                                    AuthorizedConnectAppInstance
+     */
+    protected function proxy() {
+        if (!$this->context) {
+            $this->context = new AuthorizedConnectAppContext(
+                $this->version,
+                $this->solution['accountSid'],
+                $this->solution['connectAppSid']
+            );
+        }
+
+        return $this->context;
+    }
+
+    /**
+     * Fetch a AuthorizedConnectAppInstance
+     * 
+     * @return AuthorizedConnectAppInstance Fetched AuthorizedConnectAppInstance
+     */
+    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.Api.V2010.AuthorizedConnectAppInstance ' . implode(' ', $context) . ']';
+    }
+}

+ 143 - 0
plugins/Twilio/Rest/Api/V2010/Account/AuthorizedConnectAppList.php

@@ -0,0 +1,143 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account;
+
+use Twilio\ListResource;
+use Twilio\Values;
+use Twilio\Version;
+
+class AuthorizedConnectAppList extends ListResource {
+    /**
+     * Construct the AuthorizedConnectAppList
+     * 
+     * @param Version $version Version that contains the resource
+     * @param string $accountSid The unique sid that identifies this account
+     * @return \Twilio\Rest\Api\V2010\Account\AuthorizedConnectAppList 
+     */
+    public function __construct(Version $version, $accountSid) {
+        parent::__construct($version);
+
+        // Path Solution
+        $this->solution = array('accountSid' => $accountSid, );
+
+        $this->uri = '/Accounts/' . rawurlencode($accountSid) . '/AuthorizedConnectApps.json';
+    }
+
+    /**
+     * Streams AuthorizedConnectAppInstance 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 AuthorizedConnectAppInstance 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 AuthorizedConnectAppInstance[] Array of results
+     */
+    public function read($limit = null, $pageSize = null) {
+        return iterator_to_array($this->stream($limit, $pageSize), false);
+    }
+
+    /**
+     * Retrieve a single page of AuthorizedConnectAppInstance 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 AuthorizedConnectAppInstance
+     */
+    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 AuthorizedConnectAppPage($this->version, $response, $this->solution);
+    }
+
+    /**
+     * Retrieve a specific page of AuthorizedConnectAppInstance records from the
+     * API.
+     * Request is executed immediately
+     * 
+     * @param string $targetUrl API-generated URL for the requested results page
+     * @return \Twilio\Page Page of AuthorizedConnectAppInstance
+     */
+    public function getPage($targetUrl) {
+        $response = $this->version->getDomain()->getClient()->request(
+            'GET',
+            $targetUrl
+        );
+
+        return new AuthorizedConnectAppPage($this->version, $response, $this->solution);
+    }
+
+    /**
+     * Constructs a AuthorizedConnectAppContext
+     * 
+     * @param string $connectAppSid The connect_app_sid
+     * @return \Twilio\Rest\Api\V2010\Account\AuthorizedConnectAppContext 
+     */
+    public function getContext($connectAppSid) {
+        return new AuthorizedConnectAppContext(
+            $this->version,
+            $this->solution['accountSid'],
+            $connectAppSid
+        );
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        return '[Twilio.Api.V2010.AuthorizedConnectAppList]';
+    }
+}

+ 34 - 0
plugins/Twilio/Rest/Api/V2010/Account/AuthorizedConnectAppPage.php

@@ -0,0 +1,34 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account;
+
+use Twilio\Page;
+
+class AuthorizedConnectAppPage extends Page {
+    public function __construct($version, $response, $solution) {
+        parent::__construct($version, $response);
+
+        // Path Solution
+        $this->solution = $solution;
+    }
+
+    public function buildInstance(array $payload) {
+        return new AuthorizedConnectAppInstance($this->version, $payload, $this->solution['accountSid']);
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        return '[Twilio.Api.V2010.AuthorizedConnectAppPage]';
+    }
+}

+ 94 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/LocalInstance.php

@@ -0,0 +1,94 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry;
+
+use Twilio\Exceptions\TwilioException;
+use Twilio\InstanceResource;
+use Twilio\Values;
+use Twilio\Version;
+
+/**
+ * @property string friendlyName
+ * @property string phoneNumber
+ * @property string lata
+ * @property string locality
+ * @property string rateCenter
+ * @property string latitude
+ * @property string longitude
+ * @property string region
+ * @property string postalCode
+ * @property string isoCountry
+ * @property string addressRequirements
+ * @property boolean beta
+ * @property string capabilities
+ */
+class LocalInstance extends InstanceResource {
+    /**
+     * Initialize the LocalInstance
+     * 
+     * @param \Twilio\Version $version Version that contains the resource
+     * @param mixed[] $payload The response payload
+     * @param string $accountSid The 34 character string that uniquely identifies
+     *                           your account.
+     * @param string $countryCode The ISO Country code to lookup phone numbers for.
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\LocalInstance 
+     */
+    public function __construct(Version $version, array $payload, $accountSid, $countryCode) {
+        parent::__construct($version);
+
+        // Marshaled Properties
+        $this->properties = array(
+            'friendlyName' => Values::array_get($payload, 'friendly_name'),
+            'phoneNumber' => Values::array_get($payload, 'phone_number'),
+            'lata' => Values::array_get($payload, 'lata'),
+            'locality' => Values::array_get($payload, 'locality'),
+            'rateCenter' => Values::array_get($payload, 'rate_center'),
+            'latitude' => Values::array_get($payload, 'latitude'),
+            'longitude' => Values::array_get($payload, 'longitude'),
+            'region' => Values::array_get($payload, 'region'),
+            'postalCode' => Values::array_get($payload, 'postal_code'),
+            'isoCountry' => Values::array_get($payload, 'iso_country'),
+            'addressRequirements' => Values::array_get($payload, 'address_requirements'),
+            'beta' => Values::array_get($payload, 'beta'),
+            'capabilities' => Values::array_get($payload, 'capabilities'),
+        );
+
+        $this->solution = array('accountSid' => $accountSid, 'countryCode' => $countryCode, );
+    }
+
+    /**
+     * 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.Api.V2010.LocalInstance]';
+    }
+}

+ 153 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/LocalList.php

@@ -0,0 +1,153 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry;
+
+use Twilio\ListResource;
+use Twilio\Options;
+use Twilio\Serialize;
+use Twilio\Values;
+use Twilio\Version;
+
+class LocalList extends ListResource {
+    /**
+     * Construct the LocalList
+     * 
+     * @param Version $version Version that contains the resource
+     * @param string $accountSid The 34 character string that uniquely identifies
+     *                           your account.
+     * @param string $countryCode The ISO Country code to lookup phone numbers for.
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\LocalList 
+     */
+    public function __construct(Version $version, $accountSid, $countryCode) {
+        parent::__construct($version);
+
+        // Path Solution
+        $this->solution = array('accountSid' => $accountSid, 'countryCode' => $countryCode, );
+
+        $this->uri = '/Accounts/' . rawurlencode($accountSid) . '/AvailablePhoneNumbers/' . rawurlencode($countryCode) . '/Local.json';
+    }
+
+    /**
+     * Streams LocalInstance records from the API as a generator stream.
+     * This operation lazily loads records as efficiently as possible until the
+     * limit
+     * is reached.
+     * The results are returned as a generator, so this operation is memory
+     * efficient.
+     * 
+     * @param array|Options $options Optional Arguments
+     * @param int $limit Upper limit for the number of records to return. stream()
+     *                   guarantees to never return more than limit.  Default is no
+     *                   limit
+     * @param mixed $pageSize Number of records to fetch per request, when not set
+     *                        will use the default value of 50 records.  If no
+     *                        page_size is defined but a limit is defined, stream()
+     *                        will attempt to read the limit with the most
+     *                        efficient page size, i.e. min(limit, 1000)
+     * @return \Twilio\Stream stream of results
+     */
+    public function stream($options = array(), $limit = null, $pageSize = null) {
+        $limits = $this->version->readLimits($limit, $pageSize);
+
+        $page = $this->page($options, $limits['pageSize']);
+
+        return $this->version->stream($page, $limits['limit'], $limits['pageLimit']);
+    }
+
+    /**
+     * Reads LocalInstance records from the API as a list.
+     * Unlike stream(), this operation is eager and will load `limit` records into
+     * memory before returning.
+     * 
+     * @param array|Options $options Optional Arguments
+     * @param int $limit Upper limit for the number of records to return. read()
+     *                   guarantees to never return more than limit.  Default is no
+     *                   limit
+     * @param mixed $pageSize Number of records to fetch per request, when not set
+     *                        will use the default value of 50 records.  If no
+     *                        page_size is defined but a limit is defined, read()
+     *                        will attempt to read the limit with the most
+     *                        efficient page size, i.e. min(limit, 1000)
+     * @return LocalInstance[] Array of results
+     */
+    public function read($options = array(), $limit = null, $pageSize = null) {
+        return iterator_to_array($this->stream($options, $limit, $pageSize), false);
+    }
+
+    /**
+     * Retrieve a single page of LocalInstance records from the API.
+     * Request is executed immediately
+     * 
+     * @param array|Options $options Optional Arguments
+     * @param mixed $pageSize Number of records to return, defaults to 50
+     * @param string $pageToken PageToken provided by the API
+     * @param mixed $pageNumber Page Number, this value is simply for client state
+     * @return \Twilio\Page Page of LocalInstance
+     */
+    public function page($options = array(), $pageSize = Values::NONE, $pageToken = Values::NONE, $pageNumber = Values::NONE) {
+        $options = new Values($options);
+        $params = Values::of(array(
+            'AreaCode' => $options['areaCode'],
+            'Contains' => $options['contains'],
+            'SmsEnabled' => Serialize::booleanToString($options['smsEnabled']),
+            'MmsEnabled' => Serialize::booleanToString($options['mmsEnabled']),
+            'VoiceEnabled' => Serialize::booleanToString($options['voiceEnabled']),
+            'ExcludeAllAddressRequired' => Serialize::booleanToString($options['excludeAllAddressRequired']),
+            'ExcludeLocalAddressRequired' => Serialize::booleanToString($options['excludeLocalAddressRequired']),
+            'ExcludeForeignAddressRequired' => Serialize::booleanToString($options['excludeForeignAddressRequired']),
+            'Beta' => Serialize::booleanToString($options['beta']),
+            'NearNumber' => $options['nearNumber'],
+            'NearLatLong' => $options['nearLatLong'],
+            'Distance' => $options['distance'],
+            'InPostalCode' => $options['inPostalCode'],
+            'InRegion' => $options['inRegion'],
+            'InRateCenter' => $options['inRateCenter'],
+            'InLata' => $options['inLata'],
+            'InLocality' => $options['inLocality'],
+            'FaxEnabled' => Serialize::booleanToString($options['faxEnabled']),
+            'PageToken' => $pageToken,
+            'Page' => $pageNumber,
+            'PageSize' => $pageSize,
+        ));
+
+        $response = $this->version->page(
+            'GET',
+            $this->uri,
+            $params
+        );
+
+        return new LocalPage($this->version, $response, $this->solution);
+    }
+
+    /**
+     * Retrieve a specific page of LocalInstance records from the API.
+     * Request is executed immediately
+     * 
+     * @param string $targetUrl API-generated URL for the requested results page
+     * @return \Twilio\Page Page of LocalInstance
+     */
+    public function getPage($targetUrl) {
+        $response = $this->version->getDomain()->getClient()->request(
+            'GET',
+            $targetUrl
+        );
+
+        return new LocalPage($this->version, $response, $this->solution);
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        return '[Twilio.Api.V2010.LocalList]';
+    }
+}

+ 302 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/LocalOptions.php

@@ -0,0 +1,302 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry;
+
+use Twilio\Options;
+use Twilio\Values;
+
+abstract class LocalOptions {
+    /**
+     * @param integer $areaCode The area_code
+     * @param string $contains The contains
+     * @param boolean $smsEnabled The sms_enabled
+     * @param boolean $mmsEnabled The mms_enabled
+     * @param boolean $voiceEnabled The voice_enabled
+     * @param boolean $excludeAllAddressRequired The exclude_all_address_required
+     * @param boolean $excludeLocalAddressRequired The
+     *                                             exclude_local_address_required
+     * @param boolean $excludeForeignAddressRequired The
+     *                                               exclude_foreign_address_required
+     * @param boolean $beta The beta
+     * @param string $nearNumber The near_number
+     * @param string $nearLatLong The near_lat_long
+     * @param integer $distance The distance
+     * @param string $inPostalCode The in_postal_code
+     * @param string $inRegion The in_region
+     * @param string $inRateCenter The in_rate_center
+     * @param string $inLata The in_lata
+     * @param string $inLocality The in_locality
+     * @param boolean $faxEnabled The fax_enabled
+     * @return ReadLocalOptions Options builder
+     */
+    public static function read($areaCode = Values::NONE, $contains = Values::NONE, $smsEnabled = Values::NONE, $mmsEnabled = Values::NONE, $voiceEnabled = Values::NONE, $excludeAllAddressRequired = Values::NONE, $excludeLocalAddressRequired = Values::NONE, $excludeForeignAddressRequired = Values::NONE, $beta = Values::NONE, $nearNumber = Values::NONE, $nearLatLong = Values::NONE, $distance = Values::NONE, $inPostalCode = Values::NONE, $inRegion = Values::NONE, $inRateCenter = Values::NONE, $inLata = Values::NONE, $inLocality = Values::NONE, $faxEnabled = Values::NONE) {
+        return new ReadLocalOptions($areaCode, $contains, $smsEnabled, $mmsEnabled, $voiceEnabled, $excludeAllAddressRequired, $excludeLocalAddressRequired, $excludeForeignAddressRequired, $beta, $nearNumber, $nearLatLong, $distance, $inPostalCode, $inRegion, $inRateCenter, $inLata, $inLocality, $faxEnabled);
+    }
+}
+
+class ReadLocalOptions extends Options {
+    /**
+     * @param integer $areaCode The area_code
+     * @param string $contains The contains
+     * @param boolean $smsEnabled The sms_enabled
+     * @param boolean $mmsEnabled The mms_enabled
+     * @param boolean $voiceEnabled The voice_enabled
+     * @param boolean $excludeAllAddressRequired The exclude_all_address_required
+     * @param boolean $excludeLocalAddressRequired The
+     *                                             exclude_local_address_required
+     * @param boolean $excludeForeignAddressRequired The
+     *                                               exclude_foreign_address_required
+     * @param boolean $beta The beta
+     * @param string $nearNumber The near_number
+     * @param string $nearLatLong The near_lat_long
+     * @param integer $distance The distance
+     * @param string $inPostalCode The in_postal_code
+     * @param string $inRegion The in_region
+     * @param string $inRateCenter The in_rate_center
+     * @param string $inLata The in_lata
+     * @param string $inLocality The in_locality
+     * @param boolean $faxEnabled The fax_enabled
+     */
+    public function __construct($areaCode = Values::NONE, $contains = Values::NONE, $smsEnabled = Values::NONE, $mmsEnabled = Values::NONE, $voiceEnabled = Values::NONE, $excludeAllAddressRequired = Values::NONE, $excludeLocalAddressRequired = Values::NONE, $excludeForeignAddressRequired = Values::NONE, $beta = Values::NONE, $nearNumber = Values::NONE, $nearLatLong = Values::NONE, $distance = Values::NONE, $inPostalCode = Values::NONE, $inRegion = Values::NONE, $inRateCenter = Values::NONE, $inLata = Values::NONE, $inLocality = Values::NONE, $faxEnabled = Values::NONE) {
+        $this->options['areaCode'] = $areaCode;
+        $this->options['contains'] = $contains;
+        $this->options['smsEnabled'] = $smsEnabled;
+        $this->options['mmsEnabled'] = $mmsEnabled;
+        $this->options['voiceEnabled'] = $voiceEnabled;
+        $this->options['excludeAllAddressRequired'] = $excludeAllAddressRequired;
+        $this->options['excludeLocalAddressRequired'] = $excludeLocalAddressRequired;
+        $this->options['excludeForeignAddressRequired'] = $excludeForeignAddressRequired;
+        $this->options['beta'] = $beta;
+        $this->options['nearNumber'] = $nearNumber;
+        $this->options['nearLatLong'] = $nearLatLong;
+        $this->options['distance'] = $distance;
+        $this->options['inPostalCode'] = $inPostalCode;
+        $this->options['inRegion'] = $inRegion;
+        $this->options['inRateCenter'] = $inRateCenter;
+        $this->options['inLata'] = $inLata;
+        $this->options['inLocality'] = $inLocality;
+        $this->options['faxEnabled'] = $faxEnabled;
+    }
+
+    /**
+     * The area_code
+     * 
+     * @param integer $areaCode The area_code
+     * @return $this Fluent Builder
+     */
+    public function setAreaCode($areaCode) {
+        $this->options['areaCode'] = $areaCode;
+        return $this;
+    }
+
+    /**
+     * The contains
+     * 
+     * @param string $contains The contains
+     * @return $this Fluent Builder
+     */
+    public function setContains($contains) {
+        $this->options['contains'] = $contains;
+        return $this;
+    }
+
+    /**
+     * The sms_enabled
+     * 
+     * @param boolean $smsEnabled The sms_enabled
+     * @return $this Fluent Builder
+     */
+    public function setSmsEnabled($smsEnabled) {
+        $this->options['smsEnabled'] = $smsEnabled;
+        return $this;
+    }
+
+    /**
+     * The mms_enabled
+     * 
+     * @param boolean $mmsEnabled The mms_enabled
+     * @return $this Fluent Builder
+     */
+    public function setMmsEnabled($mmsEnabled) {
+        $this->options['mmsEnabled'] = $mmsEnabled;
+        return $this;
+    }
+
+    /**
+     * The voice_enabled
+     * 
+     * @param boolean $voiceEnabled The voice_enabled
+     * @return $this Fluent Builder
+     */
+    public function setVoiceEnabled($voiceEnabled) {
+        $this->options['voiceEnabled'] = $voiceEnabled;
+        return $this;
+    }
+
+    /**
+     * The exclude_all_address_required
+     * 
+     * @param boolean $excludeAllAddressRequired The exclude_all_address_required
+     * @return $this Fluent Builder
+     */
+    public function setExcludeAllAddressRequired($excludeAllAddressRequired) {
+        $this->options['excludeAllAddressRequired'] = $excludeAllAddressRequired;
+        return $this;
+    }
+
+    /**
+     * The exclude_local_address_required
+     * 
+     * @param boolean $excludeLocalAddressRequired The
+     *                                             exclude_local_address_required
+     * @return $this Fluent Builder
+     */
+    public function setExcludeLocalAddressRequired($excludeLocalAddressRequired) {
+        $this->options['excludeLocalAddressRequired'] = $excludeLocalAddressRequired;
+        return $this;
+    }
+
+    /**
+     * The exclude_foreign_address_required
+     * 
+     * @param boolean $excludeForeignAddressRequired The
+     *                                               exclude_foreign_address_required
+     * @return $this Fluent Builder
+     */
+    public function setExcludeForeignAddressRequired($excludeForeignAddressRequired) {
+        $this->options['excludeForeignAddressRequired'] = $excludeForeignAddressRequired;
+        return $this;
+    }
+
+    /**
+     * The beta
+     * 
+     * @param boolean $beta The beta
+     * @return $this Fluent Builder
+     */
+    public function setBeta($beta) {
+        $this->options['beta'] = $beta;
+        return $this;
+    }
+
+    /**
+     * The near_number
+     * 
+     * @param string $nearNumber The near_number
+     * @return $this Fluent Builder
+     */
+    public function setNearNumber($nearNumber) {
+        $this->options['nearNumber'] = $nearNumber;
+        return $this;
+    }
+
+    /**
+     * The near_lat_long
+     * 
+     * @param string $nearLatLong The near_lat_long
+     * @return $this Fluent Builder
+     */
+    public function setNearLatLong($nearLatLong) {
+        $this->options['nearLatLong'] = $nearLatLong;
+        return $this;
+    }
+
+    /**
+     * The distance
+     * 
+     * @param integer $distance The distance
+     * @return $this Fluent Builder
+     */
+    public function setDistance($distance) {
+        $this->options['distance'] = $distance;
+        return $this;
+    }
+
+    /**
+     * The in_postal_code
+     * 
+     * @param string $inPostalCode The in_postal_code
+     * @return $this Fluent Builder
+     */
+    public function setInPostalCode($inPostalCode) {
+        $this->options['inPostalCode'] = $inPostalCode;
+        return $this;
+    }
+
+    /**
+     * The in_region
+     * 
+     * @param string $inRegion The in_region
+     * @return $this Fluent Builder
+     */
+    public function setInRegion($inRegion) {
+        $this->options['inRegion'] = $inRegion;
+        return $this;
+    }
+
+    /**
+     * The in_rate_center
+     * 
+     * @param string $inRateCenter The in_rate_center
+     * @return $this Fluent Builder
+     */
+    public function setInRateCenter($inRateCenter) {
+        $this->options['inRateCenter'] = $inRateCenter;
+        return $this;
+    }
+
+    /**
+     * The in_lata
+     * 
+     * @param string $inLata The in_lata
+     * @return $this Fluent Builder
+     */
+    public function setInLata($inLata) {
+        $this->options['inLata'] = $inLata;
+        return $this;
+    }
+
+    /**
+     * The in_locality
+     * 
+     * @param string $inLocality The in_locality
+     * @return $this Fluent Builder
+     */
+    public function setInLocality($inLocality) {
+        $this->options['inLocality'] = $inLocality;
+        return $this;
+    }
+
+    /**
+     * The fax_enabled
+     * 
+     * @param boolean $faxEnabled The fax_enabled
+     * @return $this Fluent Builder
+     */
+    public function setFaxEnabled($faxEnabled) {
+        $this->options['faxEnabled'] = $faxEnabled;
+        return $this;
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        $options = array();
+        foreach ($this->options as $key => $value) {
+            if ($value != Values::NONE) {
+                $options[] = "$key=$value";
+            }
+        }
+        return '[Twilio.Api.V2010.ReadLocalOptions ' . implode(' ', $options) . ']';
+    }
+}

+ 39 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/LocalPage.php

@@ -0,0 +1,39 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry;
+
+use Twilio\Page;
+
+class LocalPage extends Page {
+    public function __construct($version, $response, $solution) {
+        parent::__construct($version, $response);
+
+        // Path Solution
+        $this->solution = $solution;
+    }
+
+    public function buildInstance(array $payload) {
+        return new LocalInstance(
+            $this->version,
+            $payload,
+            $this->solution['accountSid'],
+            $this->solution['countryCode']
+        );
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        return '[Twilio.Api.V2010.LocalPage]';
+    }
+}

+ 94 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/MachineToMachineInstance.php

@@ -0,0 +1,94 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry;
+
+use Twilio\Exceptions\TwilioException;
+use Twilio\InstanceResource;
+use Twilio\Values;
+use Twilio\Version;
+
+/**
+ * @property string friendlyName
+ * @property string phoneNumber
+ * @property string lata
+ * @property string locality
+ * @property string rateCenter
+ * @property string latitude
+ * @property string longitude
+ * @property string region
+ * @property string postalCode
+ * @property string isoCountry
+ * @property string addressRequirements
+ * @property boolean beta
+ * @property string capabilities
+ */
+class MachineToMachineInstance extends InstanceResource {
+    /**
+     * Initialize the MachineToMachineInstance
+     * 
+     * @param \Twilio\Version $version Version that contains the resource
+     * @param mixed[] $payload The response payload
+     * @param string $accountSid The 34 character string that uniquely identifies
+     *                           your account.
+     * @param string $countryCode The ISO Country code to lookup phone numbers for.
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\MachineToMachineInstance 
+     */
+    public function __construct(Version $version, array $payload, $accountSid, $countryCode) {
+        parent::__construct($version);
+
+        // Marshaled Properties
+        $this->properties = array(
+            'friendlyName' => Values::array_get($payload, 'friendly_name'),
+            'phoneNumber' => Values::array_get($payload, 'phone_number'),
+            'lata' => Values::array_get($payload, 'lata'),
+            'locality' => Values::array_get($payload, 'locality'),
+            'rateCenter' => Values::array_get($payload, 'rate_center'),
+            'latitude' => Values::array_get($payload, 'latitude'),
+            'longitude' => Values::array_get($payload, 'longitude'),
+            'region' => Values::array_get($payload, 'region'),
+            'postalCode' => Values::array_get($payload, 'postal_code'),
+            'isoCountry' => Values::array_get($payload, 'iso_country'),
+            'addressRequirements' => Values::array_get($payload, 'address_requirements'),
+            'beta' => Values::array_get($payload, 'beta'),
+            'capabilities' => Values::array_get($payload, 'capabilities'),
+        );
+
+        $this->solution = array('accountSid' => $accountSid, 'countryCode' => $countryCode, );
+    }
+
+    /**
+     * 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.Api.V2010.MachineToMachineInstance]';
+    }
+}

+ 153 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/MachineToMachineList.php

@@ -0,0 +1,153 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry;
+
+use Twilio\ListResource;
+use Twilio\Options;
+use Twilio\Serialize;
+use Twilio\Values;
+use Twilio\Version;
+
+class MachineToMachineList extends ListResource {
+    /**
+     * Construct the MachineToMachineList
+     * 
+     * @param Version $version Version that contains the resource
+     * @param string $accountSid The 34 character string that uniquely identifies
+     *                           your account.
+     * @param string $countryCode The ISO Country code to lookup phone numbers for.
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\MachineToMachineList 
+     */
+    public function __construct(Version $version, $accountSid, $countryCode) {
+        parent::__construct($version);
+
+        // Path Solution
+        $this->solution = array('accountSid' => $accountSid, 'countryCode' => $countryCode, );
+
+        $this->uri = '/Accounts/' . rawurlencode($accountSid) . '/AvailablePhoneNumbers/' . rawurlencode($countryCode) . '/MachineToMachine.json';
+    }
+
+    /**
+     * Streams MachineToMachineInstance records from the API as a generator stream.
+     * This operation lazily loads records as efficiently as possible until the
+     * limit
+     * is reached.
+     * The results are returned as a generator, so this operation is memory
+     * efficient.
+     * 
+     * @param array|Options $options Optional Arguments
+     * @param int $limit Upper limit for the number of records to return. stream()
+     *                   guarantees to never return more than limit.  Default is no
+     *                   limit
+     * @param mixed $pageSize Number of records to fetch per request, when not set
+     *                        will use the default value of 50 records.  If no
+     *                        page_size is defined but a limit is defined, stream()
+     *                        will attempt to read the limit with the most
+     *                        efficient page size, i.e. min(limit, 1000)
+     * @return \Twilio\Stream stream of results
+     */
+    public function stream($options = array(), $limit = null, $pageSize = null) {
+        $limits = $this->version->readLimits($limit, $pageSize);
+
+        $page = $this->page($options, $limits['pageSize']);
+
+        return $this->version->stream($page, $limits['limit'], $limits['pageLimit']);
+    }
+
+    /**
+     * Reads MachineToMachineInstance records from the API as a list.
+     * Unlike stream(), this operation is eager and will load `limit` records into
+     * memory before returning.
+     * 
+     * @param array|Options $options Optional Arguments
+     * @param int $limit Upper limit for the number of records to return. read()
+     *                   guarantees to never return more than limit.  Default is no
+     *                   limit
+     * @param mixed $pageSize Number of records to fetch per request, when not set
+     *                        will use the default value of 50 records.  If no
+     *                        page_size is defined but a limit is defined, read()
+     *                        will attempt to read the limit with the most
+     *                        efficient page size, i.e. min(limit, 1000)
+     * @return MachineToMachineInstance[] Array of results
+     */
+    public function read($options = array(), $limit = null, $pageSize = null) {
+        return iterator_to_array($this->stream($options, $limit, $pageSize), false);
+    }
+
+    /**
+     * Retrieve a single page of MachineToMachineInstance records from the API.
+     * Request is executed immediately
+     * 
+     * @param array|Options $options Optional Arguments
+     * @param mixed $pageSize Number of records to return, defaults to 50
+     * @param string $pageToken PageToken provided by the API
+     * @param mixed $pageNumber Page Number, this value is simply for client state
+     * @return \Twilio\Page Page of MachineToMachineInstance
+     */
+    public function page($options = array(), $pageSize = Values::NONE, $pageToken = Values::NONE, $pageNumber = Values::NONE) {
+        $options = new Values($options);
+        $params = Values::of(array(
+            'AreaCode' => $options['areaCode'],
+            'Contains' => $options['contains'],
+            'SmsEnabled' => Serialize::booleanToString($options['smsEnabled']),
+            'MmsEnabled' => Serialize::booleanToString($options['mmsEnabled']),
+            'VoiceEnabled' => Serialize::booleanToString($options['voiceEnabled']),
+            'ExcludeAllAddressRequired' => Serialize::booleanToString($options['excludeAllAddressRequired']),
+            'ExcludeLocalAddressRequired' => Serialize::booleanToString($options['excludeLocalAddressRequired']),
+            'ExcludeForeignAddressRequired' => Serialize::booleanToString($options['excludeForeignAddressRequired']),
+            'Beta' => Serialize::booleanToString($options['beta']),
+            'NearNumber' => $options['nearNumber'],
+            'NearLatLong' => $options['nearLatLong'],
+            'Distance' => $options['distance'],
+            'InPostalCode' => $options['inPostalCode'],
+            'InRegion' => $options['inRegion'],
+            'InRateCenter' => $options['inRateCenter'],
+            'InLata' => $options['inLata'],
+            'InLocality' => $options['inLocality'],
+            'FaxEnabled' => Serialize::booleanToString($options['faxEnabled']),
+            'PageToken' => $pageToken,
+            'Page' => $pageNumber,
+            'PageSize' => $pageSize,
+        ));
+
+        $response = $this->version->page(
+            'GET',
+            $this->uri,
+            $params
+        );
+
+        return new MachineToMachinePage($this->version, $response, $this->solution);
+    }
+
+    /**
+     * Retrieve a specific page of MachineToMachineInstance records from the API.
+     * Request is executed immediately
+     * 
+     * @param string $targetUrl API-generated URL for the requested results page
+     * @return \Twilio\Page Page of MachineToMachineInstance
+     */
+    public function getPage($targetUrl) {
+        $response = $this->version->getDomain()->getClient()->request(
+            'GET',
+            $targetUrl
+        );
+
+        return new MachineToMachinePage($this->version, $response, $this->solution);
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        return '[Twilio.Api.V2010.MachineToMachineList]';
+    }
+}

+ 302 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/MachineToMachineOptions.php

@@ -0,0 +1,302 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry;
+
+use Twilio\Options;
+use Twilio\Values;
+
+abstract class MachineToMachineOptions {
+    /**
+     * @param integer $areaCode The area_code
+     * @param string $contains The contains
+     * @param boolean $smsEnabled The sms_enabled
+     * @param boolean $mmsEnabled The mms_enabled
+     * @param boolean $voiceEnabled The voice_enabled
+     * @param boolean $excludeAllAddressRequired The exclude_all_address_required
+     * @param boolean $excludeLocalAddressRequired The
+     *                                             exclude_local_address_required
+     * @param boolean $excludeForeignAddressRequired The
+     *                                               exclude_foreign_address_required
+     * @param boolean $beta The beta
+     * @param string $nearNumber The near_number
+     * @param string $nearLatLong The near_lat_long
+     * @param integer $distance The distance
+     * @param string $inPostalCode The in_postal_code
+     * @param string $inRegion The in_region
+     * @param string $inRateCenter The in_rate_center
+     * @param string $inLata The in_lata
+     * @param string $inLocality The in_locality
+     * @param boolean $faxEnabled The fax_enabled
+     * @return ReadMachineToMachineOptions Options builder
+     */
+    public static function read($areaCode = Values::NONE, $contains = Values::NONE, $smsEnabled = Values::NONE, $mmsEnabled = Values::NONE, $voiceEnabled = Values::NONE, $excludeAllAddressRequired = Values::NONE, $excludeLocalAddressRequired = Values::NONE, $excludeForeignAddressRequired = Values::NONE, $beta = Values::NONE, $nearNumber = Values::NONE, $nearLatLong = Values::NONE, $distance = Values::NONE, $inPostalCode = Values::NONE, $inRegion = Values::NONE, $inRateCenter = Values::NONE, $inLata = Values::NONE, $inLocality = Values::NONE, $faxEnabled = Values::NONE) {
+        return new ReadMachineToMachineOptions($areaCode, $contains, $smsEnabled, $mmsEnabled, $voiceEnabled, $excludeAllAddressRequired, $excludeLocalAddressRequired, $excludeForeignAddressRequired, $beta, $nearNumber, $nearLatLong, $distance, $inPostalCode, $inRegion, $inRateCenter, $inLata, $inLocality, $faxEnabled);
+    }
+}
+
+class ReadMachineToMachineOptions extends Options {
+    /**
+     * @param integer $areaCode The area_code
+     * @param string $contains The contains
+     * @param boolean $smsEnabled The sms_enabled
+     * @param boolean $mmsEnabled The mms_enabled
+     * @param boolean $voiceEnabled The voice_enabled
+     * @param boolean $excludeAllAddressRequired The exclude_all_address_required
+     * @param boolean $excludeLocalAddressRequired The
+     *                                             exclude_local_address_required
+     * @param boolean $excludeForeignAddressRequired The
+     *                                               exclude_foreign_address_required
+     * @param boolean $beta The beta
+     * @param string $nearNumber The near_number
+     * @param string $nearLatLong The near_lat_long
+     * @param integer $distance The distance
+     * @param string $inPostalCode The in_postal_code
+     * @param string $inRegion The in_region
+     * @param string $inRateCenter The in_rate_center
+     * @param string $inLata The in_lata
+     * @param string $inLocality The in_locality
+     * @param boolean $faxEnabled The fax_enabled
+     */
+    public function __construct($areaCode = Values::NONE, $contains = Values::NONE, $smsEnabled = Values::NONE, $mmsEnabled = Values::NONE, $voiceEnabled = Values::NONE, $excludeAllAddressRequired = Values::NONE, $excludeLocalAddressRequired = Values::NONE, $excludeForeignAddressRequired = Values::NONE, $beta = Values::NONE, $nearNumber = Values::NONE, $nearLatLong = Values::NONE, $distance = Values::NONE, $inPostalCode = Values::NONE, $inRegion = Values::NONE, $inRateCenter = Values::NONE, $inLata = Values::NONE, $inLocality = Values::NONE, $faxEnabled = Values::NONE) {
+        $this->options['areaCode'] = $areaCode;
+        $this->options['contains'] = $contains;
+        $this->options['smsEnabled'] = $smsEnabled;
+        $this->options['mmsEnabled'] = $mmsEnabled;
+        $this->options['voiceEnabled'] = $voiceEnabled;
+        $this->options['excludeAllAddressRequired'] = $excludeAllAddressRequired;
+        $this->options['excludeLocalAddressRequired'] = $excludeLocalAddressRequired;
+        $this->options['excludeForeignAddressRequired'] = $excludeForeignAddressRequired;
+        $this->options['beta'] = $beta;
+        $this->options['nearNumber'] = $nearNumber;
+        $this->options['nearLatLong'] = $nearLatLong;
+        $this->options['distance'] = $distance;
+        $this->options['inPostalCode'] = $inPostalCode;
+        $this->options['inRegion'] = $inRegion;
+        $this->options['inRateCenter'] = $inRateCenter;
+        $this->options['inLata'] = $inLata;
+        $this->options['inLocality'] = $inLocality;
+        $this->options['faxEnabled'] = $faxEnabled;
+    }
+
+    /**
+     * The area_code
+     * 
+     * @param integer $areaCode The area_code
+     * @return $this Fluent Builder
+     */
+    public function setAreaCode($areaCode) {
+        $this->options['areaCode'] = $areaCode;
+        return $this;
+    }
+
+    /**
+     * The contains
+     * 
+     * @param string $contains The contains
+     * @return $this Fluent Builder
+     */
+    public function setContains($contains) {
+        $this->options['contains'] = $contains;
+        return $this;
+    }
+
+    /**
+     * The sms_enabled
+     * 
+     * @param boolean $smsEnabled The sms_enabled
+     * @return $this Fluent Builder
+     */
+    public function setSmsEnabled($smsEnabled) {
+        $this->options['smsEnabled'] = $smsEnabled;
+        return $this;
+    }
+
+    /**
+     * The mms_enabled
+     * 
+     * @param boolean $mmsEnabled The mms_enabled
+     * @return $this Fluent Builder
+     */
+    public function setMmsEnabled($mmsEnabled) {
+        $this->options['mmsEnabled'] = $mmsEnabled;
+        return $this;
+    }
+
+    /**
+     * The voice_enabled
+     * 
+     * @param boolean $voiceEnabled The voice_enabled
+     * @return $this Fluent Builder
+     */
+    public function setVoiceEnabled($voiceEnabled) {
+        $this->options['voiceEnabled'] = $voiceEnabled;
+        return $this;
+    }
+
+    /**
+     * The exclude_all_address_required
+     * 
+     * @param boolean $excludeAllAddressRequired The exclude_all_address_required
+     * @return $this Fluent Builder
+     */
+    public function setExcludeAllAddressRequired($excludeAllAddressRequired) {
+        $this->options['excludeAllAddressRequired'] = $excludeAllAddressRequired;
+        return $this;
+    }
+
+    /**
+     * The exclude_local_address_required
+     * 
+     * @param boolean $excludeLocalAddressRequired The
+     *                                             exclude_local_address_required
+     * @return $this Fluent Builder
+     */
+    public function setExcludeLocalAddressRequired($excludeLocalAddressRequired) {
+        $this->options['excludeLocalAddressRequired'] = $excludeLocalAddressRequired;
+        return $this;
+    }
+
+    /**
+     * The exclude_foreign_address_required
+     * 
+     * @param boolean $excludeForeignAddressRequired The
+     *                                               exclude_foreign_address_required
+     * @return $this Fluent Builder
+     */
+    public function setExcludeForeignAddressRequired($excludeForeignAddressRequired) {
+        $this->options['excludeForeignAddressRequired'] = $excludeForeignAddressRequired;
+        return $this;
+    }
+
+    /**
+     * The beta
+     * 
+     * @param boolean $beta The beta
+     * @return $this Fluent Builder
+     */
+    public function setBeta($beta) {
+        $this->options['beta'] = $beta;
+        return $this;
+    }
+
+    /**
+     * The near_number
+     * 
+     * @param string $nearNumber The near_number
+     * @return $this Fluent Builder
+     */
+    public function setNearNumber($nearNumber) {
+        $this->options['nearNumber'] = $nearNumber;
+        return $this;
+    }
+
+    /**
+     * The near_lat_long
+     * 
+     * @param string $nearLatLong The near_lat_long
+     * @return $this Fluent Builder
+     */
+    public function setNearLatLong($nearLatLong) {
+        $this->options['nearLatLong'] = $nearLatLong;
+        return $this;
+    }
+
+    /**
+     * The distance
+     * 
+     * @param integer $distance The distance
+     * @return $this Fluent Builder
+     */
+    public function setDistance($distance) {
+        $this->options['distance'] = $distance;
+        return $this;
+    }
+
+    /**
+     * The in_postal_code
+     * 
+     * @param string $inPostalCode The in_postal_code
+     * @return $this Fluent Builder
+     */
+    public function setInPostalCode($inPostalCode) {
+        $this->options['inPostalCode'] = $inPostalCode;
+        return $this;
+    }
+
+    /**
+     * The in_region
+     * 
+     * @param string $inRegion The in_region
+     * @return $this Fluent Builder
+     */
+    public function setInRegion($inRegion) {
+        $this->options['inRegion'] = $inRegion;
+        return $this;
+    }
+
+    /**
+     * The in_rate_center
+     * 
+     * @param string $inRateCenter The in_rate_center
+     * @return $this Fluent Builder
+     */
+    public function setInRateCenter($inRateCenter) {
+        $this->options['inRateCenter'] = $inRateCenter;
+        return $this;
+    }
+
+    /**
+     * The in_lata
+     * 
+     * @param string $inLata The in_lata
+     * @return $this Fluent Builder
+     */
+    public function setInLata($inLata) {
+        $this->options['inLata'] = $inLata;
+        return $this;
+    }
+
+    /**
+     * The in_locality
+     * 
+     * @param string $inLocality The in_locality
+     * @return $this Fluent Builder
+     */
+    public function setInLocality($inLocality) {
+        $this->options['inLocality'] = $inLocality;
+        return $this;
+    }
+
+    /**
+     * The fax_enabled
+     * 
+     * @param boolean $faxEnabled The fax_enabled
+     * @return $this Fluent Builder
+     */
+    public function setFaxEnabled($faxEnabled) {
+        $this->options['faxEnabled'] = $faxEnabled;
+        return $this;
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        $options = array();
+        foreach ($this->options as $key => $value) {
+            if ($value != Values::NONE) {
+                $options[] = "$key=$value";
+            }
+        }
+        return '[Twilio.Api.V2010.ReadMachineToMachineOptions ' . implode(' ', $options) . ']';
+    }
+}

+ 39 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/MachineToMachinePage.php

@@ -0,0 +1,39 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry;
+
+use Twilio\Page;
+
+class MachineToMachinePage extends Page {
+    public function __construct($version, $response, $solution) {
+        parent::__construct($version, $response);
+
+        // Path Solution
+        $this->solution = $solution;
+    }
+
+    public function buildInstance(array $payload) {
+        return new MachineToMachineInstance(
+            $this->version,
+            $payload,
+            $this->solution['accountSid'],
+            $this->solution['countryCode']
+        );
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        return '[Twilio.Api.V2010.MachineToMachinePage]';
+    }
+}

+ 94 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/MobileInstance.php

@@ -0,0 +1,94 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry;
+
+use Twilio\Exceptions\TwilioException;
+use Twilio\InstanceResource;
+use Twilio\Values;
+use Twilio\Version;
+
+/**
+ * @property string friendlyName
+ * @property string phoneNumber
+ * @property string lata
+ * @property string locality
+ * @property string rateCenter
+ * @property string latitude
+ * @property string longitude
+ * @property string region
+ * @property string postalCode
+ * @property string isoCountry
+ * @property string addressRequirements
+ * @property boolean beta
+ * @property string capabilities
+ */
+class MobileInstance extends InstanceResource {
+    /**
+     * Initialize the MobileInstance
+     * 
+     * @param \Twilio\Version $version Version that contains the resource
+     * @param mixed[] $payload The response payload
+     * @param string $accountSid The 34 character string that uniquely identifies
+     *                           your account.
+     * @param string $countryCode The ISO Country code to lookup phone numbers for.
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\MobileInstance 
+     */
+    public function __construct(Version $version, array $payload, $accountSid, $countryCode) {
+        parent::__construct($version);
+
+        // Marshaled Properties
+        $this->properties = array(
+            'friendlyName' => Values::array_get($payload, 'friendly_name'),
+            'phoneNumber' => Values::array_get($payload, 'phone_number'),
+            'lata' => Values::array_get($payload, 'lata'),
+            'locality' => Values::array_get($payload, 'locality'),
+            'rateCenter' => Values::array_get($payload, 'rate_center'),
+            'latitude' => Values::array_get($payload, 'latitude'),
+            'longitude' => Values::array_get($payload, 'longitude'),
+            'region' => Values::array_get($payload, 'region'),
+            'postalCode' => Values::array_get($payload, 'postal_code'),
+            'isoCountry' => Values::array_get($payload, 'iso_country'),
+            'addressRequirements' => Values::array_get($payload, 'address_requirements'),
+            'beta' => Values::array_get($payload, 'beta'),
+            'capabilities' => Values::array_get($payload, 'capabilities'),
+        );
+
+        $this->solution = array('accountSid' => $accountSid, 'countryCode' => $countryCode, );
+    }
+
+    /**
+     * 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.Api.V2010.MobileInstance]';
+    }
+}

+ 153 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/MobileList.php

@@ -0,0 +1,153 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry;
+
+use Twilio\ListResource;
+use Twilio\Options;
+use Twilio\Serialize;
+use Twilio\Values;
+use Twilio\Version;
+
+class MobileList extends ListResource {
+    /**
+     * Construct the MobileList
+     * 
+     * @param Version $version Version that contains the resource
+     * @param string $accountSid The 34 character string that uniquely identifies
+     *                           your account.
+     * @param string $countryCode The ISO Country code to lookup phone numbers for.
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\MobileList 
+     */
+    public function __construct(Version $version, $accountSid, $countryCode) {
+        parent::__construct($version);
+
+        // Path Solution
+        $this->solution = array('accountSid' => $accountSid, 'countryCode' => $countryCode, );
+
+        $this->uri = '/Accounts/' . rawurlencode($accountSid) . '/AvailablePhoneNumbers/' . rawurlencode($countryCode) . '/Mobile.json';
+    }
+
+    /**
+     * Streams MobileInstance records from the API as a generator stream.
+     * This operation lazily loads records as efficiently as possible until the
+     * limit
+     * is reached.
+     * The results are returned as a generator, so this operation is memory
+     * efficient.
+     * 
+     * @param array|Options $options Optional Arguments
+     * @param int $limit Upper limit for the number of records to return. stream()
+     *                   guarantees to never return more than limit.  Default is no
+     *                   limit
+     * @param mixed $pageSize Number of records to fetch per request, when not set
+     *                        will use the default value of 50 records.  If no
+     *                        page_size is defined but a limit is defined, stream()
+     *                        will attempt to read the limit with the most
+     *                        efficient page size, i.e. min(limit, 1000)
+     * @return \Twilio\Stream stream of results
+     */
+    public function stream($options = array(), $limit = null, $pageSize = null) {
+        $limits = $this->version->readLimits($limit, $pageSize);
+
+        $page = $this->page($options, $limits['pageSize']);
+
+        return $this->version->stream($page, $limits['limit'], $limits['pageLimit']);
+    }
+
+    /**
+     * Reads MobileInstance records from the API as a list.
+     * Unlike stream(), this operation is eager and will load `limit` records into
+     * memory before returning.
+     * 
+     * @param array|Options $options Optional Arguments
+     * @param int $limit Upper limit for the number of records to return. read()
+     *                   guarantees to never return more than limit.  Default is no
+     *                   limit
+     * @param mixed $pageSize Number of records to fetch per request, when not set
+     *                        will use the default value of 50 records.  If no
+     *                        page_size is defined but a limit is defined, read()
+     *                        will attempt to read the limit with the most
+     *                        efficient page size, i.e. min(limit, 1000)
+     * @return MobileInstance[] Array of results
+     */
+    public function read($options = array(), $limit = null, $pageSize = null) {
+        return iterator_to_array($this->stream($options, $limit, $pageSize), false);
+    }
+
+    /**
+     * Retrieve a single page of MobileInstance records from the API.
+     * Request is executed immediately
+     * 
+     * @param array|Options $options Optional Arguments
+     * @param mixed $pageSize Number of records to return, defaults to 50
+     * @param string $pageToken PageToken provided by the API
+     * @param mixed $pageNumber Page Number, this value is simply for client state
+     * @return \Twilio\Page Page of MobileInstance
+     */
+    public function page($options = array(), $pageSize = Values::NONE, $pageToken = Values::NONE, $pageNumber = Values::NONE) {
+        $options = new Values($options);
+        $params = Values::of(array(
+            'AreaCode' => $options['areaCode'],
+            'Contains' => $options['contains'],
+            'SmsEnabled' => Serialize::booleanToString($options['smsEnabled']),
+            'MmsEnabled' => Serialize::booleanToString($options['mmsEnabled']),
+            'VoiceEnabled' => Serialize::booleanToString($options['voiceEnabled']),
+            'ExcludeAllAddressRequired' => Serialize::booleanToString($options['excludeAllAddressRequired']),
+            'ExcludeLocalAddressRequired' => Serialize::booleanToString($options['excludeLocalAddressRequired']),
+            'ExcludeForeignAddressRequired' => Serialize::booleanToString($options['excludeForeignAddressRequired']),
+            'Beta' => Serialize::booleanToString($options['beta']),
+            'NearNumber' => $options['nearNumber'],
+            'NearLatLong' => $options['nearLatLong'],
+            'Distance' => $options['distance'],
+            'InPostalCode' => $options['inPostalCode'],
+            'InRegion' => $options['inRegion'],
+            'InRateCenter' => $options['inRateCenter'],
+            'InLata' => $options['inLata'],
+            'InLocality' => $options['inLocality'],
+            'FaxEnabled' => Serialize::booleanToString($options['faxEnabled']),
+            'PageToken' => $pageToken,
+            'Page' => $pageNumber,
+            'PageSize' => $pageSize,
+        ));
+
+        $response = $this->version->page(
+            'GET',
+            $this->uri,
+            $params
+        );
+
+        return new MobilePage($this->version, $response, $this->solution);
+    }
+
+    /**
+     * Retrieve a specific page of MobileInstance records from the API.
+     * Request is executed immediately
+     * 
+     * @param string $targetUrl API-generated URL for the requested results page
+     * @return \Twilio\Page Page of MobileInstance
+     */
+    public function getPage($targetUrl) {
+        $response = $this->version->getDomain()->getClient()->request(
+            'GET',
+            $targetUrl
+        );
+
+        return new MobilePage($this->version, $response, $this->solution);
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        return '[Twilio.Api.V2010.MobileList]';
+    }
+}

+ 302 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/MobileOptions.php

@@ -0,0 +1,302 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry;
+
+use Twilio\Options;
+use Twilio\Values;
+
+abstract class MobileOptions {
+    /**
+     * @param integer $areaCode The area_code
+     * @param string $contains The contains
+     * @param boolean $smsEnabled The sms_enabled
+     * @param boolean $mmsEnabled The mms_enabled
+     * @param boolean $voiceEnabled The voice_enabled
+     * @param boolean $excludeAllAddressRequired The exclude_all_address_required
+     * @param boolean $excludeLocalAddressRequired The
+     *                                             exclude_local_address_required
+     * @param boolean $excludeForeignAddressRequired The
+     *                                               exclude_foreign_address_required
+     * @param boolean $beta The beta
+     * @param string $nearNumber The near_number
+     * @param string $nearLatLong The near_lat_long
+     * @param integer $distance The distance
+     * @param string $inPostalCode The in_postal_code
+     * @param string $inRegion The in_region
+     * @param string $inRateCenter The in_rate_center
+     * @param string $inLata The in_lata
+     * @param string $inLocality The in_locality
+     * @param boolean $faxEnabled The fax_enabled
+     * @return ReadMobileOptions Options builder
+     */
+    public static function read($areaCode = Values::NONE, $contains = Values::NONE, $smsEnabled = Values::NONE, $mmsEnabled = Values::NONE, $voiceEnabled = Values::NONE, $excludeAllAddressRequired = Values::NONE, $excludeLocalAddressRequired = Values::NONE, $excludeForeignAddressRequired = Values::NONE, $beta = Values::NONE, $nearNumber = Values::NONE, $nearLatLong = Values::NONE, $distance = Values::NONE, $inPostalCode = Values::NONE, $inRegion = Values::NONE, $inRateCenter = Values::NONE, $inLata = Values::NONE, $inLocality = Values::NONE, $faxEnabled = Values::NONE) {
+        return new ReadMobileOptions($areaCode, $contains, $smsEnabled, $mmsEnabled, $voiceEnabled, $excludeAllAddressRequired, $excludeLocalAddressRequired, $excludeForeignAddressRequired, $beta, $nearNumber, $nearLatLong, $distance, $inPostalCode, $inRegion, $inRateCenter, $inLata, $inLocality, $faxEnabled);
+    }
+}
+
+class ReadMobileOptions extends Options {
+    /**
+     * @param integer $areaCode The area_code
+     * @param string $contains The contains
+     * @param boolean $smsEnabled The sms_enabled
+     * @param boolean $mmsEnabled The mms_enabled
+     * @param boolean $voiceEnabled The voice_enabled
+     * @param boolean $excludeAllAddressRequired The exclude_all_address_required
+     * @param boolean $excludeLocalAddressRequired The
+     *                                             exclude_local_address_required
+     * @param boolean $excludeForeignAddressRequired The
+     *                                               exclude_foreign_address_required
+     * @param boolean $beta The beta
+     * @param string $nearNumber The near_number
+     * @param string $nearLatLong The near_lat_long
+     * @param integer $distance The distance
+     * @param string $inPostalCode The in_postal_code
+     * @param string $inRegion The in_region
+     * @param string $inRateCenter The in_rate_center
+     * @param string $inLata The in_lata
+     * @param string $inLocality The in_locality
+     * @param boolean $faxEnabled The fax_enabled
+     */
+    public function __construct($areaCode = Values::NONE, $contains = Values::NONE, $smsEnabled = Values::NONE, $mmsEnabled = Values::NONE, $voiceEnabled = Values::NONE, $excludeAllAddressRequired = Values::NONE, $excludeLocalAddressRequired = Values::NONE, $excludeForeignAddressRequired = Values::NONE, $beta = Values::NONE, $nearNumber = Values::NONE, $nearLatLong = Values::NONE, $distance = Values::NONE, $inPostalCode = Values::NONE, $inRegion = Values::NONE, $inRateCenter = Values::NONE, $inLata = Values::NONE, $inLocality = Values::NONE, $faxEnabled = Values::NONE) {
+        $this->options['areaCode'] = $areaCode;
+        $this->options['contains'] = $contains;
+        $this->options['smsEnabled'] = $smsEnabled;
+        $this->options['mmsEnabled'] = $mmsEnabled;
+        $this->options['voiceEnabled'] = $voiceEnabled;
+        $this->options['excludeAllAddressRequired'] = $excludeAllAddressRequired;
+        $this->options['excludeLocalAddressRequired'] = $excludeLocalAddressRequired;
+        $this->options['excludeForeignAddressRequired'] = $excludeForeignAddressRequired;
+        $this->options['beta'] = $beta;
+        $this->options['nearNumber'] = $nearNumber;
+        $this->options['nearLatLong'] = $nearLatLong;
+        $this->options['distance'] = $distance;
+        $this->options['inPostalCode'] = $inPostalCode;
+        $this->options['inRegion'] = $inRegion;
+        $this->options['inRateCenter'] = $inRateCenter;
+        $this->options['inLata'] = $inLata;
+        $this->options['inLocality'] = $inLocality;
+        $this->options['faxEnabled'] = $faxEnabled;
+    }
+
+    /**
+     * The area_code
+     * 
+     * @param integer $areaCode The area_code
+     * @return $this Fluent Builder
+     */
+    public function setAreaCode($areaCode) {
+        $this->options['areaCode'] = $areaCode;
+        return $this;
+    }
+
+    /**
+     * The contains
+     * 
+     * @param string $contains The contains
+     * @return $this Fluent Builder
+     */
+    public function setContains($contains) {
+        $this->options['contains'] = $contains;
+        return $this;
+    }
+
+    /**
+     * The sms_enabled
+     * 
+     * @param boolean $smsEnabled The sms_enabled
+     * @return $this Fluent Builder
+     */
+    public function setSmsEnabled($smsEnabled) {
+        $this->options['smsEnabled'] = $smsEnabled;
+        return $this;
+    }
+
+    /**
+     * The mms_enabled
+     * 
+     * @param boolean $mmsEnabled The mms_enabled
+     * @return $this Fluent Builder
+     */
+    public function setMmsEnabled($mmsEnabled) {
+        $this->options['mmsEnabled'] = $mmsEnabled;
+        return $this;
+    }
+
+    /**
+     * The voice_enabled
+     * 
+     * @param boolean $voiceEnabled The voice_enabled
+     * @return $this Fluent Builder
+     */
+    public function setVoiceEnabled($voiceEnabled) {
+        $this->options['voiceEnabled'] = $voiceEnabled;
+        return $this;
+    }
+
+    /**
+     * The exclude_all_address_required
+     * 
+     * @param boolean $excludeAllAddressRequired The exclude_all_address_required
+     * @return $this Fluent Builder
+     */
+    public function setExcludeAllAddressRequired($excludeAllAddressRequired) {
+        $this->options['excludeAllAddressRequired'] = $excludeAllAddressRequired;
+        return $this;
+    }
+
+    /**
+     * The exclude_local_address_required
+     * 
+     * @param boolean $excludeLocalAddressRequired The
+     *                                             exclude_local_address_required
+     * @return $this Fluent Builder
+     */
+    public function setExcludeLocalAddressRequired($excludeLocalAddressRequired) {
+        $this->options['excludeLocalAddressRequired'] = $excludeLocalAddressRequired;
+        return $this;
+    }
+
+    /**
+     * The exclude_foreign_address_required
+     * 
+     * @param boolean $excludeForeignAddressRequired The
+     *                                               exclude_foreign_address_required
+     * @return $this Fluent Builder
+     */
+    public function setExcludeForeignAddressRequired($excludeForeignAddressRequired) {
+        $this->options['excludeForeignAddressRequired'] = $excludeForeignAddressRequired;
+        return $this;
+    }
+
+    /**
+     * The beta
+     * 
+     * @param boolean $beta The beta
+     * @return $this Fluent Builder
+     */
+    public function setBeta($beta) {
+        $this->options['beta'] = $beta;
+        return $this;
+    }
+
+    /**
+     * The near_number
+     * 
+     * @param string $nearNumber The near_number
+     * @return $this Fluent Builder
+     */
+    public function setNearNumber($nearNumber) {
+        $this->options['nearNumber'] = $nearNumber;
+        return $this;
+    }
+
+    /**
+     * The near_lat_long
+     * 
+     * @param string $nearLatLong The near_lat_long
+     * @return $this Fluent Builder
+     */
+    public function setNearLatLong($nearLatLong) {
+        $this->options['nearLatLong'] = $nearLatLong;
+        return $this;
+    }
+
+    /**
+     * The distance
+     * 
+     * @param integer $distance The distance
+     * @return $this Fluent Builder
+     */
+    public function setDistance($distance) {
+        $this->options['distance'] = $distance;
+        return $this;
+    }
+
+    /**
+     * The in_postal_code
+     * 
+     * @param string $inPostalCode The in_postal_code
+     * @return $this Fluent Builder
+     */
+    public function setInPostalCode($inPostalCode) {
+        $this->options['inPostalCode'] = $inPostalCode;
+        return $this;
+    }
+
+    /**
+     * The in_region
+     * 
+     * @param string $inRegion The in_region
+     * @return $this Fluent Builder
+     */
+    public function setInRegion($inRegion) {
+        $this->options['inRegion'] = $inRegion;
+        return $this;
+    }
+
+    /**
+     * The in_rate_center
+     * 
+     * @param string $inRateCenter The in_rate_center
+     * @return $this Fluent Builder
+     */
+    public function setInRateCenter($inRateCenter) {
+        $this->options['inRateCenter'] = $inRateCenter;
+        return $this;
+    }
+
+    /**
+     * The in_lata
+     * 
+     * @param string $inLata The in_lata
+     * @return $this Fluent Builder
+     */
+    public function setInLata($inLata) {
+        $this->options['inLata'] = $inLata;
+        return $this;
+    }
+
+    /**
+     * The in_locality
+     * 
+     * @param string $inLocality The in_locality
+     * @return $this Fluent Builder
+     */
+    public function setInLocality($inLocality) {
+        $this->options['inLocality'] = $inLocality;
+        return $this;
+    }
+
+    /**
+     * The fax_enabled
+     * 
+     * @param boolean $faxEnabled The fax_enabled
+     * @return $this Fluent Builder
+     */
+    public function setFaxEnabled($faxEnabled) {
+        $this->options['faxEnabled'] = $faxEnabled;
+        return $this;
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        $options = array();
+        foreach ($this->options as $key => $value) {
+            if ($value != Values::NONE) {
+                $options[] = "$key=$value";
+            }
+        }
+        return '[Twilio.Api.V2010.ReadMobileOptions ' . implode(' ', $options) . ']';
+    }
+}

+ 39 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/MobilePage.php

@@ -0,0 +1,39 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry;
+
+use Twilio\Page;
+
+class MobilePage extends Page {
+    public function __construct($version, $response, $solution) {
+        parent::__construct($version, $response);
+
+        // Path Solution
+        $this->solution = $solution;
+    }
+
+    public function buildInstance(array $payload) {
+        return new MobileInstance(
+            $this->version,
+            $payload,
+            $this->solution['accountSid'],
+            $this->solution['countryCode']
+        );
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        return '[Twilio.Api.V2010.MobilePage]';
+    }
+}

+ 94 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/NationalInstance.php

@@ -0,0 +1,94 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry;
+
+use Twilio\Exceptions\TwilioException;
+use Twilio\InstanceResource;
+use Twilio\Values;
+use Twilio\Version;
+
+/**
+ * @property string friendlyName
+ * @property string phoneNumber
+ * @property string lata
+ * @property string locality
+ * @property string rateCenter
+ * @property string latitude
+ * @property string longitude
+ * @property string region
+ * @property string postalCode
+ * @property string isoCountry
+ * @property string addressRequirements
+ * @property boolean beta
+ * @property string capabilities
+ */
+class NationalInstance extends InstanceResource {
+    /**
+     * Initialize the NationalInstance
+     * 
+     * @param \Twilio\Version $version Version that contains the resource
+     * @param mixed[] $payload The response payload
+     * @param string $accountSid The 34 character string that uniquely identifies
+     *                           your account.
+     * @param string $countryCode The ISO Country code to lookup phone numbers for.
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\NationalInstance 
+     */
+    public function __construct(Version $version, array $payload, $accountSid, $countryCode) {
+        parent::__construct($version);
+
+        // Marshaled Properties
+        $this->properties = array(
+            'friendlyName' => Values::array_get($payload, 'friendly_name'),
+            'phoneNumber' => Values::array_get($payload, 'phone_number'),
+            'lata' => Values::array_get($payload, 'lata'),
+            'locality' => Values::array_get($payload, 'locality'),
+            'rateCenter' => Values::array_get($payload, 'rate_center'),
+            'latitude' => Values::array_get($payload, 'latitude'),
+            'longitude' => Values::array_get($payload, 'longitude'),
+            'region' => Values::array_get($payload, 'region'),
+            'postalCode' => Values::array_get($payload, 'postal_code'),
+            'isoCountry' => Values::array_get($payload, 'iso_country'),
+            'addressRequirements' => Values::array_get($payload, 'address_requirements'),
+            'beta' => Values::array_get($payload, 'beta'),
+            'capabilities' => Values::array_get($payload, 'capabilities'),
+        );
+
+        $this->solution = array('accountSid' => $accountSid, 'countryCode' => $countryCode, );
+    }
+
+    /**
+     * 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.Api.V2010.NationalInstance]';
+    }
+}

+ 153 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/NationalList.php

@@ -0,0 +1,153 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry;
+
+use Twilio\ListResource;
+use Twilio\Options;
+use Twilio\Serialize;
+use Twilio\Values;
+use Twilio\Version;
+
+class NationalList extends ListResource {
+    /**
+     * Construct the NationalList
+     * 
+     * @param Version $version Version that contains the resource
+     * @param string $accountSid The 34 character string that uniquely identifies
+     *                           your account.
+     * @param string $countryCode The ISO Country code to lookup phone numbers for.
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\NationalList 
+     */
+    public function __construct(Version $version, $accountSid, $countryCode) {
+        parent::__construct($version);
+
+        // Path Solution
+        $this->solution = array('accountSid' => $accountSid, 'countryCode' => $countryCode, );
+
+        $this->uri = '/Accounts/' . rawurlencode($accountSid) . '/AvailablePhoneNumbers/' . rawurlencode($countryCode) . '/National.json';
+    }
+
+    /**
+     * Streams NationalInstance records from the API as a generator stream.
+     * This operation lazily loads records as efficiently as possible until the
+     * limit
+     * is reached.
+     * The results are returned as a generator, so this operation is memory
+     * efficient.
+     * 
+     * @param array|Options $options Optional Arguments
+     * @param int $limit Upper limit for the number of records to return. stream()
+     *                   guarantees to never return more than limit.  Default is no
+     *                   limit
+     * @param mixed $pageSize Number of records to fetch per request, when not set
+     *                        will use the default value of 50 records.  If no
+     *                        page_size is defined but a limit is defined, stream()
+     *                        will attempt to read the limit with the most
+     *                        efficient page size, i.e. min(limit, 1000)
+     * @return \Twilio\Stream stream of results
+     */
+    public function stream($options = array(), $limit = null, $pageSize = null) {
+        $limits = $this->version->readLimits($limit, $pageSize);
+
+        $page = $this->page($options, $limits['pageSize']);
+
+        return $this->version->stream($page, $limits['limit'], $limits['pageLimit']);
+    }
+
+    /**
+     * Reads NationalInstance records from the API as a list.
+     * Unlike stream(), this operation is eager and will load `limit` records into
+     * memory before returning.
+     * 
+     * @param array|Options $options Optional Arguments
+     * @param int $limit Upper limit for the number of records to return. read()
+     *                   guarantees to never return more than limit.  Default is no
+     *                   limit
+     * @param mixed $pageSize Number of records to fetch per request, when not set
+     *                        will use the default value of 50 records.  If no
+     *                        page_size is defined but a limit is defined, read()
+     *                        will attempt to read the limit with the most
+     *                        efficient page size, i.e. min(limit, 1000)
+     * @return NationalInstance[] Array of results
+     */
+    public function read($options = array(), $limit = null, $pageSize = null) {
+        return iterator_to_array($this->stream($options, $limit, $pageSize), false);
+    }
+
+    /**
+     * Retrieve a single page of NationalInstance records from the API.
+     * Request is executed immediately
+     * 
+     * @param array|Options $options Optional Arguments
+     * @param mixed $pageSize Number of records to return, defaults to 50
+     * @param string $pageToken PageToken provided by the API
+     * @param mixed $pageNumber Page Number, this value is simply for client state
+     * @return \Twilio\Page Page of NationalInstance
+     */
+    public function page($options = array(), $pageSize = Values::NONE, $pageToken = Values::NONE, $pageNumber = Values::NONE) {
+        $options = new Values($options);
+        $params = Values::of(array(
+            'AreaCode' => $options['areaCode'],
+            'Contains' => $options['contains'],
+            'SmsEnabled' => Serialize::booleanToString($options['smsEnabled']),
+            'MmsEnabled' => Serialize::booleanToString($options['mmsEnabled']),
+            'VoiceEnabled' => Serialize::booleanToString($options['voiceEnabled']),
+            'ExcludeAllAddressRequired' => Serialize::booleanToString($options['excludeAllAddressRequired']),
+            'ExcludeLocalAddressRequired' => Serialize::booleanToString($options['excludeLocalAddressRequired']),
+            'ExcludeForeignAddressRequired' => Serialize::booleanToString($options['excludeForeignAddressRequired']),
+            'Beta' => Serialize::booleanToString($options['beta']),
+            'NearNumber' => $options['nearNumber'],
+            'NearLatLong' => $options['nearLatLong'],
+            'Distance' => $options['distance'],
+            'InPostalCode' => $options['inPostalCode'],
+            'InRegion' => $options['inRegion'],
+            'InRateCenter' => $options['inRateCenter'],
+            'InLata' => $options['inLata'],
+            'InLocality' => $options['inLocality'],
+            'FaxEnabled' => Serialize::booleanToString($options['faxEnabled']),
+            'PageToken' => $pageToken,
+            'Page' => $pageNumber,
+            'PageSize' => $pageSize,
+        ));
+
+        $response = $this->version->page(
+            'GET',
+            $this->uri,
+            $params
+        );
+
+        return new NationalPage($this->version, $response, $this->solution);
+    }
+
+    /**
+     * Retrieve a specific page of NationalInstance records from the API.
+     * Request is executed immediately
+     * 
+     * @param string $targetUrl API-generated URL for the requested results page
+     * @return \Twilio\Page Page of NationalInstance
+     */
+    public function getPage($targetUrl) {
+        $response = $this->version->getDomain()->getClient()->request(
+            'GET',
+            $targetUrl
+        );
+
+        return new NationalPage($this->version, $response, $this->solution);
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        return '[Twilio.Api.V2010.NationalList]';
+    }
+}

+ 302 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/NationalOptions.php

@@ -0,0 +1,302 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry;
+
+use Twilio\Options;
+use Twilio\Values;
+
+abstract class NationalOptions {
+    /**
+     * @param integer $areaCode The area_code
+     * @param string $contains The contains
+     * @param boolean $smsEnabled The sms_enabled
+     * @param boolean $mmsEnabled The mms_enabled
+     * @param boolean $voiceEnabled The voice_enabled
+     * @param boolean $excludeAllAddressRequired The exclude_all_address_required
+     * @param boolean $excludeLocalAddressRequired The
+     *                                             exclude_local_address_required
+     * @param boolean $excludeForeignAddressRequired The
+     *                                               exclude_foreign_address_required
+     * @param boolean $beta The beta
+     * @param string $nearNumber The near_number
+     * @param string $nearLatLong The near_lat_long
+     * @param integer $distance The distance
+     * @param string $inPostalCode The in_postal_code
+     * @param string $inRegion The in_region
+     * @param string $inRateCenter The in_rate_center
+     * @param string $inLata The in_lata
+     * @param string $inLocality The in_locality
+     * @param boolean $faxEnabled The fax_enabled
+     * @return ReadNationalOptions Options builder
+     */
+    public static function read($areaCode = Values::NONE, $contains = Values::NONE, $smsEnabled = Values::NONE, $mmsEnabled = Values::NONE, $voiceEnabled = Values::NONE, $excludeAllAddressRequired = Values::NONE, $excludeLocalAddressRequired = Values::NONE, $excludeForeignAddressRequired = Values::NONE, $beta = Values::NONE, $nearNumber = Values::NONE, $nearLatLong = Values::NONE, $distance = Values::NONE, $inPostalCode = Values::NONE, $inRegion = Values::NONE, $inRateCenter = Values::NONE, $inLata = Values::NONE, $inLocality = Values::NONE, $faxEnabled = Values::NONE) {
+        return new ReadNationalOptions($areaCode, $contains, $smsEnabled, $mmsEnabled, $voiceEnabled, $excludeAllAddressRequired, $excludeLocalAddressRequired, $excludeForeignAddressRequired, $beta, $nearNumber, $nearLatLong, $distance, $inPostalCode, $inRegion, $inRateCenter, $inLata, $inLocality, $faxEnabled);
+    }
+}
+
+class ReadNationalOptions extends Options {
+    /**
+     * @param integer $areaCode The area_code
+     * @param string $contains The contains
+     * @param boolean $smsEnabled The sms_enabled
+     * @param boolean $mmsEnabled The mms_enabled
+     * @param boolean $voiceEnabled The voice_enabled
+     * @param boolean $excludeAllAddressRequired The exclude_all_address_required
+     * @param boolean $excludeLocalAddressRequired The
+     *                                             exclude_local_address_required
+     * @param boolean $excludeForeignAddressRequired The
+     *                                               exclude_foreign_address_required
+     * @param boolean $beta The beta
+     * @param string $nearNumber The near_number
+     * @param string $nearLatLong The near_lat_long
+     * @param integer $distance The distance
+     * @param string $inPostalCode The in_postal_code
+     * @param string $inRegion The in_region
+     * @param string $inRateCenter The in_rate_center
+     * @param string $inLata The in_lata
+     * @param string $inLocality The in_locality
+     * @param boolean $faxEnabled The fax_enabled
+     */
+    public function __construct($areaCode = Values::NONE, $contains = Values::NONE, $smsEnabled = Values::NONE, $mmsEnabled = Values::NONE, $voiceEnabled = Values::NONE, $excludeAllAddressRequired = Values::NONE, $excludeLocalAddressRequired = Values::NONE, $excludeForeignAddressRequired = Values::NONE, $beta = Values::NONE, $nearNumber = Values::NONE, $nearLatLong = Values::NONE, $distance = Values::NONE, $inPostalCode = Values::NONE, $inRegion = Values::NONE, $inRateCenter = Values::NONE, $inLata = Values::NONE, $inLocality = Values::NONE, $faxEnabled = Values::NONE) {
+        $this->options['areaCode'] = $areaCode;
+        $this->options['contains'] = $contains;
+        $this->options['smsEnabled'] = $smsEnabled;
+        $this->options['mmsEnabled'] = $mmsEnabled;
+        $this->options['voiceEnabled'] = $voiceEnabled;
+        $this->options['excludeAllAddressRequired'] = $excludeAllAddressRequired;
+        $this->options['excludeLocalAddressRequired'] = $excludeLocalAddressRequired;
+        $this->options['excludeForeignAddressRequired'] = $excludeForeignAddressRequired;
+        $this->options['beta'] = $beta;
+        $this->options['nearNumber'] = $nearNumber;
+        $this->options['nearLatLong'] = $nearLatLong;
+        $this->options['distance'] = $distance;
+        $this->options['inPostalCode'] = $inPostalCode;
+        $this->options['inRegion'] = $inRegion;
+        $this->options['inRateCenter'] = $inRateCenter;
+        $this->options['inLata'] = $inLata;
+        $this->options['inLocality'] = $inLocality;
+        $this->options['faxEnabled'] = $faxEnabled;
+    }
+
+    /**
+     * The area_code
+     * 
+     * @param integer $areaCode The area_code
+     * @return $this Fluent Builder
+     */
+    public function setAreaCode($areaCode) {
+        $this->options['areaCode'] = $areaCode;
+        return $this;
+    }
+
+    /**
+     * The contains
+     * 
+     * @param string $contains The contains
+     * @return $this Fluent Builder
+     */
+    public function setContains($contains) {
+        $this->options['contains'] = $contains;
+        return $this;
+    }
+
+    /**
+     * The sms_enabled
+     * 
+     * @param boolean $smsEnabled The sms_enabled
+     * @return $this Fluent Builder
+     */
+    public function setSmsEnabled($smsEnabled) {
+        $this->options['smsEnabled'] = $smsEnabled;
+        return $this;
+    }
+
+    /**
+     * The mms_enabled
+     * 
+     * @param boolean $mmsEnabled The mms_enabled
+     * @return $this Fluent Builder
+     */
+    public function setMmsEnabled($mmsEnabled) {
+        $this->options['mmsEnabled'] = $mmsEnabled;
+        return $this;
+    }
+
+    /**
+     * The voice_enabled
+     * 
+     * @param boolean $voiceEnabled The voice_enabled
+     * @return $this Fluent Builder
+     */
+    public function setVoiceEnabled($voiceEnabled) {
+        $this->options['voiceEnabled'] = $voiceEnabled;
+        return $this;
+    }
+
+    /**
+     * The exclude_all_address_required
+     * 
+     * @param boolean $excludeAllAddressRequired The exclude_all_address_required
+     * @return $this Fluent Builder
+     */
+    public function setExcludeAllAddressRequired($excludeAllAddressRequired) {
+        $this->options['excludeAllAddressRequired'] = $excludeAllAddressRequired;
+        return $this;
+    }
+
+    /**
+     * The exclude_local_address_required
+     * 
+     * @param boolean $excludeLocalAddressRequired The
+     *                                             exclude_local_address_required
+     * @return $this Fluent Builder
+     */
+    public function setExcludeLocalAddressRequired($excludeLocalAddressRequired) {
+        $this->options['excludeLocalAddressRequired'] = $excludeLocalAddressRequired;
+        return $this;
+    }
+
+    /**
+     * The exclude_foreign_address_required
+     * 
+     * @param boolean $excludeForeignAddressRequired The
+     *                                               exclude_foreign_address_required
+     * @return $this Fluent Builder
+     */
+    public function setExcludeForeignAddressRequired($excludeForeignAddressRequired) {
+        $this->options['excludeForeignAddressRequired'] = $excludeForeignAddressRequired;
+        return $this;
+    }
+
+    /**
+     * The beta
+     * 
+     * @param boolean $beta The beta
+     * @return $this Fluent Builder
+     */
+    public function setBeta($beta) {
+        $this->options['beta'] = $beta;
+        return $this;
+    }
+
+    /**
+     * The near_number
+     * 
+     * @param string $nearNumber The near_number
+     * @return $this Fluent Builder
+     */
+    public function setNearNumber($nearNumber) {
+        $this->options['nearNumber'] = $nearNumber;
+        return $this;
+    }
+
+    /**
+     * The near_lat_long
+     * 
+     * @param string $nearLatLong The near_lat_long
+     * @return $this Fluent Builder
+     */
+    public function setNearLatLong($nearLatLong) {
+        $this->options['nearLatLong'] = $nearLatLong;
+        return $this;
+    }
+
+    /**
+     * The distance
+     * 
+     * @param integer $distance The distance
+     * @return $this Fluent Builder
+     */
+    public function setDistance($distance) {
+        $this->options['distance'] = $distance;
+        return $this;
+    }
+
+    /**
+     * The in_postal_code
+     * 
+     * @param string $inPostalCode The in_postal_code
+     * @return $this Fluent Builder
+     */
+    public function setInPostalCode($inPostalCode) {
+        $this->options['inPostalCode'] = $inPostalCode;
+        return $this;
+    }
+
+    /**
+     * The in_region
+     * 
+     * @param string $inRegion The in_region
+     * @return $this Fluent Builder
+     */
+    public function setInRegion($inRegion) {
+        $this->options['inRegion'] = $inRegion;
+        return $this;
+    }
+
+    /**
+     * The in_rate_center
+     * 
+     * @param string $inRateCenter The in_rate_center
+     * @return $this Fluent Builder
+     */
+    public function setInRateCenter($inRateCenter) {
+        $this->options['inRateCenter'] = $inRateCenter;
+        return $this;
+    }
+
+    /**
+     * The in_lata
+     * 
+     * @param string $inLata The in_lata
+     * @return $this Fluent Builder
+     */
+    public function setInLata($inLata) {
+        $this->options['inLata'] = $inLata;
+        return $this;
+    }
+
+    /**
+     * The in_locality
+     * 
+     * @param string $inLocality The in_locality
+     * @return $this Fluent Builder
+     */
+    public function setInLocality($inLocality) {
+        $this->options['inLocality'] = $inLocality;
+        return $this;
+    }
+
+    /**
+     * The fax_enabled
+     * 
+     * @param boolean $faxEnabled The fax_enabled
+     * @return $this Fluent Builder
+     */
+    public function setFaxEnabled($faxEnabled) {
+        $this->options['faxEnabled'] = $faxEnabled;
+        return $this;
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        $options = array();
+        foreach ($this->options as $key => $value) {
+            if ($value != Values::NONE) {
+                $options[] = "$key=$value";
+            }
+        }
+        return '[Twilio.Api.V2010.ReadNationalOptions ' . implode(' ', $options) . ']';
+    }
+}

+ 39 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/NationalPage.php

@@ -0,0 +1,39 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry;
+
+use Twilio\Page;
+
+class NationalPage extends Page {
+    public function __construct($version, $response, $solution) {
+        parent::__construct($version, $response);
+
+        // Path Solution
+        $this->solution = $solution;
+    }
+
+    public function buildInstance(array $payload) {
+        return new NationalInstance(
+            $this->version,
+            $payload,
+            $this->solution['accountSid'],
+            $this->solution['countryCode']
+        );
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        return '[Twilio.Api.V2010.NationalPage]';
+    }
+}

+ 94 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/SharedCostInstance.php

@@ -0,0 +1,94 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry;
+
+use Twilio\Exceptions\TwilioException;
+use Twilio\InstanceResource;
+use Twilio\Values;
+use Twilio\Version;
+
+/**
+ * @property string friendlyName
+ * @property string phoneNumber
+ * @property string lata
+ * @property string locality
+ * @property string rateCenter
+ * @property string latitude
+ * @property string longitude
+ * @property string region
+ * @property string postalCode
+ * @property string isoCountry
+ * @property string addressRequirements
+ * @property boolean beta
+ * @property string capabilities
+ */
+class SharedCostInstance extends InstanceResource {
+    /**
+     * Initialize the SharedCostInstance
+     * 
+     * @param \Twilio\Version $version Version that contains the resource
+     * @param mixed[] $payload The response payload
+     * @param string $accountSid The 34 character string that uniquely identifies
+     *                           your account.
+     * @param string $countryCode The ISO Country code to lookup phone numbers for.
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\SharedCostInstance 
+     */
+    public function __construct(Version $version, array $payload, $accountSid, $countryCode) {
+        parent::__construct($version);
+
+        // Marshaled Properties
+        $this->properties = array(
+            'friendlyName' => Values::array_get($payload, 'friendly_name'),
+            'phoneNumber' => Values::array_get($payload, 'phone_number'),
+            'lata' => Values::array_get($payload, 'lata'),
+            'locality' => Values::array_get($payload, 'locality'),
+            'rateCenter' => Values::array_get($payload, 'rate_center'),
+            'latitude' => Values::array_get($payload, 'latitude'),
+            'longitude' => Values::array_get($payload, 'longitude'),
+            'region' => Values::array_get($payload, 'region'),
+            'postalCode' => Values::array_get($payload, 'postal_code'),
+            'isoCountry' => Values::array_get($payload, 'iso_country'),
+            'addressRequirements' => Values::array_get($payload, 'address_requirements'),
+            'beta' => Values::array_get($payload, 'beta'),
+            'capabilities' => Values::array_get($payload, 'capabilities'),
+        );
+
+        $this->solution = array('accountSid' => $accountSid, 'countryCode' => $countryCode, );
+    }
+
+    /**
+     * 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.Api.V2010.SharedCostInstance]';
+    }
+}

+ 153 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/SharedCostList.php

@@ -0,0 +1,153 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry;
+
+use Twilio\ListResource;
+use Twilio\Options;
+use Twilio\Serialize;
+use Twilio\Values;
+use Twilio\Version;
+
+class SharedCostList extends ListResource {
+    /**
+     * Construct the SharedCostList
+     * 
+     * @param Version $version Version that contains the resource
+     * @param string $accountSid The 34 character string that uniquely identifies
+     *                           your account.
+     * @param string $countryCode The ISO Country code to lookup phone numbers for.
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\SharedCostList 
+     */
+    public function __construct(Version $version, $accountSid, $countryCode) {
+        parent::__construct($version);
+
+        // Path Solution
+        $this->solution = array('accountSid' => $accountSid, 'countryCode' => $countryCode, );
+
+        $this->uri = '/Accounts/' . rawurlencode($accountSid) . '/AvailablePhoneNumbers/' . rawurlencode($countryCode) . '/SharedCost.json';
+    }
+
+    /**
+     * Streams SharedCostInstance records from the API as a generator stream.
+     * This operation lazily loads records as efficiently as possible until the
+     * limit
+     * is reached.
+     * The results are returned as a generator, so this operation is memory
+     * efficient.
+     * 
+     * @param array|Options $options Optional Arguments
+     * @param int $limit Upper limit for the number of records to return. stream()
+     *                   guarantees to never return more than limit.  Default is no
+     *                   limit
+     * @param mixed $pageSize Number of records to fetch per request, when not set
+     *                        will use the default value of 50 records.  If no
+     *                        page_size is defined but a limit is defined, stream()
+     *                        will attempt to read the limit with the most
+     *                        efficient page size, i.e. min(limit, 1000)
+     * @return \Twilio\Stream stream of results
+     */
+    public function stream($options = array(), $limit = null, $pageSize = null) {
+        $limits = $this->version->readLimits($limit, $pageSize);
+
+        $page = $this->page($options, $limits['pageSize']);
+
+        return $this->version->stream($page, $limits['limit'], $limits['pageLimit']);
+    }
+
+    /**
+     * Reads SharedCostInstance records from the API as a list.
+     * Unlike stream(), this operation is eager and will load `limit` records into
+     * memory before returning.
+     * 
+     * @param array|Options $options Optional Arguments
+     * @param int $limit Upper limit for the number of records to return. read()
+     *                   guarantees to never return more than limit.  Default is no
+     *                   limit
+     * @param mixed $pageSize Number of records to fetch per request, when not set
+     *                        will use the default value of 50 records.  If no
+     *                        page_size is defined but a limit is defined, read()
+     *                        will attempt to read the limit with the most
+     *                        efficient page size, i.e. min(limit, 1000)
+     * @return SharedCostInstance[] Array of results
+     */
+    public function read($options = array(), $limit = null, $pageSize = null) {
+        return iterator_to_array($this->stream($options, $limit, $pageSize), false);
+    }
+
+    /**
+     * Retrieve a single page of SharedCostInstance records from the API.
+     * Request is executed immediately
+     * 
+     * @param array|Options $options Optional Arguments
+     * @param mixed $pageSize Number of records to return, defaults to 50
+     * @param string $pageToken PageToken provided by the API
+     * @param mixed $pageNumber Page Number, this value is simply for client state
+     * @return \Twilio\Page Page of SharedCostInstance
+     */
+    public function page($options = array(), $pageSize = Values::NONE, $pageToken = Values::NONE, $pageNumber = Values::NONE) {
+        $options = new Values($options);
+        $params = Values::of(array(
+            'AreaCode' => $options['areaCode'],
+            'Contains' => $options['contains'],
+            'SmsEnabled' => Serialize::booleanToString($options['smsEnabled']),
+            'MmsEnabled' => Serialize::booleanToString($options['mmsEnabled']),
+            'VoiceEnabled' => Serialize::booleanToString($options['voiceEnabled']),
+            'ExcludeAllAddressRequired' => Serialize::booleanToString($options['excludeAllAddressRequired']),
+            'ExcludeLocalAddressRequired' => Serialize::booleanToString($options['excludeLocalAddressRequired']),
+            'ExcludeForeignAddressRequired' => Serialize::booleanToString($options['excludeForeignAddressRequired']),
+            'Beta' => Serialize::booleanToString($options['beta']),
+            'NearNumber' => $options['nearNumber'],
+            'NearLatLong' => $options['nearLatLong'],
+            'Distance' => $options['distance'],
+            'InPostalCode' => $options['inPostalCode'],
+            'InRegion' => $options['inRegion'],
+            'InRateCenter' => $options['inRateCenter'],
+            'InLata' => $options['inLata'],
+            'InLocality' => $options['inLocality'],
+            'FaxEnabled' => Serialize::booleanToString($options['faxEnabled']),
+            'PageToken' => $pageToken,
+            'Page' => $pageNumber,
+            'PageSize' => $pageSize,
+        ));
+
+        $response = $this->version->page(
+            'GET',
+            $this->uri,
+            $params
+        );
+
+        return new SharedCostPage($this->version, $response, $this->solution);
+    }
+
+    /**
+     * Retrieve a specific page of SharedCostInstance records from the API.
+     * Request is executed immediately
+     * 
+     * @param string $targetUrl API-generated URL for the requested results page
+     * @return \Twilio\Page Page of SharedCostInstance
+     */
+    public function getPage($targetUrl) {
+        $response = $this->version->getDomain()->getClient()->request(
+            'GET',
+            $targetUrl
+        );
+
+        return new SharedCostPage($this->version, $response, $this->solution);
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        return '[Twilio.Api.V2010.SharedCostList]';
+    }
+}

+ 302 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/SharedCostOptions.php

@@ -0,0 +1,302 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry;
+
+use Twilio\Options;
+use Twilio\Values;
+
+abstract class SharedCostOptions {
+    /**
+     * @param integer $areaCode The area_code
+     * @param string $contains The contains
+     * @param boolean $smsEnabled The sms_enabled
+     * @param boolean $mmsEnabled The mms_enabled
+     * @param boolean $voiceEnabled The voice_enabled
+     * @param boolean $excludeAllAddressRequired The exclude_all_address_required
+     * @param boolean $excludeLocalAddressRequired The
+     *                                             exclude_local_address_required
+     * @param boolean $excludeForeignAddressRequired The
+     *                                               exclude_foreign_address_required
+     * @param boolean $beta The beta
+     * @param string $nearNumber The near_number
+     * @param string $nearLatLong The near_lat_long
+     * @param integer $distance The distance
+     * @param string $inPostalCode The in_postal_code
+     * @param string $inRegion The in_region
+     * @param string $inRateCenter The in_rate_center
+     * @param string $inLata The in_lata
+     * @param string $inLocality The in_locality
+     * @param boolean $faxEnabled The fax_enabled
+     * @return ReadSharedCostOptions Options builder
+     */
+    public static function read($areaCode = Values::NONE, $contains = Values::NONE, $smsEnabled = Values::NONE, $mmsEnabled = Values::NONE, $voiceEnabled = Values::NONE, $excludeAllAddressRequired = Values::NONE, $excludeLocalAddressRequired = Values::NONE, $excludeForeignAddressRequired = Values::NONE, $beta = Values::NONE, $nearNumber = Values::NONE, $nearLatLong = Values::NONE, $distance = Values::NONE, $inPostalCode = Values::NONE, $inRegion = Values::NONE, $inRateCenter = Values::NONE, $inLata = Values::NONE, $inLocality = Values::NONE, $faxEnabled = Values::NONE) {
+        return new ReadSharedCostOptions($areaCode, $contains, $smsEnabled, $mmsEnabled, $voiceEnabled, $excludeAllAddressRequired, $excludeLocalAddressRequired, $excludeForeignAddressRequired, $beta, $nearNumber, $nearLatLong, $distance, $inPostalCode, $inRegion, $inRateCenter, $inLata, $inLocality, $faxEnabled);
+    }
+}
+
+class ReadSharedCostOptions extends Options {
+    /**
+     * @param integer $areaCode The area_code
+     * @param string $contains The contains
+     * @param boolean $smsEnabled The sms_enabled
+     * @param boolean $mmsEnabled The mms_enabled
+     * @param boolean $voiceEnabled The voice_enabled
+     * @param boolean $excludeAllAddressRequired The exclude_all_address_required
+     * @param boolean $excludeLocalAddressRequired The
+     *                                             exclude_local_address_required
+     * @param boolean $excludeForeignAddressRequired The
+     *                                               exclude_foreign_address_required
+     * @param boolean $beta The beta
+     * @param string $nearNumber The near_number
+     * @param string $nearLatLong The near_lat_long
+     * @param integer $distance The distance
+     * @param string $inPostalCode The in_postal_code
+     * @param string $inRegion The in_region
+     * @param string $inRateCenter The in_rate_center
+     * @param string $inLata The in_lata
+     * @param string $inLocality The in_locality
+     * @param boolean $faxEnabled The fax_enabled
+     */
+    public function __construct($areaCode = Values::NONE, $contains = Values::NONE, $smsEnabled = Values::NONE, $mmsEnabled = Values::NONE, $voiceEnabled = Values::NONE, $excludeAllAddressRequired = Values::NONE, $excludeLocalAddressRequired = Values::NONE, $excludeForeignAddressRequired = Values::NONE, $beta = Values::NONE, $nearNumber = Values::NONE, $nearLatLong = Values::NONE, $distance = Values::NONE, $inPostalCode = Values::NONE, $inRegion = Values::NONE, $inRateCenter = Values::NONE, $inLata = Values::NONE, $inLocality = Values::NONE, $faxEnabled = Values::NONE) {
+        $this->options['areaCode'] = $areaCode;
+        $this->options['contains'] = $contains;
+        $this->options['smsEnabled'] = $smsEnabled;
+        $this->options['mmsEnabled'] = $mmsEnabled;
+        $this->options['voiceEnabled'] = $voiceEnabled;
+        $this->options['excludeAllAddressRequired'] = $excludeAllAddressRequired;
+        $this->options['excludeLocalAddressRequired'] = $excludeLocalAddressRequired;
+        $this->options['excludeForeignAddressRequired'] = $excludeForeignAddressRequired;
+        $this->options['beta'] = $beta;
+        $this->options['nearNumber'] = $nearNumber;
+        $this->options['nearLatLong'] = $nearLatLong;
+        $this->options['distance'] = $distance;
+        $this->options['inPostalCode'] = $inPostalCode;
+        $this->options['inRegion'] = $inRegion;
+        $this->options['inRateCenter'] = $inRateCenter;
+        $this->options['inLata'] = $inLata;
+        $this->options['inLocality'] = $inLocality;
+        $this->options['faxEnabled'] = $faxEnabled;
+    }
+
+    /**
+     * The area_code
+     * 
+     * @param integer $areaCode The area_code
+     * @return $this Fluent Builder
+     */
+    public function setAreaCode($areaCode) {
+        $this->options['areaCode'] = $areaCode;
+        return $this;
+    }
+
+    /**
+     * The contains
+     * 
+     * @param string $contains The contains
+     * @return $this Fluent Builder
+     */
+    public function setContains($contains) {
+        $this->options['contains'] = $contains;
+        return $this;
+    }
+
+    /**
+     * The sms_enabled
+     * 
+     * @param boolean $smsEnabled The sms_enabled
+     * @return $this Fluent Builder
+     */
+    public function setSmsEnabled($smsEnabled) {
+        $this->options['smsEnabled'] = $smsEnabled;
+        return $this;
+    }
+
+    /**
+     * The mms_enabled
+     * 
+     * @param boolean $mmsEnabled The mms_enabled
+     * @return $this Fluent Builder
+     */
+    public function setMmsEnabled($mmsEnabled) {
+        $this->options['mmsEnabled'] = $mmsEnabled;
+        return $this;
+    }
+
+    /**
+     * The voice_enabled
+     * 
+     * @param boolean $voiceEnabled The voice_enabled
+     * @return $this Fluent Builder
+     */
+    public function setVoiceEnabled($voiceEnabled) {
+        $this->options['voiceEnabled'] = $voiceEnabled;
+        return $this;
+    }
+
+    /**
+     * The exclude_all_address_required
+     * 
+     * @param boolean $excludeAllAddressRequired The exclude_all_address_required
+     * @return $this Fluent Builder
+     */
+    public function setExcludeAllAddressRequired($excludeAllAddressRequired) {
+        $this->options['excludeAllAddressRequired'] = $excludeAllAddressRequired;
+        return $this;
+    }
+
+    /**
+     * The exclude_local_address_required
+     * 
+     * @param boolean $excludeLocalAddressRequired The
+     *                                             exclude_local_address_required
+     * @return $this Fluent Builder
+     */
+    public function setExcludeLocalAddressRequired($excludeLocalAddressRequired) {
+        $this->options['excludeLocalAddressRequired'] = $excludeLocalAddressRequired;
+        return $this;
+    }
+
+    /**
+     * The exclude_foreign_address_required
+     * 
+     * @param boolean $excludeForeignAddressRequired The
+     *                                               exclude_foreign_address_required
+     * @return $this Fluent Builder
+     */
+    public function setExcludeForeignAddressRequired($excludeForeignAddressRequired) {
+        $this->options['excludeForeignAddressRequired'] = $excludeForeignAddressRequired;
+        return $this;
+    }
+
+    /**
+     * The beta
+     * 
+     * @param boolean $beta The beta
+     * @return $this Fluent Builder
+     */
+    public function setBeta($beta) {
+        $this->options['beta'] = $beta;
+        return $this;
+    }
+
+    /**
+     * The near_number
+     * 
+     * @param string $nearNumber The near_number
+     * @return $this Fluent Builder
+     */
+    public function setNearNumber($nearNumber) {
+        $this->options['nearNumber'] = $nearNumber;
+        return $this;
+    }
+
+    /**
+     * The near_lat_long
+     * 
+     * @param string $nearLatLong The near_lat_long
+     * @return $this Fluent Builder
+     */
+    public function setNearLatLong($nearLatLong) {
+        $this->options['nearLatLong'] = $nearLatLong;
+        return $this;
+    }
+
+    /**
+     * The distance
+     * 
+     * @param integer $distance The distance
+     * @return $this Fluent Builder
+     */
+    public function setDistance($distance) {
+        $this->options['distance'] = $distance;
+        return $this;
+    }
+
+    /**
+     * The in_postal_code
+     * 
+     * @param string $inPostalCode The in_postal_code
+     * @return $this Fluent Builder
+     */
+    public function setInPostalCode($inPostalCode) {
+        $this->options['inPostalCode'] = $inPostalCode;
+        return $this;
+    }
+
+    /**
+     * The in_region
+     * 
+     * @param string $inRegion The in_region
+     * @return $this Fluent Builder
+     */
+    public function setInRegion($inRegion) {
+        $this->options['inRegion'] = $inRegion;
+        return $this;
+    }
+
+    /**
+     * The in_rate_center
+     * 
+     * @param string $inRateCenter The in_rate_center
+     * @return $this Fluent Builder
+     */
+    public function setInRateCenter($inRateCenter) {
+        $this->options['inRateCenter'] = $inRateCenter;
+        return $this;
+    }
+
+    /**
+     * The in_lata
+     * 
+     * @param string $inLata The in_lata
+     * @return $this Fluent Builder
+     */
+    public function setInLata($inLata) {
+        $this->options['inLata'] = $inLata;
+        return $this;
+    }
+
+    /**
+     * The in_locality
+     * 
+     * @param string $inLocality The in_locality
+     * @return $this Fluent Builder
+     */
+    public function setInLocality($inLocality) {
+        $this->options['inLocality'] = $inLocality;
+        return $this;
+    }
+
+    /**
+     * The fax_enabled
+     * 
+     * @param boolean $faxEnabled The fax_enabled
+     * @return $this Fluent Builder
+     */
+    public function setFaxEnabled($faxEnabled) {
+        $this->options['faxEnabled'] = $faxEnabled;
+        return $this;
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        $options = array();
+        foreach ($this->options as $key => $value) {
+            if ($value != Values::NONE) {
+                $options[] = "$key=$value";
+            }
+        }
+        return '[Twilio.Api.V2010.ReadSharedCostOptions ' . implode(' ', $options) . ']';
+    }
+}

+ 39 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/SharedCostPage.php

@@ -0,0 +1,39 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry;
+
+use Twilio\Page;
+
+class SharedCostPage extends Page {
+    public function __construct($version, $response, $solution) {
+        parent::__construct($version, $response);
+
+        // Path Solution
+        $this->solution = $solution;
+    }
+
+    public function buildInstance(array $payload) {
+        return new SharedCostInstance(
+            $this->version,
+            $payload,
+            $this->solution['accountSid'],
+            $this->solution['countryCode']
+        );
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        return '[Twilio.Api.V2010.SharedCostPage]';
+    }
+}

+ 94 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/TollFreeInstance.php

@@ -0,0 +1,94 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry;
+
+use Twilio\Exceptions\TwilioException;
+use Twilio\InstanceResource;
+use Twilio\Values;
+use Twilio\Version;
+
+/**
+ * @property string friendlyName
+ * @property string phoneNumber
+ * @property string lata
+ * @property string locality
+ * @property string rateCenter
+ * @property string latitude
+ * @property string longitude
+ * @property string region
+ * @property string postalCode
+ * @property string isoCountry
+ * @property string addressRequirements
+ * @property boolean beta
+ * @property string capabilities
+ */
+class TollFreeInstance extends InstanceResource {
+    /**
+     * Initialize the TollFreeInstance
+     * 
+     * @param \Twilio\Version $version Version that contains the resource
+     * @param mixed[] $payload The response payload
+     * @param string $accountSid The 34 character string that uniquely identifies
+     *                           your account.
+     * @param string $countryCode The ISO Country code to lookup phone numbers for.
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\TollFreeInstance 
+     */
+    public function __construct(Version $version, array $payload, $accountSid, $countryCode) {
+        parent::__construct($version);
+
+        // Marshaled Properties
+        $this->properties = array(
+            'friendlyName' => Values::array_get($payload, 'friendly_name'),
+            'phoneNumber' => Values::array_get($payload, 'phone_number'),
+            'lata' => Values::array_get($payload, 'lata'),
+            'locality' => Values::array_get($payload, 'locality'),
+            'rateCenter' => Values::array_get($payload, 'rate_center'),
+            'latitude' => Values::array_get($payload, 'latitude'),
+            'longitude' => Values::array_get($payload, 'longitude'),
+            'region' => Values::array_get($payload, 'region'),
+            'postalCode' => Values::array_get($payload, 'postal_code'),
+            'isoCountry' => Values::array_get($payload, 'iso_country'),
+            'addressRequirements' => Values::array_get($payload, 'address_requirements'),
+            'beta' => Values::array_get($payload, 'beta'),
+            'capabilities' => Values::array_get($payload, 'capabilities'),
+        );
+
+        $this->solution = array('accountSid' => $accountSid, 'countryCode' => $countryCode, );
+    }
+
+    /**
+     * 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.Api.V2010.TollFreeInstance]';
+    }
+}

+ 153 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/TollFreeList.php

@@ -0,0 +1,153 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry;
+
+use Twilio\ListResource;
+use Twilio\Options;
+use Twilio\Serialize;
+use Twilio\Values;
+use Twilio\Version;
+
+class TollFreeList extends ListResource {
+    /**
+     * Construct the TollFreeList
+     * 
+     * @param Version $version Version that contains the resource
+     * @param string $accountSid The 34 character string that uniquely identifies
+     *                           your account.
+     * @param string $countryCode The ISO Country code to lookup phone numbers for.
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\TollFreeList 
+     */
+    public function __construct(Version $version, $accountSid, $countryCode) {
+        parent::__construct($version);
+
+        // Path Solution
+        $this->solution = array('accountSid' => $accountSid, 'countryCode' => $countryCode, );
+
+        $this->uri = '/Accounts/' . rawurlencode($accountSid) . '/AvailablePhoneNumbers/' . rawurlencode($countryCode) . '/TollFree.json';
+    }
+
+    /**
+     * Streams TollFreeInstance records from the API as a generator stream.
+     * This operation lazily loads records as efficiently as possible until the
+     * limit
+     * is reached.
+     * The results are returned as a generator, so this operation is memory
+     * efficient.
+     * 
+     * @param array|Options $options Optional Arguments
+     * @param int $limit Upper limit for the number of records to return. stream()
+     *                   guarantees to never return more than limit.  Default is no
+     *                   limit
+     * @param mixed $pageSize Number of records to fetch per request, when not set
+     *                        will use the default value of 50 records.  If no
+     *                        page_size is defined but a limit is defined, stream()
+     *                        will attempt to read the limit with the most
+     *                        efficient page size, i.e. min(limit, 1000)
+     * @return \Twilio\Stream stream of results
+     */
+    public function stream($options = array(), $limit = null, $pageSize = null) {
+        $limits = $this->version->readLimits($limit, $pageSize);
+
+        $page = $this->page($options, $limits['pageSize']);
+
+        return $this->version->stream($page, $limits['limit'], $limits['pageLimit']);
+    }
+
+    /**
+     * Reads TollFreeInstance records from the API as a list.
+     * Unlike stream(), this operation is eager and will load `limit` records into
+     * memory before returning.
+     * 
+     * @param array|Options $options Optional Arguments
+     * @param int $limit Upper limit for the number of records to return. read()
+     *                   guarantees to never return more than limit.  Default is no
+     *                   limit
+     * @param mixed $pageSize Number of records to fetch per request, when not set
+     *                        will use the default value of 50 records.  If no
+     *                        page_size is defined but a limit is defined, read()
+     *                        will attempt to read the limit with the most
+     *                        efficient page size, i.e. min(limit, 1000)
+     * @return TollFreeInstance[] Array of results
+     */
+    public function read($options = array(), $limit = null, $pageSize = null) {
+        return iterator_to_array($this->stream($options, $limit, $pageSize), false);
+    }
+
+    /**
+     * Retrieve a single page of TollFreeInstance records from the API.
+     * Request is executed immediately
+     * 
+     * @param array|Options $options Optional Arguments
+     * @param mixed $pageSize Number of records to return, defaults to 50
+     * @param string $pageToken PageToken provided by the API
+     * @param mixed $pageNumber Page Number, this value is simply for client state
+     * @return \Twilio\Page Page of TollFreeInstance
+     */
+    public function page($options = array(), $pageSize = Values::NONE, $pageToken = Values::NONE, $pageNumber = Values::NONE) {
+        $options = new Values($options);
+        $params = Values::of(array(
+            'AreaCode' => $options['areaCode'],
+            'Contains' => $options['contains'],
+            'SmsEnabled' => Serialize::booleanToString($options['smsEnabled']),
+            'MmsEnabled' => Serialize::booleanToString($options['mmsEnabled']),
+            'VoiceEnabled' => Serialize::booleanToString($options['voiceEnabled']),
+            'ExcludeAllAddressRequired' => Serialize::booleanToString($options['excludeAllAddressRequired']),
+            'ExcludeLocalAddressRequired' => Serialize::booleanToString($options['excludeLocalAddressRequired']),
+            'ExcludeForeignAddressRequired' => Serialize::booleanToString($options['excludeForeignAddressRequired']),
+            'Beta' => Serialize::booleanToString($options['beta']),
+            'NearNumber' => $options['nearNumber'],
+            'NearLatLong' => $options['nearLatLong'],
+            'Distance' => $options['distance'],
+            'InPostalCode' => $options['inPostalCode'],
+            'InRegion' => $options['inRegion'],
+            'InRateCenter' => $options['inRateCenter'],
+            'InLata' => $options['inLata'],
+            'InLocality' => $options['inLocality'],
+            'FaxEnabled' => Serialize::booleanToString($options['faxEnabled']),
+            'PageToken' => $pageToken,
+            'Page' => $pageNumber,
+            'PageSize' => $pageSize,
+        ));
+
+        $response = $this->version->page(
+            'GET',
+            $this->uri,
+            $params
+        );
+
+        return new TollFreePage($this->version, $response, $this->solution);
+    }
+
+    /**
+     * Retrieve a specific page of TollFreeInstance records from the API.
+     * Request is executed immediately
+     * 
+     * @param string $targetUrl API-generated URL for the requested results page
+     * @return \Twilio\Page Page of TollFreeInstance
+     */
+    public function getPage($targetUrl) {
+        $response = $this->version->getDomain()->getClient()->request(
+            'GET',
+            $targetUrl
+        );
+
+        return new TollFreePage($this->version, $response, $this->solution);
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        return '[Twilio.Api.V2010.TollFreeList]';
+    }
+}

+ 302 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/TollFreeOptions.php

@@ -0,0 +1,302 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry;
+
+use Twilio\Options;
+use Twilio\Values;
+
+abstract class TollFreeOptions {
+    /**
+     * @param integer $areaCode The area_code
+     * @param string $contains The contains
+     * @param boolean $smsEnabled The sms_enabled
+     * @param boolean $mmsEnabled The mms_enabled
+     * @param boolean $voiceEnabled The voice_enabled
+     * @param boolean $excludeAllAddressRequired The exclude_all_address_required
+     * @param boolean $excludeLocalAddressRequired The
+     *                                             exclude_local_address_required
+     * @param boolean $excludeForeignAddressRequired The
+     *                                               exclude_foreign_address_required
+     * @param boolean $beta The beta
+     * @param string $nearNumber The near_number
+     * @param string $nearLatLong The near_lat_long
+     * @param integer $distance The distance
+     * @param string $inPostalCode The in_postal_code
+     * @param string $inRegion The in_region
+     * @param string $inRateCenter The in_rate_center
+     * @param string $inLata The in_lata
+     * @param string $inLocality The in_locality
+     * @param boolean $faxEnabled The fax_enabled
+     * @return ReadTollFreeOptions Options builder
+     */
+    public static function read($areaCode = Values::NONE, $contains = Values::NONE, $smsEnabled = Values::NONE, $mmsEnabled = Values::NONE, $voiceEnabled = Values::NONE, $excludeAllAddressRequired = Values::NONE, $excludeLocalAddressRequired = Values::NONE, $excludeForeignAddressRequired = Values::NONE, $beta = Values::NONE, $nearNumber = Values::NONE, $nearLatLong = Values::NONE, $distance = Values::NONE, $inPostalCode = Values::NONE, $inRegion = Values::NONE, $inRateCenter = Values::NONE, $inLata = Values::NONE, $inLocality = Values::NONE, $faxEnabled = Values::NONE) {
+        return new ReadTollFreeOptions($areaCode, $contains, $smsEnabled, $mmsEnabled, $voiceEnabled, $excludeAllAddressRequired, $excludeLocalAddressRequired, $excludeForeignAddressRequired, $beta, $nearNumber, $nearLatLong, $distance, $inPostalCode, $inRegion, $inRateCenter, $inLata, $inLocality, $faxEnabled);
+    }
+}
+
+class ReadTollFreeOptions extends Options {
+    /**
+     * @param integer $areaCode The area_code
+     * @param string $contains The contains
+     * @param boolean $smsEnabled The sms_enabled
+     * @param boolean $mmsEnabled The mms_enabled
+     * @param boolean $voiceEnabled The voice_enabled
+     * @param boolean $excludeAllAddressRequired The exclude_all_address_required
+     * @param boolean $excludeLocalAddressRequired The
+     *                                             exclude_local_address_required
+     * @param boolean $excludeForeignAddressRequired The
+     *                                               exclude_foreign_address_required
+     * @param boolean $beta The beta
+     * @param string $nearNumber The near_number
+     * @param string $nearLatLong The near_lat_long
+     * @param integer $distance The distance
+     * @param string $inPostalCode The in_postal_code
+     * @param string $inRegion The in_region
+     * @param string $inRateCenter The in_rate_center
+     * @param string $inLata The in_lata
+     * @param string $inLocality The in_locality
+     * @param boolean $faxEnabled The fax_enabled
+     */
+    public function __construct($areaCode = Values::NONE, $contains = Values::NONE, $smsEnabled = Values::NONE, $mmsEnabled = Values::NONE, $voiceEnabled = Values::NONE, $excludeAllAddressRequired = Values::NONE, $excludeLocalAddressRequired = Values::NONE, $excludeForeignAddressRequired = Values::NONE, $beta = Values::NONE, $nearNumber = Values::NONE, $nearLatLong = Values::NONE, $distance = Values::NONE, $inPostalCode = Values::NONE, $inRegion = Values::NONE, $inRateCenter = Values::NONE, $inLata = Values::NONE, $inLocality = Values::NONE, $faxEnabled = Values::NONE) {
+        $this->options['areaCode'] = $areaCode;
+        $this->options['contains'] = $contains;
+        $this->options['smsEnabled'] = $smsEnabled;
+        $this->options['mmsEnabled'] = $mmsEnabled;
+        $this->options['voiceEnabled'] = $voiceEnabled;
+        $this->options['excludeAllAddressRequired'] = $excludeAllAddressRequired;
+        $this->options['excludeLocalAddressRequired'] = $excludeLocalAddressRequired;
+        $this->options['excludeForeignAddressRequired'] = $excludeForeignAddressRequired;
+        $this->options['beta'] = $beta;
+        $this->options['nearNumber'] = $nearNumber;
+        $this->options['nearLatLong'] = $nearLatLong;
+        $this->options['distance'] = $distance;
+        $this->options['inPostalCode'] = $inPostalCode;
+        $this->options['inRegion'] = $inRegion;
+        $this->options['inRateCenter'] = $inRateCenter;
+        $this->options['inLata'] = $inLata;
+        $this->options['inLocality'] = $inLocality;
+        $this->options['faxEnabled'] = $faxEnabled;
+    }
+
+    /**
+     * The area_code
+     * 
+     * @param integer $areaCode The area_code
+     * @return $this Fluent Builder
+     */
+    public function setAreaCode($areaCode) {
+        $this->options['areaCode'] = $areaCode;
+        return $this;
+    }
+
+    /**
+     * The contains
+     * 
+     * @param string $contains The contains
+     * @return $this Fluent Builder
+     */
+    public function setContains($contains) {
+        $this->options['contains'] = $contains;
+        return $this;
+    }
+
+    /**
+     * The sms_enabled
+     * 
+     * @param boolean $smsEnabled The sms_enabled
+     * @return $this Fluent Builder
+     */
+    public function setSmsEnabled($smsEnabled) {
+        $this->options['smsEnabled'] = $smsEnabled;
+        return $this;
+    }
+
+    /**
+     * The mms_enabled
+     * 
+     * @param boolean $mmsEnabled The mms_enabled
+     * @return $this Fluent Builder
+     */
+    public function setMmsEnabled($mmsEnabled) {
+        $this->options['mmsEnabled'] = $mmsEnabled;
+        return $this;
+    }
+
+    /**
+     * The voice_enabled
+     * 
+     * @param boolean $voiceEnabled The voice_enabled
+     * @return $this Fluent Builder
+     */
+    public function setVoiceEnabled($voiceEnabled) {
+        $this->options['voiceEnabled'] = $voiceEnabled;
+        return $this;
+    }
+
+    /**
+     * The exclude_all_address_required
+     * 
+     * @param boolean $excludeAllAddressRequired The exclude_all_address_required
+     * @return $this Fluent Builder
+     */
+    public function setExcludeAllAddressRequired($excludeAllAddressRequired) {
+        $this->options['excludeAllAddressRequired'] = $excludeAllAddressRequired;
+        return $this;
+    }
+
+    /**
+     * The exclude_local_address_required
+     * 
+     * @param boolean $excludeLocalAddressRequired The
+     *                                             exclude_local_address_required
+     * @return $this Fluent Builder
+     */
+    public function setExcludeLocalAddressRequired($excludeLocalAddressRequired) {
+        $this->options['excludeLocalAddressRequired'] = $excludeLocalAddressRequired;
+        return $this;
+    }
+
+    /**
+     * The exclude_foreign_address_required
+     * 
+     * @param boolean $excludeForeignAddressRequired The
+     *                                               exclude_foreign_address_required
+     * @return $this Fluent Builder
+     */
+    public function setExcludeForeignAddressRequired($excludeForeignAddressRequired) {
+        $this->options['excludeForeignAddressRequired'] = $excludeForeignAddressRequired;
+        return $this;
+    }
+
+    /**
+     * The beta
+     * 
+     * @param boolean $beta The beta
+     * @return $this Fluent Builder
+     */
+    public function setBeta($beta) {
+        $this->options['beta'] = $beta;
+        return $this;
+    }
+
+    /**
+     * The near_number
+     * 
+     * @param string $nearNumber The near_number
+     * @return $this Fluent Builder
+     */
+    public function setNearNumber($nearNumber) {
+        $this->options['nearNumber'] = $nearNumber;
+        return $this;
+    }
+
+    /**
+     * The near_lat_long
+     * 
+     * @param string $nearLatLong The near_lat_long
+     * @return $this Fluent Builder
+     */
+    public function setNearLatLong($nearLatLong) {
+        $this->options['nearLatLong'] = $nearLatLong;
+        return $this;
+    }
+
+    /**
+     * The distance
+     * 
+     * @param integer $distance The distance
+     * @return $this Fluent Builder
+     */
+    public function setDistance($distance) {
+        $this->options['distance'] = $distance;
+        return $this;
+    }
+
+    /**
+     * The in_postal_code
+     * 
+     * @param string $inPostalCode The in_postal_code
+     * @return $this Fluent Builder
+     */
+    public function setInPostalCode($inPostalCode) {
+        $this->options['inPostalCode'] = $inPostalCode;
+        return $this;
+    }
+
+    /**
+     * The in_region
+     * 
+     * @param string $inRegion The in_region
+     * @return $this Fluent Builder
+     */
+    public function setInRegion($inRegion) {
+        $this->options['inRegion'] = $inRegion;
+        return $this;
+    }
+
+    /**
+     * The in_rate_center
+     * 
+     * @param string $inRateCenter The in_rate_center
+     * @return $this Fluent Builder
+     */
+    public function setInRateCenter($inRateCenter) {
+        $this->options['inRateCenter'] = $inRateCenter;
+        return $this;
+    }
+
+    /**
+     * The in_lata
+     * 
+     * @param string $inLata The in_lata
+     * @return $this Fluent Builder
+     */
+    public function setInLata($inLata) {
+        $this->options['inLata'] = $inLata;
+        return $this;
+    }
+
+    /**
+     * The in_locality
+     * 
+     * @param string $inLocality The in_locality
+     * @return $this Fluent Builder
+     */
+    public function setInLocality($inLocality) {
+        $this->options['inLocality'] = $inLocality;
+        return $this;
+    }
+
+    /**
+     * The fax_enabled
+     * 
+     * @param boolean $faxEnabled The fax_enabled
+     * @return $this Fluent Builder
+     */
+    public function setFaxEnabled($faxEnabled) {
+        $this->options['faxEnabled'] = $faxEnabled;
+        return $this;
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        $options = array();
+        foreach ($this->options as $key => $value) {
+            if ($value != Values::NONE) {
+                $options[] = "$key=$value";
+            }
+        }
+        return '[Twilio.Api.V2010.ReadTollFreeOptions ' . implode(' ', $options) . ']';
+    }
+}

+ 39 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/TollFreePage.php

@@ -0,0 +1,39 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry;
+
+use Twilio\Page;
+
+class TollFreePage extends Page {
+    public function __construct($version, $response, $solution) {
+        parent::__construct($version, $response);
+
+        // Path Solution
+        $this->solution = $solution;
+    }
+
+    public function buildInstance(array $payload) {
+        return new TollFreeInstance(
+            $this->version,
+            $payload,
+            $this->solution['accountSid'],
+            $this->solution['countryCode']
+        );
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        return '[Twilio.Api.V2010.TollFreePage]';
+    }
+}

+ 94 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/VoipInstance.php

@@ -0,0 +1,94 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry;
+
+use Twilio\Exceptions\TwilioException;
+use Twilio\InstanceResource;
+use Twilio\Values;
+use Twilio\Version;
+
+/**
+ * @property string friendlyName
+ * @property string phoneNumber
+ * @property string lata
+ * @property string locality
+ * @property string rateCenter
+ * @property string latitude
+ * @property string longitude
+ * @property string region
+ * @property string postalCode
+ * @property string isoCountry
+ * @property string addressRequirements
+ * @property boolean beta
+ * @property string capabilities
+ */
+class VoipInstance extends InstanceResource {
+    /**
+     * Initialize the VoipInstance
+     * 
+     * @param \Twilio\Version $version Version that contains the resource
+     * @param mixed[] $payload The response payload
+     * @param string $accountSid The 34 character string that uniquely identifies
+     *                           your account.
+     * @param string $countryCode The ISO Country code to lookup phone numbers for.
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\VoipInstance 
+     */
+    public function __construct(Version $version, array $payload, $accountSid, $countryCode) {
+        parent::__construct($version);
+
+        // Marshaled Properties
+        $this->properties = array(
+            'friendlyName' => Values::array_get($payload, 'friendly_name'),
+            'phoneNumber' => Values::array_get($payload, 'phone_number'),
+            'lata' => Values::array_get($payload, 'lata'),
+            'locality' => Values::array_get($payload, 'locality'),
+            'rateCenter' => Values::array_get($payload, 'rate_center'),
+            'latitude' => Values::array_get($payload, 'latitude'),
+            'longitude' => Values::array_get($payload, 'longitude'),
+            'region' => Values::array_get($payload, 'region'),
+            'postalCode' => Values::array_get($payload, 'postal_code'),
+            'isoCountry' => Values::array_get($payload, 'iso_country'),
+            'addressRequirements' => Values::array_get($payload, 'address_requirements'),
+            'beta' => Values::array_get($payload, 'beta'),
+            'capabilities' => Values::array_get($payload, 'capabilities'),
+        );
+
+        $this->solution = array('accountSid' => $accountSid, 'countryCode' => $countryCode, );
+    }
+
+    /**
+     * 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.Api.V2010.VoipInstance]';
+    }
+}

+ 153 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/VoipList.php

@@ -0,0 +1,153 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry;
+
+use Twilio\ListResource;
+use Twilio\Options;
+use Twilio\Serialize;
+use Twilio\Values;
+use Twilio\Version;
+
+class VoipList extends ListResource {
+    /**
+     * Construct the VoipList
+     * 
+     * @param Version $version Version that contains the resource
+     * @param string $accountSid The 34 character string that uniquely identifies
+     *                           your account.
+     * @param string $countryCode The ISO Country code to lookup phone numbers for.
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\VoipList 
+     */
+    public function __construct(Version $version, $accountSid, $countryCode) {
+        parent::__construct($version);
+
+        // Path Solution
+        $this->solution = array('accountSid' => $accountSid, 'countryCode' => $countryCode, );
+
+        $this->uri = '/Accounts/' . rawurlencode($accountSid) . '/AvailablePhoneNumbers/' . rawurlencode($countryCode) . '/Voip.json';
+    }
+
+    /**
+     * Streams VoipInstance records from the API as a generator stream.
+     * This operation lazily loads records as efficiently as possible until the
+     * limit
+     * is reached.
+     * The results are returned as a generator, so this operation is memory
+     * efficient.
+     * 
+     * @param array|Options $options Optional Arguments
+     * @param int $limit Upper limit for the number of records to return. stream()
+     *                   guarantees to never return more than limit.  Default is no
+     *                   limit
+     * @param mixed $pageSize Number of records to fetch per request, when not set
+     *                        will use the default value of 50 records.  If no
+     *                        page_size is defined but a limit is defined, stream()
+     *                        will attempt to read the limit with the most
+     *                        efficient page size, i.e. min(limit, 1000)
+     * @return \Twilio\Stream stream of results
+     */
+    public function stream($options = array(), $limit = null, $pageSize = null) {
+        $limits = $this->version->readLimits($limit, $pageSize);
+
+        $page = $this->page($options, $limits['pageSize']);
+
+        return $this->version->stream($page, $limits['limit'], $limits['pageLimit']);
+    }
+
+    /**
+     * Reads VoipInstance records from the API as a list.
+     * Unlike stream(), this operation is eager and will load `limit` records into
+     * memory before returning.
+     * 
+     * @param array|Options $options Optional Arguments
+     * @param int $limit Upper limit for the number of records to return. read()
+     *                   guarantees to never return more than limit.  Default is no
+     *                   limit
+     * @param mixed $pageSize Number of records to fetch per request, when not set
+     *                        will use the default value of 50 records.  If no
+     *                        page_size is defined but a limit is defined, read()
+     *                        will attempt to read the limit with the most
+     *                        efficient page size, i.e. min(limit, 1000)
+     * @return VoipInstance[] Array of results
+     */
+    public function read($options = array(), $limit = null, $pageSize = null) {
+        return iterator_to_array($this->stream($options, $limit, $pageSize), false);
+    }
+
+    /**
+     * Retrieve a single page of VoipInstance records from the API.
+     * Request is executed immediately
+     * 
+     * @param array|Options $options Optional Arguments
+     * @param mixed $pageSize Number of records to return, defaults to 50
+     * @param string $pageToken PageToken provided by the API
+     * @param mixed $pageNumber Page Number, this value is simply for client state
+     * @return \Twilio\Page Page of VoipInstance
+     */
+    public function page($options = array(), $pageSize = Values::NONE, $pageToken = Values::NONE, $pageNumber = Values::NONE) {
+        $options = new Values($options);
+        $params = Values::of(array(
+            'AreaCode' => $options['areaCode'],
+            'Contains' => $options['contains'],
+            'SmsEnabled' => Serialize::booleanToString($options['smsEnabled']),
+            'MmsEnabled' => Serialize::booleanToString($options['mmsEnabled']),
+            'VoiceEnabled' => Serialize::booleanToString($options['voiceEnabled']),
+            'ExcludeAllAddressRequired' => Serialize::booleanToString($options['excludeAllAddressRequired']),
+            'ExcludeLocalAddressRequired' => Serialize::booleanToString($options['excludeLocalAddressRequired']),
+            'ExcludeForeignAddressRequired' => Serialize::booleanToString($options['excludeForeignAddressRequired']),
+            'Beta' => Serialize::booleanToString($options['beta']),
+            'NearNumber' => $options['nearNumber'],
+            'NearLatLong' => $options['nearLatLong'],
+            'Distance' => $options['distance'],
+            'InPostalCode' => $options['inPostalCode'],
+            'InRegion' => $options['inRegion'],
+            'InRateCenter' => $options['inRateCenter'],
+            'InLata' => $options['inLata'],
+            'InLocality' => $options['inLocality'],
+            'FaxEnabled' => Serialize::booleanToString($options['faxEnabled']),
+            'PageToken' => $pageToken,
+            'Page' => $pageNumber,
+            'PageSize' => $pageSize,
+        ));
+
+        $response = $this->version->page(
+            'GET',
+            $this->uri,
+            $params
+        );
+
+        return new VoipPage($this->version, $response, $this->solution);
+    }
+
+    /**
+     * Retrieve a specific page of VoipInstance records from the API.
+     * Request is executed immediately
+     * 
+     * @param string $targetUrl API-generated URL for the requested results page
+     * @return \Twilio\Page Page of VoipInstance
+     */
+    public function getPage($targetUrl) {
+        $response = $this->version->getDomain()->getClient()->request(
+            'GET',
+            $targetUrl
+        );
+
+        return new VoipPage($this->version, $response, $this->solution);
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        return '[Twilio.Api.V2010.VoipList]';
+    }
+}

+ 302 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/VoipOptions.php

@@ -0,0 +1,302 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry;
+
+use Twilio\Options;
+use Twilio\Values;
+
+abstract class VoipOptions {
+    /**
+     * @param integer $areaCode The area_code
+     * @param string $contains The contains
+     * @param boolean $smsEnabled The sms_enabled
+     * @param boolean $mmsEnabled The mms_enabled
+     * @param boolean $voiceEnabled The voice_enabled
+     * @param boolean $excludeAllAddressRequired The exclude_all_address_required
+     * @param boolean $excludeLocalAddressRequired The
+     *                                             exclude_local_address_required
+     * @param boolean $excludeForeignAddressRequired The
+     *                                               exclude_foreign_address_required
+     * @param boolean $beta The beta
+     * @param string $nearNumber The near_number
+     * @param string $nearLatLong The near_lat_long
+     * @param integer $distance The distance
+     * @param string $inPostalCode The in_postal_code
+     * @param string $inRegion The in_region
+     * @param string $inRateCenter The in_rate_center
+     * @param string $inLata The in_lata
+     * @param string $inLocality The in_locality
+     * @param boolean $faxEnabled The fax_enabled
+     * @return ReadVoipOptions Options builder
+     */
+    public static function read($areaCode = Values::NONE, $contains = Values::NONE, $smsEnabled = Values::NONE, $mmsEnabled = Values::NONE, $voiceEnabled = Values::NONE, $excludeAllAddressRequired = Values::NONE, $excludeLocalAddressRequired = Values::NONE, $excludeForeignAddressRequired = Values::NONE, $beta = Values::NONE, $nearNumber = Values::NONE, $nearLatLong = Values::NONE, $distance = Values::NONE, $inPostalCode = Values::NONE, $inRegion = Values::NONE, $inRateCenter = Values::NONE, $inLata = Values::NONE, $inLocality = Values::NONE, $faxEnabled = Values::NONE) {
+        return new ReadVoipOptions($areaCode, $contains, $smsEnabled, $mmsEnabled, $voiceEnabled, $excludeAllAddressRequired, $excludeLocalAddressRequired, $excludeForeignAddressRequired, $beta, $nearNumber, $nearLatLong, $distance, $inPostalCode, $inRegion, $inRateCenter, $inLata, $inLocality, $faxEnabled);
+    }
+}
+
+class ReadVoipOptions extends Options {
+    /**
+     * @param integer $areaCode The area_code
+     * @param string $contains The contains
+     * @param boolean $smsEnabled The sms_enabled
+     * @param boolean $mmsEnabled The mms_enabled
+     * @param boolean $voiceEnabled The voice_enabled
+     * @param boolean $excludeAllAddressRequired The exclude_all_address_required
+     * @param boolean $excludeLocalAddressRequired The
+     *                                             exclude_local_address_required
+     * @param boolean $excludeForeignAddressRequired The
+     *                                               exclude_foreign_address_required
+     * @param boolean $beta The beta
+     * @param string $nearNumber The near_number
+     * @param string $nearLatLong The near_lat_long
+     * @param integer $distance The distance
+     * @param string $inPostalCode The in_postal_code
+     * @param string $inRegion The in_region
+     * @param string $inRateCenter The in_rate_center
+     * @param string $inLata The in_lata
+     * @param string $inLocality The in_locality
+     * @param boolean $faxEnabled The fax_enabled
+     */
+    public function __construct($areaCode = Values::NONE, $contains = Values::NONE, $smsEnabled = Values::NONE, $mmsEnabled = Values::NONE, $voiceEnabled = Values::NONE, $excludeAllAddressRequired = Values::NONE, $excludeLocalAddressRequired = Values::NONE, $excludeForeignAddressRequired = Values::NONE, $beta = Values::NONE, $nearNumber = Values::NONE, $nearLatLong = Values::NONE, $distance = Values::NONE, $inPostalCode = Values::NONE, $inRegion = Values::NONE, $inRateCenter = Values::NONE, $inLata = Values::NONE, $inLocality = Values::NONE, $faxEnabled = Values::NONE) {
+        $this->options['areaCode'] = $areaCode;
+        $this->options['contains'] = $contains;
+        $this->options['smsEnabled'] = $smsEnabled;
+        $this->options['mmsEnabled'] = $mmsEnabled;
+        $this->options['voiceEnabled'] = $voiceEnabled;
+        $this->options['excludeAllAddressRequired'] = $excludeAllAddressRequired;
+        $this->options['excludeLocalAddressRequired'] = $excludeLocalAddressRequired;
+        $this->options['excludeForeignAddressRequired'] = $excludeForeignAddressRequired;
+        $this->options['beta'] = $beta;
+        $this->options['nearNumber'] = $nearNumber;
+        $this->options['nearLatLong'] = $nearLatLong;
+        $this->options['distance'] = $distance;
+        $this->options['inPostalCode'] = $inPostalCode;
+        $this->options['inRegion'] = $inRegion;
+        $this->options['inRateCenter'] = $inRateCenter;
+        $this->options['inLata'] = $inLata;
+        $this->options['inLocality'] = $inLocality;
+        $this->options['faxEnabled'] = $faxEnabled;
+    }
+
+    /**
+     * The area_code
+     * 
+     * @param integer $areaCode The area_code
+     * @return $this Fluent Builder
+     */
+    public function setAreaCode($areaCode) {
+        $this->options['areaCode'] = $areaCode;
+        return $this;
+    }
+
+    /**
+     * The contains
+     * 
+     * @param string $contains The contains
+     * @return $this Fluent Builder
+     */
+    public function setContains($contains) {
+        $this->options['contains'] = $contains;
+        return $this;
+    }
+
+    /**
+     * The sms_enabled
+     * 
+     * @param boolean $smsEnabled The sms_enabled
+     * @return $this Fluent Builder
+     */
+    public function setSmsEnabled($smsEnabled) {
+        $this->options['smsEnabled'] = $smsEnabled;
+        return $this;
+    }
+
+    /**
+     * The mms_enabled
+     * 
+     * @param boolean $mmsEnabled The mms_enabled
+     * @return $this Fluent Builder
+     */
+    public function setMmsEnabled($mmsEnabled) {
+        $this->options['mmsEnabled'] = $mmsEnabled;
+        return $this;
+    }
+
+    /**
+     * The voice_enabled
+     * 
+     * @param boolean $voiceEnabled The voice_enabled
+     * @return $this Fluent Builder
+     */
+    public function setVoiceEnabled($voiceEnabled) {
+        $this->options['voiceEnabled'] = $voiceEnabled;
+        return $this;
+    }
+
+    /**
+     * The exclude_all_address_required
+     * 
+     * @param boolean $excludeAllAddressRequired The exclude_all_address_required
+     * @return $this Fluent Builder
+     */
+    public function setExcludeAllAddressRequired($excludeAllAddressRequired) {
+        $this->options['excludeAllAddressRequired'] = $excludeAllAddressRequired;
+        return $this;
+    }
+
+    /**
+     * The exclude_local_address_required
+     * 
+     * @param boolean $excludeLocalAddressRequired The
+     *                                             exclude_local_address_required
+     * @return $this Fluent Builder
+     */
+    public function setExcludeLocalAddressRequired($excludeLocalAddressRequired) {
+        $this->options['excludeLocalAddressRequired'] = $excludeLocalAddressRequired;
+        return $this;
+    }
+
+    /**
+     * The exclude_foreign_address_required
+     * 
+     * @param boolean $excludeForeignAddressRequired The
+     *                                               exclude_foreign_address_required
+     * @return $this Fluent Builder
+     */
+    public function setExcludeForeignAddressRequired($excludeForeignAddressRequired) {
+        $this->options['excludeForeignAddressRequired'] = $excludeForeignAddressRequired;
+        return $this;
+    }
+
+    /**
+     * The beta
+     * 
+     * @param boolean $beta The beta
+     * @return $this Fluent Builder
+     */
+    public function setBeta($beta) {
+        $this->options['beta'] = $beta;
+        return $this;
+    }
+
+    /**
+     * The near_number
+     * 
+     * @param string $nearNumber The near_number
+     * @return $this Fluent Builder
+     */
+    public function setNearNumber($nearNumber) {
+        $this->options['nearNumber'] = $nearNumber;
+        return $this;
+    }
+
+    /**
+     * The near_lat_long
+     * 
+     * @param string $nearLatLong The near_lat_long
+     * @return $this Fluent Builder
+     */
+    public function setNearLatLong($nearLatLong) {
+        $this->options['nearLatLong'] = $nearLatLong;
+        return $this;
+    }
+
+    /**
+     * The distance
+     * 
+     * @param integer $distance The distance
+     * @return $this Fluent Builder
+     */
+    public function setDistance($distance) {
+        $this->options['distance'] = $distance;
+        return $this;
+    }
+
+    /**
+     * The in_postal_code
+     * 
+     * @param string $inPostalCode The in_postal_code
+     * @return $this Fluent Builder
+     */
+    public function setInPostalCode($inPostalCode) {
+        $this->options['inPostalCode'] = $inPostalCode;
+        return $this;
+    }
+
+    /**
+     * The in_region
+     * 
+     * @param string $inRegion The in_region
+     * @return $this Fluent Builder
+     */
+    public function setInRegion($inRegion) {
+        $this->options['inRegion'] = $inRegion;
+        return $this;
+    }
+
+    /**
+     * The in_rate_center
+     * 
+     * @param string $inRateCenter The in_rate_center
+     * @return $this Fluent Builder
+     */
+    public function setInRateCenter($inRateCenter) {
+        $this->options['inRateCenter'] = $inRateCenter;
+        return $this;
+    }
+
+    /**
+     * The in_lata
+     * 
+     * @param string $inLata The in_lata
+     * @return $this Fluent Builder
+     */
+    public function setInLata($inLata) {
+        $this->options['inLata'] = $inLata;
+        return $this;
+    }
+
+    /**
+     * The in_locality
+     * 
+     * @param string $inLocality The in_locality
+     * @return $this Fluent Builder
+     */
+    public function setInLocality($inLocality) {
+        $this->options['inLocality'] = $inLocality;
+        return $this;
+    }
+
+    /**
+     * The fax_enabled
+     * 
+     * @param boolean $faxEnabled The fax_enabled
+     * @return $this Fluent Builder
+     */
+    public function setFaxEnabled($faxEnabled) {
+        $this->options['faxEnabled'] = $faxEnabled;
+        return $this;
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        $options = array();
+        foreach ($this->options as $key => $value) {
+            if ($value != Values::NONE) {
+                $options[] = "$key=$value";
+            }
+        }
+        return '[Twilio.Api.V2010.ReadVoipOptions ' . implode(' ', $options) . ']';
+    }
+}

+ 39 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/VoipPage.php

@@ -0,0 +1,39 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry;
+
+use Twilio\Page;
+
+class VoipPage extends Page {
+    public function __construct($version, $response, $solution) {
+        parent::__construct($version, $response);
+
+        // Path Solution
+        $this->solution = $solution;
+    }
+
+    public function buildInstance(array $payload) {
+        return new VoipInstance(
+            $this->version,
+            $payload,
+            $this->solution['accountSid'],
+            $this->solution['countryCode']
+        );
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        return '[Twilio.Api.V2010.VoipPage]';
+    }
+}

+ 246 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountryContext.php

@@ -0,0 +1,246 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account;
+
+use Twilio\Exceptions\TwilioException;
+use Twilio\InstanceContext;
+use Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\LocalList;
+use Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\MachineToMachineList;
+use Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\MobileList;
+use Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\NationalList;
+use Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\SharedCostList;
+use Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\TollFreeList;
+use Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\VoipList;
+use Twilio\Values;
+use Twilio\Version;
+
+/**
+ * @property \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\LocalList local
+ * @property \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\TollFreeList tollFree
+ * @property \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\MobileList mobile
+ * @property \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\NationalList national
+ * @property \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\VoipList voip
+ * @property \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\SharedCostList sharedCost
+ * @property \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\MachineToMachineList machineToMachine
+ */
+class AvailablePhoneNumberCountryContext extends InstanceContext {
+    protected $_local = null;
+    protected $_tollFree = null;
+    protected $_mobile = null;
+    protected $_national = null;
+    protected $_voip = null;
+    protected $_sharedCost = null;
+    protected $_machineToMachine = null;
+
+    /**
+     * Initialize the AvailablePhoneNumberCountryContext
+     * 
+     * @param \Twilio\Version $version Version that contains the resource
+     * @param string $accountSid The account_sid
+     * @param string $countryCode The country_code
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountryContext 
+     */
+    public function __construct(Version $version, $accountSid, $countryCode) {
+        parent::__construct($version);
+
+        // Path Solution
+        $this->solution = array('accountSid' => $accountSid, 'countryCode' => $countryCode, );
+
+        $this->uri = '/Accounts/' . rawurlencode($accountSid) . '/AvailablePhoneNumbers/' . rawurlencode($countryCode) . '.json';
+    }
+
+    /**
+     * Fetch a AvailablePhoneNumberCountryInstance
+     * 
+     * @return AvailablePhoneNumberCountryInstance Fetched
+     *                                             AvailablePhoneNumberCountryInstance
+     */
+    public function fetch() {
+        $params = Values::of(array());
+
+        $payload = $this->version->fetch(
+            'GET',
+            $this->uri,
+            $params
+        );
+
+        return new AvailablePhoneNumberCountryInstance(
+            $this->version,
+            $payload,
+            $this->solution['accountSid'],
+            $this->solution['countryCode']
+        );
+    }
+
+    /**
+     * Access the local
+     * 
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\LocalList 
+     */
+    protected function getLocal() {
+        if (!$this->_local) {
+            $this->_local = new LocalList(
+                $this->version,
+                $this->solution['accountSid'],
+                $this->solution['countryCode']
+            );
+        }
+
+        return $this->_local;
+    }
+
+    /**
+     * Access the tollFree
+     * 
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\TollFreeList 
+     */
+    protected function getTollFree() {
+        if (!$this->_tollFree) {
+            $this->_tollFree = new TollFreeList(
+                $this->version,
+                $this->solution['accountSid'],
+                $this->solution['countryCode']
+            );
+        }
+
+        return $this->_tollFree;
+    }
+
+    /**
+     * Access the mobile
+     * 
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\MobileList 
+     */
+    protected function getMobile() {
+        if (!$this->_mobile) {
+            $this->_mobile = new MobileList(
+                $this->version,
+                $this->solution['accountSid'],
+                $this->solution['countryCode']
+            );
+        }
+
+        return $this->_mobile;
+    }
+
+    /**
+     * Access the national
+     * 
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\NationalList 
+     */
+    protected function getNational() {
+        if (!$this->_national) {
+            $this->_national = new NationalList(
+                $this->version,
+                $this->solution['accountSid'],
+                $this->solution['countryCode']
+            );
+        }
+
+        return $this->_national;
+    }
+
+    /**
+     * Access the voip
+     * 
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\VoipList 
+     */
+    protected function getVoip() {
+        if (!$this->_voip) {
+            $this->_voip = new VoipList(
+                $this->version,
+                $this->solution['accountSid'],
+                $this->solution['countryCode']
+            );
+        }
+
+        return $this->_voip;
+    }
+
+    /**
+     * Access the sharedCost
+     * 
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\SharedCostList 
+     */
+    protected function getSharedCost() {
+        if (!$this->_sharedCost) {
+            $this->_sharedCost = new SharedCostList(
+                $this->version,
+                $this->solution['accountSid'],
+                $this->solution['countryCode']
+            );
+        }
+
+        return $this->_sharedCost;
+    }
+
+    /**
+     * Access the machineToMachine
+     * 
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\MachineToMachineList 
+     */
+    protected function getMachineToMachine() {
+        if (!$this->_machineToMachine) {
+            $this->_machineToMachine = new MachineToMachineList(
+                $this->version,
+                $this->solution['accountSid'],
+                $this->solution['countryCode']
+            );
+        }
+
+        return $this->_machineToMachine;
+    }
+
+    /**
+     * 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.Api.V2010.AvailablePhoneNumberCountryContext ' . implode(' ', $context) . ']';
+    }
+}

+ 184 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountryInstance.php

@@ -0,0 +1,184 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account;
+
+use Twilio\Exceptions\TwilioException;
+use Twilio\InstanceResource;
+use Twilio\Values;
+use Twilio\Version;
+
+/**
+ * @property string countryCode
+ * @property string country
+ * @property string uri
+ * @property boolean beta
+ * @property array subresourceUris
+ */
+class AvailablePhoneNumberCountryInstance extends InstanceResource {
+    protected $_local = null;
+    protected $_tollFree = null;
+    protected $_mobile = null;
+    protected $_national = null;
+    protected $_voip = null;
+    protected $_sharedCost = null;
+    protected $_machineToMachine = null;
+
+    /**
+     * Initialize the AvailablePhoneNumberCountryInstance
+     * 
+     * @param \Twilio\Version $version Version that contains the resource
+     * @param mixed[] $payload The response payload
+     * @param string $accountSid A 34 character string that uniquely identifies
+     *                           this resource.
+     * @param string $countryCode The country_code
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountryInstance 
+     */
+    public function __construct(Version $version, array $payload, $accountSid, $countryCode = null) {
+        parent::__construct($version);
+
+        // Marshaled Properties
+        $this->properties = array(
+            'countryCode' => Values::array_get($payload, 'country_code'),
+            'country' => Values::array_get($payload, 'country'),
+            'uri' => Values::array_get($payload, 'uri'),
+            'beta' => Values::array_get($payload, 'beta'),
+            'subresourceUris' => Values::array_get($payload, 'subresource_uris'),
+        );
+
+        $this->solution = array(
+            'accountSid' => $accountSid,
+            'countryCode' => $countryCode ?: $this->properties['countryCode'],
+        );
+    }
+
+    /**
+     * 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\Api\V2010\Account\AvailablePhoneNumberCountryContext Context for this AvailablePhoneNumberCountryInstance
+     */
+    protected function proxy() {
+        if (!$this->context) {
+            $this->context = new AvailablePhoneNumberCountryContext(
+                $this->version,
+                $this->solution['accountSid'],
+                $this->solution['countryCode']
+            );
+        }
+
+        return $this->context;
+    }
+
+    /**
+     * Fetch a AvailablePhoneNumberCountryInstance
+     * 
+     * @return AvailablePhoneNumberCountryInstance Fetched
+     *                                             AvailablePhoneNumberCountryInstance
+     */
+    public function fetch() {
+        return $this->proxy()->fetch();
+    }
+
+    /**
+     * Access the local
+     * 
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\LocalList 
+     */
+    protected function getLocal() {
+        return $this->proxy()->local;
+    }
+
+    /**
+     * Access the tollFree
+     * 
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\TollFreeList 
+     */
+    protected function getTollFree() {
+        return $this->proxy()->tollFree;
+    }
+
+    /**
+     * Access the mobile
+     * 
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\MobileList 
+     */
+    protected function getMobile() {
+        return $this->proxy()->mobile;
+    }
+
+    /**
+     * Access the national
+     * 
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\NationalList 
+     */
+    protected function getNational() {
+        return $this->proxy()->national;
+    }
+
+    /**
+     * Access the voip
+     * 
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\VoipList 
+     */
+    protected function getVoip() {
+        return $this->proxy()->voip;
+    }
+
+    /**
+     * Access the sharedCost
+     * 
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\SharedCostList 
+     */
+    protected function getSharedCost() {
+        return $this->proxy()->sharedCost;
+    }
+
+    /**
+     * Access the machineToMachine
+     * 
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\MachineToMachineList 
+     */
+    protected function getMachineToMachine() {
+        return $this->proxy()->machineToMachine;
+    }
+
+    /**
+     * 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.Api.V2010.AvailablePhoneNumberCountryInstance ' . implode(' ', $context) . ']';
+    }
+}

+ 145 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountryList.php

@@ -0,0 +1,145 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account;
+
+use Twilio\ListResource;
+use Twilio\Values;
+use Twilio\Version;
+
+class AvailablePhoneNumberCountryList extends ListResource {
+    /**
+     * Construct the AvailablePhoneNumberCountryList
+     * 
+     * @param Version $version Version that contains the resource
+     * @param string $accountSid A 34 character string that uniquely identifies
+     *                           this resource.
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountryList 
+     */
+    public function __construct(Version $version, $accountSid) {
+        parent::__construct($version);
+
+        // Path Solution
+        $this->solution = array('accountSid' => $accountSid, );
+
+        $this->uri = '/Accounts/' . rawurlencode($accountSid) . '/AvailablePhoneNumbers.json';
+    }
+
+    /**
+     * Streams AvailablePhoneNumberCountryInstance 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 AvailablePhoneNumberCountryInstance 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 AvailablePhoneNumberCountryInstance[] Array of results
+     */
+    public function read($limit = null, $pageSize = null) {
+        return iterator_to_array($this->stream($limit, $pageSize), false);
+    }
+
+    /**
+     * Retrieve a single page of AvailablePhoneNumberCountryInstance 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 AvailablePhoneNumberCountryInstance
+     */
+    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 AvailablePhoneNumberCountryPage($this->version, $response, $this->solution);
+    }
+
+    /**
+     * Retrieve a specific page of AvailablePhoneNumberCountryInstance records from
+     * the API.
+     * Request is executed immediately
+     * 
+     * @param string $targetUrl API-generated URL for the requested results page
+     * @return \Twilio\Page Page of AvailablePhoneNumberCountryInstance
+     */
+    public function getPage($targetUrl) {
+        $response = $this->version->getDomain()->getClient()->request(
+            'GET',
+            $targetUrl
+        );
+
+        return new AvailablePhoneNumberCountryPage($this->version, $response, $this->solution);
+    }
+
+    /**
+     * Constructs a AvailablePhoneNumberCountryContext
+     * 
+     * @param string $countryCode The country_code
+     * @return \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountryContext 
+     */
+    public function getContext($countryCode) {
+        return new AvailablePhoneNumberCountryContext(
+            $this->version,
+            $this->solution['accountSid'],
+            $countryCode
+        );
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        return '[Twilio.Api.V2010.AvailablePhoneNumberCountryList]';
+    }
+}

+ 38 - 0
plugins/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountryPage.php

@@ -0,0 +1,38 @@
+<?php
+
+/**
+ * This code was generated by
+ * \ / _    _  _|   _  _
+ * | (_)\/(_)(_|\/| |(/_  v1.0.0
+ * /       /
+ */
+
+namespace Twilio\Rest\Api\V2010\Account;
+
+use Twilio\Page;
+
+class AvailablePhoneNumberCountryPage extends Page {
+    public function __construct($version, $response, $solution) {
+        parent::__construct($version, $response);
+
+        // Path Solution
+        $this->solution = $solution;
+    }
+
+    public function buildInstance(array $payload) {
+        return new AvailablePhoneNumberCountryInstance(
+            $this->version,
+            $payload,
+            $this->solution['accountSid']
+        );
+    }
+
+    /**
+     * Provide a friendly representation
+     * 
+     * @return string Machine friendly representation
+     */
+    public function __toString() {
+        return '[Twilio.Api.V2010.AvailablePhoneNumberCountryPage]';
+    }
+}

Някои файлове не бяха показани, защото твърде много файлове са промени