8889841cphpdox.xml000064400000000632150515725670006606 0ustar00 Dockerfile-dev000064400000000570150515725670007331 0ustar00ARG version FROM php:$version RUN curl --silent --show-error https://getcomposer.org/installer | php RUN mv composer.phar /usr/local/bin/composer RUN apt-get update -y && \ apt-get upgrade -y && \ apt-get dist-upgrade -y && \ apt-get -y autoremove && \ apt-get clean RUN apt-get install -y zip unzip git ENV COMPOSER_ALLOW_SUPERUSER=1 WORKDIR /twilio PULL_REQUEST_TEMPLATE.md000064400000003151150515725670010362 0ustar00 # Fixes # A short description of what this PR does. ### Checklist - [x] I acknowledge that all my contributions will be made under the project's license - [ ] I have made a material change to the repo (functionality, testing, spelling, grammar) - [ ] I have read the [Contribution Guidelines](https://github.com/twilio/twilio-php/blob/main/CONTRIBUTING.md) and my PR follows them - [ ] I have titled the PR appropriately - [ ] I have updated my branch with the main branch - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have added the necessary documentation about the functionality in the appropriate .md file - [ ] I have added inline documentation to the code I modified If you have questions, please file a [support ticket](https://twilio.com/help/contact), or create a GitHub Issue in this repository. src/Twilio/ListResource.php000064400000000456150515725670011760 0ustar00version = $version; } public function __toString(): string { return '[ListResource]'; } } src/Twilio/Options.php000064400000000336150515725670010765 0ustar00options); } } src/Twilio/TaskRouter/WorkflowRule.php000064400000001505150515725670014076 0ustar00 * @license http://creativecommons.org/licenses/MIT/ MIT */ class WorkflowRule implements \JsonSerializable { public $expression; public $friendly_name; public $targets; public function __construct(string $expression, array $targets, string $friendly_name = null) { $this->expression = $expression; $this->targets = $targets; $this->friendly_name = $friendly_name; } public function jsonSerialize(): array { $json = []; $json['expression'] = $this->expression; $json['targets'] = $this->targets; if ($this->friendly_name !== null) { $json['friendly_name'] = $this->friendly_name; } return $json; } } src/Twilio/TaskRouter/WorkflowConfiguration.php000064400000003042150515725670015774 0ustar00 * @license http://creativecommons.org/licenses/MIT/ MIT */ class WorkflowConfiguration implements \JsonSerializable { public $filters; public $default_filter; public function __construct(array $filters, $default_filter = null) { $this->filters = $filters; $this->default_filter = $default_filter; } public function toJSON() { return \json_encode($this); } public static function parse(string $json) { return \json_decode($json); } public static function fromJson(string $json): WorkflowConfiguration { $configJSON = self::parse($json); $default_filter = $configJSON->task_routing->default_filter; $filters = []; foreach ($configJSON->task_routing->filters as $filter) { // friendly_name and filter_friendly_name should map to same variable $friendly_name = $filter->filter_friendly_name ?? $filter->friendly_name; $filter = new WorkflowRule($filter->expression, $filter->targets, $friendly_name); $filters[] = $filter; } return new WorkflowConfiguration($filters, $default_filter); } public function jsonSerialize(): array { $json = []; $task_routing = []; $task_routing['filters'] = $this->filters; $task_routing['default_filter'] = $this->default_filter; $json['task_routing'] = $task_routing; return $json; } } src/Twilio/TaskRouter/WorkflowRuleTarget.php000064400000002015150515725670015242 0ustar00 * @license http://creativecommons.org/licenses/MIT/ MIT */ class WorkflowRuleTarget implements \JsonSerializable { public $queue; public $expression; public $priority; public $timeout; public function __construct(string $queue, int $priority = null, int $timeout = null, string $expression = null) { $this->queue = $queue; $this->priority = $priority; $this->timeout = $timeout; $this->expression = $expression; } public function jsonSerialize(): array { $json = []; $json['queue'] = $this->queue; if ($this->priority !== null) { $json['priority'] = $this->priority; } if ($this->timeout !== null) { $json['timeout'] = $this->timeout; } if ($this->expression !== null) { $json['expression'] = $this->expression; } return $json; } } src/Twilio/Security/RequestValidator.php000064400000013350150515725670014437 0ustar00validate($_SERVER['HTTP_X_TWILIO_SIGNATURE'], 'https://your-example-url.com/api/route/', $_REQUEST); * $isFromTwilio // <- if this is true, the request did come from Twilio, if not, it didn't */ class RequestValidator { /** * @access private * @var string The auth token to the Twilio Account */ private $authToken; /** * constructor * @access public * @param string $authToken the auth token of the Twilio user's account * Sets the account auth token to be used by the rest of the class */ public function __construct(string $authToken) { $this->authToken = $authToken; } /** * Creates the actual base64 encoded signature of the sha1 hash of the concatenated URL and your auth token * * @param string $url the full URL of the request URL you specify for your phone number or app, from the protocol (https...) through the end of the query string (everything after the ?) * @param array $data the Twilio parameters the request was made with * @return string */ public function computeSignature(string $url, array $data = []): string { // sort the array by keys \ksort($data); // append them to the data string in order // with no delimiters foreach ($data as $key => $value) { $url .= $key . $value; } // sha1 then base64 the url to the auth token and return the base64-ed string return \base64_encode(\hash_hmac('sha1', $url, $this->authToken, true)); } /** * Converts the raw binary output to a hexadecimal return * * @param string $data * @return string */ public static function computeBodyHash(string $data = ''): string { return \bin2hex(\hash('sha256', $data, true)); } /** * The only method the client should be running...takes the Twilio signature, their URL, and the Twilio params and validates the signature * * @param string $expectedSignature * @param string $url * @param array|string $data * @return bool */ public function validate(string $expectedSignature, string $url, $data = []): bool { $parsedUrl = \parse_url($url); $urlWithPort = self::addPort($parsedUrl); $urlWithoutPort = self::removePort($parsedUrl); $validBodyHash = true; // May not receive body hash, so default succeed if (!\is_array($data)) { // handling if the data was passed through as a string instead of an array of params $queryString = \explode('?', $url); $queryString = $queryString[1]; \parse_str($queryString, $params); $validBodyHash = self::compare(self::computeBodyHash($data), Values::array_get($params, 'bodySHA256')); $data = []; } /* * Check signature of the URL with and without port information * since sig generation on the back end is inconsistent. */ $validSignatureWithPort = self::compare( $expectedSignature, $this->computeSignature($urlWithPort, $data) ); $validSignatureWithoutPort = self::compare( $expectedSignature, $this->computeSignature($urlWithoutPort, $data) ); return $validBodyHash && ($validSignatureWithPort || $validSignatureWithoutPort); } /** * Time insensitive compare, function's runtime is governed by the length * of the first argument, not the difference between the arguments. * * @param string $a First part of the comparison pair * @param string $b Second part of the comparison pair * @return bool True if $a === $b, false otherwise. */ public static function compare(?string $a, ?string $b): bool { if ($a && $b) { return hash_equals($a, $b); } return false; } /** * Removes the port from the URL * * @param array $parsedUrl * @return string Full URL without the port number */ private static function removePort(array $parsedUrl): string { unset($parsedUrl['port']); return self::unparse_url($parsedUrl); } /** * Adds the port to the URL * * @param array $parsedUrl * @return string Full URL with the port number */ private static function addPort(array $parsedUrl): string { if (!isset($parsedUrl['port'])) { $port = ($parsedUrl['scheme'] === 'https') ? 443 : 80; $parsedUrl['port'] = $port; } return self::unparse_url($parsedUrl); } /** * Builds the URL from its parsed component pieces * * @param array $parsedUrl * @return string Full URL */ static function unparse_url(array $parsedUrl): string { $parts = []; $parts['scheme'] = isset($parsedUrl['scheme']) ? $parsedUrl['scheme'] . '://' : ''; $parts['user'] = $parsedUrl['user'] ?? ''; $parts['pass'] = isset($parsedUrl['pass']) ? ':' . $parsedUrl['pass'] : ''; $parts['pass'] = ($parts['user'] || $parts['pass']) ? $parts['pass'] . '@' : ''; $parts['host'] = $parsedUrl['host'] ?? ''; $parts['port'] = isset($parsedUrl['port']) ? ':' . $parsedUrl['port'] : ''; $parts['path'] = $parsedUrl['path'] ?? ''; $parts['query'] = isset($parsedUrl['query']) ? '?' . $parsedUrl['query'] : ''; $parts['fragment'] = isset($parsedUrl['fragment']) ? '#' . $parsedUrl['fragment'] : ''; return \implode('', $parts); } } src/Twilio/Serialize.php000064400000004230150515725670011256 0ustar00 $value) { if (\is_array($value)) { $result = self::flatten($value, $result, \array_merge($previous, [$key])); } else { $result[\implode('.', \array_merge($previous, [$key]))] = $value; } } return $result; } public static function prefixedCollapsibleMap($map, string $prefix): array { if ($map === null || $map === Values::NONE) { return []; } $flattened = self::flatten($map); $result = []; foreach ($flattened as $key => $value) { $result[$prefix . '.' . $key] = $value; } return $result; } public static function iso8601Date($dateTime): string { if ($dateTime === null || $dateTime === Values::NONE) { return Values::NONE; } if (\is_string($dateTime)) { return $dateTime; } $utcDate = clone $dateTime; $utcDate->setTimezone(new \DateTimeZone('UTC')); return $utcDate->format('Y-m-d'); } public static function iso8601DateTime($dateTime): string { if ($dateTime === null || $dateTime === Values::NONE) { return Values::NONE; } if (\is_string($dateTime)) { return $dateTime; } $utcDate = clone $dateTime; $utcDate->setTimezone(new \DateTimeZone('UTC')); return $utcDate->format('Y-m-d\TH:i:s\Z'); } public static function booleanToString($boolOrStr) { if ($boolOrStr === null || \is_string($boolOrStr)) { return $boolOrStr; } return $boolOrStr ? 'True' : 'False'; } public static function jsonObject($object) { if (\is_array($object)) { return \json_encode($object); } return $object; } public static function map($values, $map_func) { if (!\is_array($values)) { return $values; } return \array_map($map_func, $values); } } src/Twilio/Stream.php000064400000005343150515725670010570 0ustar00page = $page; $this->firstPage = $page; $this->limit = $limit; $this->currentRecord = 1; $this->pageLimit = $pageLimit; $this->currentPage = 1; } /** * (PHP 5 >= 5.0.0)
* Return the current element * @link http://php.net/manual/en/iterator.current.php * @return mixed Can return any type. */ public function current() { return $this->page->current(); } /** * (PHP 5 >= 5.0.0)
* Move forward to next element * @link http://php.net/manual/en/iterator.next.php * @return void Any returned value is ignored. */ public function next(): void { $this->page->next(); $this->currentRecord++; if ($this->overLimit()) { return; } if (!$this->page->valid()) { if ($this->overPageLimit()) { return; } $this->page = $this->page->nextPage(); $this->currentPage++; } } /** * (PHP 5 >= 5.0.0)
* 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->currentRecord; } /** * (PHP 5 >= 5.0.0)
* Checks if current position is valid * @link http://php.net/manual/en/iterator.valid.php * @return bool The return value will be casted to boolean and then evaluated. * Returns true on success or false on failure. */ public function valid(): bool { return $this->page && $this->page->valid() && !$this->overLimit() && !$this->overPageLimit(); } /** * (PHP 5 >= 5.0.0)
* 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(): void { $this->page = $this->firstPage; $this->page->rewind(); $this->currentPage = 1; $this->currentRecord = 1; } protected function overLimit(): bool { return ($this->limit !== null && $this->limit !== Values::NONE && $this->limit < $this->currentRecord); } protected function overPageLimit(): bool { return ($this->pageLimit !== null && $this->pageLimit !== Values::NONE && $this->pageLimit < $this->currentPage); } } src/Twilio/InstanceResource.php000064400000001030150515725670012576 0ustar00version = $version; } public function toArray(): array { return $this->properties; } public function __toString(): string { return '[InstanceResource]'; } public function __isset($name): bool { return \array_key_exists($name, $this->properties); } } src/Twilio/Http/Response.php000064400000001520150515725670012043 0ustar00statusCode = $statusCode; $this->content = $content; $this->headers = $headers; } /** * @return mixed */ public function getContent() { return \json_decode($this->content, true); } public function getStatusCode(): int { return $this->statusCode; } public function getHeaders(): array { return $this->headers; } public function ok(): bool { return $this->getStatusCode() < 400; } public function __toString(): string { return '[Response] HTTP ' . $this->getStatusCode() . ' ' . $this->content; } } src/Twilio/Http/CurlClient.php000064400000012531150515725670012315 0ustar00curlOptions = $options; } public function request(string $method, string $url, array $params = [], array $data = [], array $headers = [], string $user = null, string $password = null, int $timeout = null): Response { $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) = ( \preg_match('/\AHTTP\/1.\d 100 Continue\Z/', $parts[0]) || \preg_match('/\AHTTP\/1.\d 200 Connection established\Z/', $parts[0]) || \preg_match('/\AHTTP\/1.\d 200 Tunnel established\Z/', $parts[0]) ) ? array($parts[1], $parts[2]) : array($parts[0], $parts[1]); $statusCode = \curl_getinfo($curl, CURLINFO_HTTP_CODE); $responseHeaders = []; $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($options[CURLOPT_INFILE]) && \is_resource($options[CURLOPT_INFILE])) { \fclose($options[CURLOPT_INFILE]); } $this->lastResponse = new Response($statusCode, $body, $responseHeaders); return $this->lastResponse; } catch (\ErrorException $e) { if (isset($curl) && \is_resource($curl)) { \curl_close($curl); } if (isset($options[CURLOPT_INFILE]) && \is_resource($options[CURLOPT_INFILE])) { \fclose($options[CURLOPT_INFILE]); } throw $e; } } public function options(string $method, string $url, array $params = [], array $data = [], array $headers = [], string $user = null, string $password = null, int $timeout = null): array { $timeout = $timeout ?? self::DEFAULT_TIMEOUT; $options = $this->curlOptions + [ CURLOPT_URL => $url, CURLOPT_HEADER => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_INFILESIZE => Null, CURLOPT_HTTPHEADER => [], CURLOPT_TIMEOUT => $timeout, ]; 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(?array $params): string { $parts = []; $params = $params ?: []; 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); } } src/Twilio/Http/GuzzleClient.php000064400000003152150515725670012667 0ustar00client = $client; } public function request(string $method, string $url, array $params = [], array $data = [], array $headers = [], string $user = null, string $password = null, int $timeout = null): Response { try { $body = Query::build($data, PHP_QUERY_RFC1738); $options = [ 'timeout' => $timeout, 'auth' => [$user, $password], 'body' => $body, ]; if ($params) { $options['query'] = $params; } $response = $this->client->send(new Request($method, $url, $headers), $options); } catch (BadResponseException $exception) { $response = $exception->getResponse(); } catch (\Exception $exception) { throw new HttpException('Unable to complete the HTTP request', 0, $exception); } // Casting the body (stream) to a string performs a rewind, ensuring we return the entire response. // See https://stackoverflow.com/a/30549372/86696 return new Response($response->getStatusCode(), (string)$response->getBody(), $response->getHeaders()); } } src/Twilio/Http/Client.php000064400000000514150515725670011465 0ustar00. */ /** * SplClassLoader implementation that implements the technical interoperability * standards for PHP 5.3 namespaces and class names. * * http://groups.google.com/group/php-standards/web/psr-0-final-proposal?pli=1 * * // Example which loads classes for the Doctrine Common package in the * // Doctrine\Common namespace. * $classLoader = new SplClassLoader('Doctrine\Common', '/path/to/doctrine'); * $classLoader->register(); * * @license http://www.opensource.org/licenses/mit-license.html MIT License * @author Jonathan H. Wage * @author Roman S. Borschel * @author Matthew Weier O'Phinney * @author Kris Wallsmith * @author Fabien Potencier */ class SplClassLoader { private $_fileExtension = '.php'; private $_namespace; private $_includePath; private $_namespaceSeparator = '\\'; /** * Creates a new SplClassLoader that loads classes of the * specified namespace. * * @param string $ns The namespace to use. * @param string $includePath The include path to search */ public function __construct($ns = null, $includePath = null) { $this->_namespace = $ns; $this->_includePath = $includePath; } /** * Sets the namespace separator used by classes in the namespace of this class loader. * * @param string $sep The separator to use. */ public function setNamespaceSeparator($sep): void { $this->_namespaceSeparator = $sep; } /** * Gets the namespace separator used by classes in the namespace of this class loader. * * @return string The separator to use. */ public function getNamespaceSeparator(): string { return $this->_namespaceSeparator; } /** * Sets the base include path for all class files in the namespace of this class loader. * * @param string $includePath */ public function setIncludePath($includePath): void { $this->_includePath = $includePath; } /** * Gets the base include path for all class files in the namespace of this class loader. * * @return string $includePath */ public function getIncludePath(): string { return $this->_includePath; } /** * Sets the file extension of class files in the namespace of this class loader. * * @param string $fileExtension */ public function setFileExtension($fileExtension): void { $this->_fileExtension = $fileExtension; } /** * Gets the file extension of class files in the namespace of this class loader. * * @return string $fileExtension */ public function getFileExtension(): string { return $this->_fileExtension; } /** * Installs this class loader on the SPL autoload stack. */ public function register(): void { \spl_autoload_register([$this, 'loadClass']); } /** * Uninstalls this class loader from the SPL autoloader stack. */ public function unregister(): void { \spl_autoload_unregister([$this, 'loadClass']); } /** * Loads the given class or interface. * * @param string $className The name of the class to load. * @return void */ public function loadClass($className): void { if (null === $this->_namespace || $this->_namespace . $this->_namespaceSeparator === \substr($className, 0, \strlen($this->_namespace . $this->_namespaceSeparator))) { $fileName = ''; $namespace = ''; if (false !== ($lastNsPos = \strripos($className, $this->_namespaceSeparator))) { $namespace = \substr($className, 0, $lastNsPos); $className = \substr($className, $lastNsPos + 1); $fileName = \str_replace($this->_namespaceSeparator, DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; } $fileName .= \str_replace('_', DIRECTORY_SEPARATOR, $className) . $this->_fileExtension; require ($this->_includePath !== null ? $this->_includePath . DIRECTORY_SEPARATOR : '') . $fileName; } } } $twilioClassLoader = new SplClassLoader('Twilio', \realpath(__DIR__ . DIRECTORY_SEPARATOR . '..')); $twilioClassLoader->register(); src/Twilio/Jwt/TaskRouter/WorkspaceCapability.php000064400000001013150515725670016132 0ustar00resourceUrl = $this->baseUrl; } } src/Twilio/Jwt/TaskRouter/WorkerCapability.php000064400000003470150515725670015456 0ustar00 * @license http://creativecommons.org/licenses/MIT/ MIT */ class WorkerCapability extends CapabilityToken { private $tasksUrl; private $workerReservationsUrl; private $activityUrl; public function __construct(string $accountSid, string $authToken, string $workspaceSid, string $workerSid, string $overrideBaseUrl = null, string $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(): void { $this->resourceUrl = $this->baseUrl . '/Workers/' . $this->channelId; } public function allowActivityUpdates(): void { $method = 'POST'; $queryFilter = []; $postFilter = ['ActivitySid' => $this->required]; $this->allow($this->resourceUrl, $method, $queryFilter, $postFilter); } public function allowReservationUpdates(): void { $method = 'POST'; $queryFilter = []; $postFilter = []; $this->allow($this->tasksUrl, $method, $queryFilter, $postFilter); $this->allow($this->workerReservationsUrl, $method, $queryFilter, $postFilter); } } src/Twilio/Jwt/TaskRouter/Policy.php000064400000003032150515725670013434 0ustar00 * @license http://creativecommons.org/licenses/MIT/ MIT */ class Policy { private $url; private $method; private $queryFilter; private $postFilter; private $allow; public function __construct(string $url, string $method, ?array $queryFilter = [], ?array $postFilter = [], bool $allow = true) { $this->url = $url; $this->method = $method; $this->queryFilter = $queryFilter; $this->postFilter = $postFilter; $this->allow = $allow; } public function addQueryFilter($queryFilter): void { $this->queryFilter[] = $queryFilter; } public function addPostFilter($postFilter): void { $this->postFilter[] = $postFilter; } public function toArray(): array { $policy_array = ['url' => $this->url, 'method' => $this->method, 'allow' => $this->allow]; if ($this->queryFilter !== null) { if (\count($this->queryFilter) > 0) { $policy_array['query_filter'] = $this->queryFilter; } else { $policy_array['query_filter'] = new \stdClass(); } } if ($this->postFilter !== null) { if (\count($this->postFilter) > 0) { $policy_array['post_filter'] = $this->postFilter; } else { $policy_array['post_filter'] = new \stdClass(); } } return $policy_array; } } src/Twilio/Jwt/TaskRouter/TaskQueueCapability.php000064400000001354150515725670016113 0ustar00 * @license http://creativecommons.org/licenses/MIT/ MIT */ class TaskQueueCapability extends CapabilityToken { public function __construct(string $accountSid, string $authToken, string $workspaceSid, string $taskQueueSid, string $overrideBaseUrl = null, string $overrideBaseWSUrl = null) { parent::__construct($accountSid, $authToken, $workspaceSid, $taskQueueSid, null, $overrideBaseUrl, $overrideBaseWSUrl); } protected function setupResource(): void { $this->resourceUrl = $this->baseUrl . '/TaskQueues/' . $this->channelId; } } src/Twilio/Jwt/TaskRouter/CapabilityToken.php000064400000013013150515725670015257 0ustar00 * @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 = ['required' => true]; protected $optional = ['required' => false]; public function __construct(string $accountSid, string $authToken, string $workspaceSid, string $channelId, string $resourceUrl = null, string $overrideBaseUrl = null, string $overrideBaseWSUrl = null) { $this->accountSid = $accountSid; $this->authToken = $authToken; $this->friendlyName = $channelId; $this->policies = []; $this->workspaceSid = $workspaceSid; $this->channelId = $channelId; if (isset($overrideBaseUrl)) { $this->baseUrl = $overrideBaseUrl; } if (isset($overrideBaseWSUrl)) { $this->baseWsUrl = $overrideBaseWSUrl; } $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(): void { } public function addPolicyDeconstructed(string $url, string $method, ?array $queryFilter = [], ?array $postFilter = [], bool $allow = true): Policy { $policy = new Policy($url, $method, $queryFilter, $postFilter, $allow); $this->policies[] = $policy; return $policy; } public function allow(string $url, string $method, ?array $queryFilter = [], ?array $postFilter = []): void { $this->addPolicyDeconstructed($url, $method, $queryFilter, $postFilter, true); } public function deny(string $url, string $method, array $queryFilter = [], array $postFilter = []): void { $this->addPolicyDeconstructed($url, $method, $queryFilter, $postFilter, false); } private function validateJWT(): void { if (!isset($this->accountSid) || \strpos($this->accountSid, 'AC') !== 0) { throw new \Exception('Invalid AccountSid provided: ' . $this->accountSid); } if (!isset($this->workspaceSid) || \strpos($this->workspaceSid, 'WS') !== 0) { 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(): void { $method = 'GET'; $queryFilter = []; $postFilter = []; $this->allow($this->resourceUrl . '/**', $method, $queryFilter, $postFilter); } public function allowUpdates(): void { $method = 'POST'; $queryFilter = []; $postFilter = []; $this->allow($this->resourceUrl, $method, $queryFilter, $postFilter); } public function allowUpdatesSubresources(): void { $method = 'POST'; $queryFilter = []; $postFilter = []; $this->allow($this->resourceUrl . '/**', $method, $queryFilter, $postFilter); } public function allowDelete(): void { $method = 'DELETE'; $queryFilter = []; $postFilter = []; $this->allow($this->resourceUrl, $method, $queryFilter, $postFilter); } public function allowDeleteSubresources(): void { $method = 'DELETE'; $queryFilter = []; $postFilter = []; $this->allow($this->resourceUrl . '/**', $method, $queryFilter, $postFilter); } public function generateToken(int $ttl = 3600, array $extraAttributes = []): string { $payload = [ '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 (\strpos($this->channelId, 'WK') === 0) { $payload['worker_sid'] = $this->channelId; } else if (\strpos($this->channelId, 'WQ') === 0) { $payload['taskqueue_sid'] = $this->channelId; } foreach ($extraAttributes as $key => $value) { $payload[$key] = $value; } $policyStrings = []; foreach ($this->policies as $policy) { $policyStrings[] = $policy->toArray(); } $payload['policies'] = $policyStrings; return JWT::encode($payload, $this->authToken, 'HS256'); } } src/Twilio/Jwt/Client/ScopeURI.php000064400000003251150515725670012744 0ustar00:? * * For example: * scope:client:incoming?name=jonas */ class ScopeURI { public $service; public $privilege; public $params; public function __construct(string $service, string $privilege, array $params = []) { $this->service = $service; $this->privilege = $privilege; $this->params = $params; } public function toString(): string { $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(string $uri): ScopeURI { 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'); } [$scheme, $service, $privilege] = $parts; return new ScopeURI($service, $privilege, $params); } } src/Twilio/Jwt/Grants/ChatGrant.php000064400000005766150515725670013223 0ustar00serviceSid; } /** * Set the service sid of this grant * * @param string $serviceSid service sid of the grant * * @return $this updated grant */ public function setServiceSid(string $serviceSid): self { $this->serviceSid = $serviceSid; return $this; } /** * Returns the endpoint id of the grant * * @return string the endpoint id */ public function getEndpointId(): string { 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(string $endpointId): self { $this->endpointId = $endpointId; return $this; } /** * Returns the deployment role sid of the grant * * @return string the deployment role sid */ public function getDeploymentRoleSid(): string { 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(string $deploymentRoleSid): self { $this->deploymentRoleSid = $deploymentRoleSid; return $this; } /** * Returns the push credential sid of the grant * * @return string the push credential sid */ public function getPushCredentialSid(): string { 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(string $pushCredentialSid): self { $this->pushCredentialSid = $pushCredentialSid; return $this; } /** * Returns the grant type * * @return string type of the grant */ public function getGrantKey(): string { return 'chat'; } /** * Returns the grant data * * @return array data of the grant */ public function getPayload(): array { $payload = []; 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; } } src/Twilio/Jwt/Grants/VideoGrant.php000064400000001753150515725670013402 0ustar00room; } /** * Set the room to allow access to in the grant * * @param string $roomSidOrName room sid or name * @return $this updated grant */ public function setRoom(string $roomSidOrName): self { $this->room = $roomSidOrName; return $this; } /** * Returns the grant type * * @return string type of the grant */ public function getGrantKey(): string { return 'video'; } /** * Returns the grant data * * @return array data of the grant */ public function getPayload(): array { $payload = []; if ($this->room) { $payload['room'] = $this->room; } return $payload; } } src/Twilio/Jwt/Grants/SyncGrant.php000064400000005771150515725670013254 0ustar00serviceSid; } /** * Set the service sid of this grant * * @param string $serviceSid service sid of the grant * * @return $this updated grant */ public function setServiceSid(string $serviceSid): self { $this->serviceSid = $serviceSid; return $this; } /** * Returns the endpoint id of the grant * * @return string the endpoint id */ public function getEndpointId(): string { 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(string $endpointId): self { $this->endpointId = $endpointId; return $this; } /** * Returns the deployment role sid of the grant * * @return string the deployment role sid */ public function getDeploymentRoleSid(): string { 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(string $deploymentRoleSid): self { $this->deploymentRoleSid = $deploymentRoleSid; return $this; } /** * Returns the push credential sid of the grant * * @return string the push credential sid */ public function getPushCredentialSid(): string { 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(string $pushCredentialSid): self { $this->pushCredentialSid = $pushCredentialSid; return $this; } /** * Returns the grant type * * @return string type of the grant */ public function getGrantKey(): string { return 'data_sync'; } /** * Returns the grant data * * @return array data of the grant */ public function getPayload(): array { $payload = []; 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; } } src/Twilio/Jwt/Grants/PlaybackGrant.php000064400000001756150515725670014065 0ustar00grant; } /** * Set the playback grant that will allow access to a stream * * @param array $grant playback grant from Twilio API * @return $this updated grant */ public function setGrant(array $grant): self { $this->grant = $grant; return $this; } /** * Returns the grant type * * @return string type of the grant */ public function getGrantKey(): string { return 'player'; } /** * Returns the grant data * * @return array data of the grant */ public function getPayload(): array { $payload = []; if ($this->grant) { $payload = $this->grant; } return $payload; } } src/Twilio/Jwt/Grants/TaskRouterGrant.php000064400000004164150515725670014436 0ustar00workspaceSid; } /** * Set the workspace sid of this grant * * @param string $workspaceSid workspace sid of the grant * * @return $this updated grant */ public function setWorkspaceSid(string $workspaceSid): self { $this->workspaceSid = $workspaceSid; return $this; } /** * Returns the worker sid * * @return string the worker sid */ public function getWorkerSid(): string { return $this->workerSid; } /** * Set the worker sid of this grant * * @param string $workerSid worker sid of the grant * * @return $this updated grant */ public function setWorkerSid(string $workerSid): self { $this->workerSid = $workerSid; return $this; } /** * Returns the role * * @return string the role */ public function getRole(): string { return $this->role; } /** * Set the role of this grant * * @param string $role role of the grant * * @return $this updated grant */ public function setRole(string $role): self { $this->role = $role; return $this; } /** * Returns the grant type * * @return string type of the grant */ public function getGrantKey(): string { return 'task_router'; } /** * Returns the grant data * * @return array data of the grant */ public function getPayload(): array { $payload = []; 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; } } src/Twilio/Jwt/Grants/VoiceGrant.php000064400000010004150515725670013366 0ustar00incomingAllow; } /** * Set whether incoming is allowed * * @param bool $incomingAllow whether incoming is allowed * * @return $this updated grant */ public function setIncomingAllow(bool $incomingAllow): self { $this->incomingAllow = $incomingAllow; return $this; } /** * Returns the outgoing application sid * * @return string the outgoing application sid */ public function getOutgoingApplicationSid(): string { 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(string $outgoingApplicationSid): self { $this->outgoingApplicationSid = $outgoingApplicationSid; return $this; } /** * Returns the outgoing application params * * @return array the outgoing application params */ public function getOutgoingApplicationParams(): array { return $this->outgoingApplicationParams; } /** * Set the outgoing application of the the grant * * @param string $sid outgoing application sid of the grant * @param array $params params to pass the the application * * @return $this updated grant */ public function setOutgoingApplication(string $sid, array $params): self { $this->outgoingApplicationSid = $sid; $this->outgoingApplicationParams = $params; return $this; } /** * Returns the push credential sid * * @return string the push credential sid */ public function getPushCredentialSid(): string { return $this->pushCredentialSid; } /** * Set the push credential sid * * @param string $pushCredentialSid * * @return $this updated grant */ public function setPushCredentialSid(string $pushCredentialSid): self { $this->pushCredentialSid = $pushCredentialSid; return $this; } /** * Returns the endpoint id * * @return string the endpoint id */ public function getEndpointId(): string { return $this->endpointId; } /** * Set the endpoint id * * @param string $endpointId endpoint id * * @return $this updated grant */ public function setEndpointId(string $endpointId): self { $this->endpointId = $endpointId; return $this; } /** * Returns the grant type * * @return string type of the grant */ public function getGrantKey(): string { return 'voice'; } /** * Returns the grant data * * @return array data of the grant */ public function getPayload(): array { $payload = []; if ($this->incomingAllow === true) { $incoming = []; $incoming['allow'] = true; $payload['incoming'] = $incoming; } if ($this->outgoingApplicationSid) { $outgoing = []; $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; } } src/Twilio/Jwt/Grants/Grant.php000064400000000511150515725670012402 0ustar00accountSid = $accountSid; $this->authToken = $authToken; $this->scopes = []; $this->clientName = false; $this->customClaims = []; } /** * 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 string $clientName * @throws \InvalidArgumentException */ public function allowClientIncoming(string $clientName): void { // 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 ($clientName === '') { throw new \InvalidArgumentException( 'Client name must not be a zero length string.'); } $this->clientName = $clientName; $this->allow('client', 'incoming', ['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(string $appSid, array $appParams = []): void { $this->allow('client', 'outgoing', [ '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 = []): void { $this->allow('stream', 'subscribe', [ 'path' => '/2010-04-01/Events', 'params' => \http_build_query($filters, '', '&'), ]); } /** * Allows to set custom claims, which then will be encoded into JWT payload. * * @param string $name * @param string $value */ public function addClaim(string $name, string $value): void { $this->customClaims[$name] = $value; } /** * 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 string the newly generated token that is valid for $ttl seconds */ public function generateToken(int $ttl = 3600): string { $payload = \array_merge($this->customClaims, [ 'scope' => [], 'iss' => $this->accountSid, 'exp' => \time() + $ttl, ]); $scopeStrings = []; 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(string $service, string $privilege, array $params): void { $this->scopes[] = new ScopeURI($service, $privilege, $params); } } src/Twilio/Jwt/JWT.php000064400000013601150515725670010541 0ustar00 */ 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(string $jwt, string $key = null, bool $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 (!hash_equals($sig, self::sign("$headb64.$payloadb64", $key, $header->alg))) { throw new \UnexpectedValueException('Signature verification failed'); } } return $payload; } /** * @param string $jwt The JWT * @return object The JWT's header as a PHP object * @throws \UnexpectedValueException */ public static function getHeader(string $jwt) { $tks = \explode('.', $jwt); if (\count($tks) !== 3) { throw new \UnexpectedValueException('Wrong number of segments'); } list($headb64) = $tks; if (null === ($header = self::jsonDecode(self::urlsafeB64Decode($headb64))) ) { throw new \UnexpectedValueException('Invalid segment encoding'); } return $header; } /** * @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, string $key, string $algo = 'HS256', array $additionalHeaders = []): string { $header = ['typ' => 'JWT', 'alg' => $algo]; $header += $additionalHeaders; $segments = []; $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(string $msg, string $key, string $method = 'HS256'): string { $methods = [ '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(string $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): string { $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(string $input): string { $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(string $input): string { return \str_replace('=', '', \strtr(\base64_encode($input), '+/', '-_')); } /** * @param int $errno An error number from json_last_error() * * @throws \DomainException */ private static function handleJsonError(int $errno): void { $messages = [ 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($messages[$errno] ?? 'Unknown JSON error: ' . $errno); } } src/Twilio/Jwt/AccessToken.php000064400000010005150515725670012272 0ustar00signingKeySid = $signingKeySid; $this->accountSid = $accountSid; $this->secret = $secret; $this->ttl = $ttl; $this->region = $region; if ($identity !== null) { $this->identity = $identity; } $this->grants = []; $this->customClaims = []; } /** * Set the identity of this access token * * @param string $identity identity of the grant * * @return $this updated access token */ public function setIdentity(string $identity): self { $this->identity = $identity; return $this; } /** * Returns the identity of the grant * * @return string the identity */ public function getIdentity(): string { return $this->identity; } /** * Set the nbf of this access token * * @param int $nbf nbf in epoch seconds of the grant * * @return $this updated access token */ public function setNbf(int $nbf): self { $this->nbf = $nbf; return $this; } /** * Returns the nbf of the grant * * @return int the nbf in epoch seconds */ public function getNbf(): int { return $this->nbf; } /** * Set the region of this access token * * @param string $region Home region of the account sid in this access token * * @return $this updated access token */ public function setRegion(string $region): self { $this->region = $region; return $this; } /** * Returns the region of this access token * * @return string Home region of the account sid in this access token */ public function getRegion(): string { return $this->region; } /** * Add a grant to the access token * * @param Grant $grant to be added * * @return $this the updated access token */ public function addGrant(Grant $grant): self { $this->grants[] = $grant; return $this; } /** * Allows to set custom claims, which then will be encoded into JWT payload. * * @param string $name * @param string $value */ public function addClaim(string $name, string $value): void { $this->customClaims[$name] = $value; } public function toJWT(string $algorithm = 'HS256'): string { $header = [ 'cty' => 'twilio-fpa;v=1', 'typ' => 'JWT' ]; if ($this->region) { $header['twr'] = $this->region; } $now = \time(); $grants = []; 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_merge($this->customClaims, [ 'jti' => $this->signingKeySid . '-' . $now, 'iss' => $this->signingKeySid, 'sub' => $this->accountSid, 'exp' => $now + $this->ttl, 'grants' => $grants ]); if ($this->nbf !== null) { $payload['nbf'] = $this->nbf; } return JWT::encode($payload, $this->secret, $algorithm, $header); } public function __toString(): string { return $this->toJWT(); } } src/Twilio/Rest/IpMessaging.php000064400000006425150515725670012462 0ustar00baseUrl = 'https://ip-messaging.twilio.com'; } /** * @return V1 Version v1 of ip_messaging */ protected function getV1(): V1 { if (!$this->_v1) { $this->_v1 = new V1($this); } return $this->_v1; } /** * @return V2 Version v2 of ip_messaging */ protected function getV2(): V2 { if (!$this->_v2) { $this->_v2 = new V2($this); } return $this->_v2; } /** * Magic getter to lazy load version * * @param string $name Version to return * @return \Twilio\Version The requested version * @throws TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } protected function getCredentials(): \Twilio\Rest\IpMessaging\V2\CredentialList { return $this->v2->credentials; } /** * @param string $sid The sid */ protected function contextCredentials(string $sid): \Twilio\Rest\IpMessaging\V2\CredentialContext { return $this->v2->credentials($sid); } protected function getServices(): \Twilio\Rest\IpMessaging\V2\ServiceList { return $this->v2->services; } /** * @param string $sid The sid */ protected function contextServices(string $sid): \Twilio\Rest\IpMessaging\V2\ServiceContext { return $this->v2->services($sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging]'; } }src/Twilio/Rest/Supersim.php000064400000013226150515725670012060 0ustar00baseUrl = 'https://supersim.twilio.com'; } /** * @return V1 Version v1 of supersim */ protected function getV1(): V1 { 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 TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } protected function getCommands(): \Twilio\Rest\Supersim\V1\CommandList { return $this->v1->commands; } /** * @param string $sid The SID that identifies the resource to fetch */ protected function contextCommands(string $sid): \Twilio\Rest\Supersim\V1\CommandContext { return $this->v1->commands($sid); } protected function getFleets(): \Twilio\Rest\Supersim\V1\FleetList { return $this->v1->fleets; } /** * @param string $sid The SID that identifies the resource to fetch */ protected function contextFleets(string $sid): \Twilio\Rest\Supersim\V1\FleetContext { return $this->v1->fleets($sid); } protected function getIpCommands(): \Twilio\Rest\Supersim\V1\IpCommandList { return $this->v1->ipCommands; } /** * @param string $sid The SID that identifies the resource to fetch */ protected function contextIpCommands(string $sid): \Twilio\Rest\Supersim\V1\IpCommandContext { return $this->v1->ipCommands($sid); } protected function getNetworks(): \Twilio\Rest\Supersim\V1\NetworkList { return $this->v1->networks; } /** * @param string $sid The SID of the Network resource to fetch */ protected function contextNetworks(string $sid): \Twilio\Rest\Supersim\V1\NetworkContext { return $this->v1->networks($sid); } protected function getNetworkAccessProfiles(): \Twilio\Rest\Supersim\V1\NetworkAccessProfileList { return $this->v1->networkAccessProfiles; } /** * @param string $sid The SID that identifies the resource to fetch */ protected function contextNetworkAccessProfiles(string $sid): \Twilio\Rest\Supersim\V1\NetworkAccessProfileContext { return $this->v1->networkAccessProfiles($sid); } protected function getSims(): \Twilio\Rest\Supersim\V1\SimList { return $this->v1->sims; } /** * @param string $sid The SID that identifies the resource to fetch */ protected function contextSims(string $sid): \Twilio\Rest\Supersim\V1\SimContext { return $this->v1->sims($sid); } protected function getSmsCommands(): \Twilio\Rest\Supersim\V1\SmsCommandList { return $this->v1->smsCommands; } /** * @param string $sid The SID that identifies the resource to fetch */ protected function contextSmsCommands(string $sid): \Twilio\Rest\Supersim\V1\SmsCommandContext { return $this->v1->smsCommands($sid); } protected function getUsageRecords(): \Twilio\Rest\Supersim\V1\UsageRecordList { return $this->v1->usageRecords; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Supersim]'; } }src/Twilio/Rest/Api/V2010.php000064400000024426150515725670011476 0ustar00version = '2010-04-01'; } protected function getAccounts(): AccountList { if (!$this->_accounts) { $this->_accounts = new AccountList($this); } return $this->_accounts; } /** * @return AccountContext Account provided as the authenticating account */ protected function getAccount(): AccountContext { 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): void { $this->_account = $account; } protected function getAddresses(): \Twilio\Rest\Api\V2010\Account\AddressList { return $this->account->addresses; } protected function getApplications(): \Twilio\Rest\Api\V2010\Account\ApplicationList { return $this->account->applications; } protected function getAuthorizedConnectApps(): \Twilio\Rest\Api\V2010\Account\AuthorizedConnectAppList { return $this->account->authorizedConnectApps; } protected function getAvailablePhoneNumbers(): \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountryList { return $this->account->availablePhoneNumbers; } protected function getBalance(): \Twilio\Rest\Api\V2010\Account\BalanceList { return $this->account->balance; } protected function getCalls(): \Twilio\Rest\Api\V2010\Account\CallList { return $this->account->calls; } protected function getConferences(): \Twilio\Rest\Api\V2010\Account\ConferenceList { return $this->account->conferences; } protected function getConnectApps(): \Twilio\Rest\Api\V2010\Account\ConnectAppList { return $this->account->connectApps; } protected function getIncomingPhoneNumbers(): \Twilio\Rest\Api\V2010\Account\IncomingPhoneNumberList { return $this->account->incomingPhoneNumbers; } protected function getKeys(): \Twilio\Rest\Api\V2010\Account\KeyList { return $this->account->keys; } protected function getMessages(): \Twilio\Rest\Api\V2010\Account\MessageList { return $this->account->messages; } protected function getNewKeys(): \Twilio\Rest\Api\V2010\Account\NewKeyList { return $this->account->newKeys; } protected function getNewSigningKeys(): \Twilio\Rest\Api\V2010\Account\NewSigningKeyList { return $this->account->newSigningKeys; } protected function getNotifications(): \Twilio\Rest\Api\V2010\Account\NotificationList { return $this->account->notifications; } protected function getOutgoingCallerIds(): \Twilio\Rest\Api\V2010\Account\OutgoingCallerIdList { return $this->account->outgoingCallerIds; } protected function getQueues(): \Twilio\Rest\Api\V2010\Account\QueueList { return $this->account->queues; } protected function getRecordings(): \Twilio\Rest\Api\V2010\Account\RecordingList { return $this->account->recordings; } protected function getSigningKeys(): \Twilio\Rest\Api\V2010\Account\SigningKeyList { return $this->account->signingKeys; } protected function getSip(): \Twilio\Rest\Api\V2010\Account\SipList { return $this->account->sip; } protected function getShortCodes(): \Twilio\Rest\Api\V2010\Account\ShortCodeList { return $this->account->shortCodes; } protected function getTokens(): \Twilio\Rest\Api\V2010\Account\TokenList { return $this->account->tokens; } protected function getTranscriptions(): \Twilio\Rest\Api\V2010\Account\TranscriptionList { return $this->account->transcriptions; } protected function getUsage(): \Twilio\Rest\Api\V2010\Account\UsageList { return $this->account->usage; } protected function getValidationRequests(): \Twilio\Rest\Api\V2010\Account\ValidationRequestList { return $this->account->validationRequests; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Api.V2010]'; } }src/Twilio/Rest/Api/V2010/Account/NewSigningKeyInstance.php000064400000004367150515725670017302 0ustar00properties = [ 'sid' => Values::array_get($payload, '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')), 'secret' => Values::array_get($payload, 'secret'), ]; $this->solution = ['accountSid' => $accountSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Api.V2010.NewSigningKeyInstance]'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountryContext.php000064400000015357150515725670022051 0ustar00solution = ['accountSid' => $accountSid, 'countryCode' => $countryCode, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/AvailablePhoneNumbers/' . \rawurlencode($countryCode) . '.json'; } /** * Fetch the AvailablePhoneNumberCountryInstance * * @return AvailablePhoneNumberCountryInstance Fetched * AvailablePhoneNumberCountryInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AvailablePhoneNumberCountryInstance { $payload = $this->version->fetch('GET', $this->uri); return new AvailablePhoneNumberCountryInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['countryCode'] ); } /** * Access the local */ protected function getLocal(): LocalList { if (!$this->_local) { $this->_local = new LocalList( $this->version, $this->solution['accountSid'], $this->solution['countryCode'] ); } return $this->_local; } /** * Access the tollFree */ protected function getTollFree(): TollFreeList { if (!$this->_tollFree) { $this->_tollFree = new TollFreeList( $this->version, $this->solution['accountSid'], $this->solution['countryCode'] ); } return $this->_tollFree; } /** * Access the mobile */ protected function getMobile(): MobileList { if (!$this->_mobile) { $this->_mobile = new MobileList( $this->version, $this->solution['accountSid'], $this->solution['countryCode'] ); } return $this->_mobile; } /** * Access the national */ protected function getNational(): NationalList { if (!$this->_national) { $this->_national = new NationalList( $this->version, $this->solution['accountSid'], $this->solution['countryCode'] ); } return $this->_national; } /** * Access the voip */ protected function getVoip(): VoipList { if (!$this->_voip) { $this->_voip = new VoipList( $this->version, $this->solution['accountSid'], $this->solution['countryCode'] ); } return $this->_voip; } /** * Access the sharedCost */ protected function getSharedCost(): SharedCostList { if (!$this->_sharedCost) { $this->_sharedCost = new SharedCostList( $this->version, $this->solution['accountSid'], $this->solution['countryCode'] ); } return $this->_sharedCost; } /** * Access the machineToMachine */ protected function getMachineToMachine(): MachineToMachineList { 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 ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.AvailablePhoneNumberCountryContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/ConnectAppPage.php000064400000002272150515725670015714 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ConnectAppInstance \Twilio\Rest\Api\V2010\Account\ConnectAppInstance */ public function buildInstance(array $payload): ConnectAppInstance { return new ConnectAppInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.ConnectAppPage]'; } }src/Twilio/Rest/Api/V2010/Account/NewKeyInstance.php000064400000004342150515725670015754 0ustar00properties = [ 'sid' => Values::array_get($payload, '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')), 'secret' => Values::array_get($payload, 'secret'), ]; $this->solution = ['accountSid' => $accountSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Api.V2010.NewKeyInstance]'; } }src/Twilio/Rest/Api/V2010/Account/SipPage.php000064400000002220150515725670014406 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SipInstance \Twilio\Rest\Api\V2010\Account\SipInstance */ public function buildInstance(array $payload): SipInstance { return new SipInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.SipPage]'; } }src/Twilio/Rest/Api/V2010/Account/NotificationPage.php000064400000002306150515725670016306 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return NotificationInstance \Twilio\Rest\Api\V2010\Account\NotificationInstance */ public function buildInstance(array $payload): NotificationInstance { return new NotificationInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.NotificationPage]'; } }src/Twilio/Rest/Api/V2010/Account/QueueList.php000064400000012640150515725670015005 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Queues.json'; } /** * Streams QueueInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads QueueInstance 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 QueueInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of QueueInstance 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 QueuePage Page of QueueInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): QueuePage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new QueuePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of QueueInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return QueuePage Page of QueueInstance */ public function getPage(string $targetUrl): QueuePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new QueuePage($this->version, $response, $this->solution); } /** * Create the QueueInstance * * @param string $friendlyName A string to describe this resource * @param array|Options $options Optional Arguments * @return QueueInstance Created QueueInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, array $options = []): QueueInstance { $options = new Values($options); $data = Values::of(['FriendlyName' => $friendlyName, 'MaxSize' => $options['maxSize'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new QueueInstance($this->version, $payload, $this->solution['accountSid']); } /** * Constructs a QueueContext * * @param string $sid The unique string that identifies this resource */ public function getContext(string $sid): QueueContext { return new QueueContext($this->version, $this->solution['accountSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.QueueList]'; } }src/Twilio/Rest/Api/V2010/Account/QueuePage.php000064400000002234150515725670014744 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return QueueInstance \Twilio\Rest\Api\V2010\Account\QueueInstance */ public function buildInstance(array $payload): QueueInstance { return new QueueInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.QueuePage]'; } }src/Twilio/Rest/Api/V2010/Account/TranscriptionList.php000064400000011517150515725670016562 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Transcriptions.json'; } /** * Streams TranscriptionInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads TranscriptionInstance 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 TranscriptionInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of TranscriptionInstance 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 TranscriptionPage Page of TranscriptionInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): TranscriptionPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new TranscriptionPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of TranscriptionInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return TranscriptionPage Page of TranscriptionInstance */ public function getPage(string $targetUrl): TranscriptionPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new TranscriptionPage($this->version, $response, $this->solution); } /** * Constructs a TranscriptionContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): TranscriptionContext { return new TranscriptionContext($this->version, $this->solution['accountSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.TranscriptionList]'; } }src/Twilio/Rest/Api/V2010/Account/NotificationContext.php000064400000003471150515725670017062 0ustar00solution = ['accountSid' => $accountSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Notifications/' . \rawurlencode($sid) . '.json'; } /** * Fetch the NotificationInstance * * @return NotificationInstance Fetched NotificationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): NotificationInstance { $payload = $this->version->fetch('GET', $this->uri); return new NotificationInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.NotificationContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/OutgoingCallerIdInstance.php000064400000010346150515725670017746 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), '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'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'phoneNumber' => Values::array_get($payload, 'phone_number'), 'uri' => Values::array_get($payload, 'uri'), ]; $this->solution = ['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 OutgoingCallerIdContext Context for this OutgoingCallerIdInstance */ protected function proxy(): OutgoingCallerIdContext { if (!$this->context) { $this->context = new OutgoingCallerIdContext( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the OutgoingCallerIdInstance * * @return OutgoingCallerIdInstance Fetched OutgoingCallerIdInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): OutgoingCallerIdInstance { return $this->proxy()->fetch(); } /** * Update the OutgoingCallerIdInstance * * @param array|Options $options Optional Arguments * @return OutgoingCallerIdInstance Updated OutgoingCallerIdInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): OutgoingCallerIdInstance { return $this->proxy()->update($options); } /** * Delete the OutgoingCallerIdInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.OutgoingCallerIdInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/NotificationInstance.php000064400000011106150515725670017174 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'apiVersion' => Values::array_get($payload, 'api_version'), 'callSid' => Values::array_get($payload, 'call_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'errorCode' => Values::array_get($payload, 'error_code'), 'log' => Values::array_get($payload, 'log'), 'messageDate' => Deserialize::dateTime(Values::array_get($payload, 'message_date')), 'messageText' => Values::array_get($payload, 'message_text'), 'moreInfo' => Values::array_get($payload, 'more_info'), 'requestMethod' => Values::array_get($payload, 'request_method'), 'requestUrl' => Values::array_get($payload, 'request_url'), 'requestVariables' => Values::array_get($payload, 'request_variables'), 'responseBody' => Values::array_get($payload, 'response_body'), 'responseHeaders' => Values::array_get($payload, 'response_headers'), 'sid' => Values::array_get($payload, 'sid'), 'uri' => Values::array_get($payload, 'uri'), ]; $this->solution = ['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 NotificationContext Context for this NotificationInstance */ protected function proxy(): NotificationContext { if (!$this->context) { $this->context = new NotificationContext( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the NotificationInstance * * @return NotificationInstance Fetched NotificationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): NotificationInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.NotificationInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/ApplicationPage.php000064400000002300150515725670016115 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ApplicationInstance \Twilio\Rest\Api\V2010\Account\ApplicationInstance */ public function buildInstance(array $payload): ApplicationInstance { return new ApplicationInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.ApplicationPage]'; } }src/Twilio/Rest/Api/V2010/Account/ShortCodeOptions.php000064400000016240150515725670016333 0ustar00options['friendlyName'] = $friendlyName; $this->options['apiVersion'] = $apiVersion; $this->options['smsUrl'] = $smsUrl; $this->options['smsMethod'] = $smsMethod; $this->options['smsFallbackUrl'] = $smsFallbackUrl; $this->options['smsFallbackMethod'] = $smsFallbackMethod; } /** * A descriptive string that you created to describe this resource. It can be up to 64 characters long. By default, the `FriendlyName` is the short code. * * @param string $friendlyName A string to describe this resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The API version to use to start a new TwiML session. Can be: `2010-04-01` or `2008-08-01`. * * @param string $apiVersion The API version to use to start a new TwiML session * @return $this Fluent Builder */ public function setApiVersion(string $apiVersion): self { $this->options['apiVersion'] = $apiVersion; return $this; } /** * The URL we should call when receiving an incoming SMS message to this short code. * * @param string $smsUrl URL Twilio will request when receiving an SMS * @return $this Fluent Builder */ public function setSmsUrl(string $smsUrl): self { $this->options['smsUrl'] = $smsUrl; return $this; } /** * The HTTP method we should use when calling the `sms_url`. Can be: `GET` or `POST`. * * @param string $smsMethod HTTP method to use when requesting the sms url * @return $this Fluent Builder */ public function setSmsMethod(string $smsMethod): self { $this->options['smsMethod'] = $smsMethod; return $this; } /** * The URL that we should call if an error occurs while retrieving or executing the TwiML from `sms_url`. * * @param string $smsFallbackUrl URL Twilio will request if an error occurs in * executing TwiML * @return $this Fluent Builder */ public function setSmsFallbackUrl(string $smsFallbackUrl): self { $this->options['smsFallbackUrl'] = $smsFallbackUrl; return $this; } /** * The HTTP method that we should use to call the `sms_fallback_url`. Can be: `GET` or `POST`. * * @param string $smsFallbackMethod HTTP method Twilio will use with * sms_fallback_url * @return $this Fluent Builder */ public function setSmsFallbackMethod(string $smsFallbackMethod): self { $this->options['smsFallbackMethod'] = $smsFallbackMethod; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.UpdateShortCodeOptions ' . $options . ']'; } } class ReadShortCodeOptions extends Options { /** * @param string $friendlyName The string that identifies the ShortCode * resources to read * @param string $shortCode Filter by ShortCode */ public function __construct(string $friendlyName = Values::NONE, string $shortCode = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['shortCode'] = $shortCode; } /** * The string that identifies the ShortCode resources to read. * * @param string $friendlyName The string that identifies the ShortCode * resources to read * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Only show the ShortCode resources that match this pattern. You can specify partial numbers and use '*' as a wildcard for any digit. * * @param string $shortCode Filter by ShortCode * @return $this Fluent Builder */ public function setShortCode(string $shortCode): self { $this->options['shortCode'] = $shortCode; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadShortCodeOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/Message/FeedbackOptions.php000064400000003205150515725670017506 0ustar00options['outcome'] = $outcome; } /** * Whether the feedback has arrived. Can be: `unconfirmed` or `confirmed`. If `provide_feedback`=`true` in [the initial HTTP POST](https://www.twilio.com/docs/sms/api/message-resource#create-a-message-resource), the initial value of this property is `unconfirmed`. After the message arrives, update the value to `confirmed`. * * @param string $outcome Whether the feedback has arrived * @return $this Fluent Builder */ public function setOutcome(string $outcome): self { $this->options['outcome'] = $outcome; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.CreateFeedbackOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/Message/FeedbackList.php000064400000003625150515725670016774 0ustar00solution = ['accountSid' => $accountSid, 'messageSid' => $messageSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Messages/' . \rawurlencode($messageSid) . '/Feedback.json'; } /** * Create the FeedbackInstance * * @param array|Options $options Optional Arguments * @return FeedbackInstance Created FeedbackInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): FeedbackInstance { $options = new Values($options); $data = Values::of(['Outcome' => $options['outcome'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new FeedbackInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['messageSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.FeedbackList]'; } }src/Twilio/Rest/Api/V2010/Account/Message/MediaContext.php000064400000004443150515725670017037 0ustar00solution = ['accountSid' => $accountSid, 'messageSid' => $messageSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Messages/' . \rawurlencode($messageSid) . '/Media/' . \rawurlencode($sid) . '.json'; } /** * Delete the MediaInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Fetch the MediaInstance * * @return MediaInstance Fetched MediaInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MediaInstance { $payload = $this->version->fetch('GET', $this->uri); return new MediaInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['messageSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.MediaContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Message/FeedbackInstance.php000064400000004736150515725670017631 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'messageSid' => Values::array_get($payload, 'message_sid'), 'outcome' => Values::array_get($payload, 'outcome'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'uri' => Values::array_get($payload, 'uri'), ]; $this->solution = ['accountSid' => $accountSid, 'messageSid' => $messageSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Api.V2010.FeedbackInstance]'; } }src/Twilio/Rest/Api/V2010/Account/Message/MediaList.php000064400000013075150515725670016327 0ustar00solution = ['accountSid' => $accountSid, 'messageSid' => $messageSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Messages/' . \rawurlencode($messageSid) . '/Media.json'; } /** * Streams MediaInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads MediaInstance 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 MediaInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of MediaInstance 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 MediaPage Page of MediaInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): MediaPage { $options = new Values($options); $params = Values::of([ 'DateCreated<' => Serialize::iso8601DateTime($options['dateCreatedBefore']), 'DateCreated' => Serialize::iso8601DateTime($options['dateCreated']), 'DateCreated>' => Serialize::iso8601DateTime($options['dateCreatedAfter']), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new MediaPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of MediaInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return MediaPage Page of MediaInstance */ public function getPage(string $targetUrl): MediaPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new MediaPage($this->version, $response, $this->solution); } /** * Constructs a MediaContext * * @param string $sid The unique string that identifies this resource */ public function getContext(string $sid): MediaContext { return new MediaContext( $this->version, $this->solution['accountSid'], $this->solution['messageSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.MediaList]'; } }src/Twilio/Rest/Api/V2010/Account/Message/FeedbackPage.php000064400000002427150515725670016734 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return FeedbackInstance \Twilio\Rest\Api\V2010\Account\Message\FeedbackInstance */ public function buildInstance(array $payload): FeedbackInstance { return new FeedbackInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['messageSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.FeedbackPage]'; } }src/Twilio/Rest/Api/V2010/Account/Message/MediaOptions.php000064400000010077150515725670017046 0ustar00options['dateCreatedBefore'] = $dateCreatedBefore; $this->options['dateCreated'] = $dateCreated; $this->options['dateCreatedAfter'] = $dateCreatedAfter; } /** * Only include media that was created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read media that was created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read media that was created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read media that was created on or after midnight of this date. * * @param string $dateCreatedBefore Only include media that was created on this * date * @return $this Fluent Builder */ public function setDateCreatedBefore(string $dateCreatedBefore): self { $this->options['dateCreatedBefore'] = $dateCreatedBefore; return $this; } /** * Only include media that was created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read media that was created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read media that was created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read media that was created on or after midnight of this date. * * @param string $dateCreated Only include media that was created on this date * @return $this Fluent Builder */ public function setDateCreated(string $dateCreated): self { $this->options['dateCreated'] = $dateCreated; return $this; } /** * Only include media that was created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read media that was created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read media that was created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read media that was created on or after midnight of this date. * * @param string $dateCreatedAfter Only include media that was created on this * date * @return $this Fluent Builder */ public function setDateCreatedAfter(string $dateCreatedAfter): self { $this->options['dateCreatedAfter'] = $dateCreatedAfter; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadMediaOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/Message/MediaInstance.php000064400000007653150515725670017165 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'contentType' => Values::array_get($payload, 'content_type'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'parentSid' => Values::array_get($payload, 'parent_sid'), 'sid' => Values::array_get($payload, 'sid'), 'uri' => Values::array_get($payload, 'uri'), ]; $this->solution = [ 'accountSid' => $accountSid, 'messageSid' => $messageSid, '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 MediaContext Context for this MediaInstance */ protected function proxy(): MediaContext { if (!$this->context) { $this->context = new MediaContext( $this->version, $this->solution['accountSid'], $this->solution['messageSid'], $this->solution['sid'] ); } return $this->context; } /** * Delete the MediaInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Fetch the MediaInstance * * @return MediaInstance Fetched MediaInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MediaInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.MediaInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Message/MediaPage.php000064400000002405150515725670016263 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return MediaInstance \Twilio\Rest\Api\V2010\Account\Message\MediaInstance */ public function buildInstance(array $payload): MediaInstance { return new MediaInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['messageSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.MediaPage]'; } }src/Twilio/Rest/Api/V2010/Account/SigningKeyOptions.php000064400000002550150515725670016507 0ustar00options['friendlyName'] = $friendlyName; } /** * The friendly_name * * @param string $friendlyName The friendly_name * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.UpdateSigningKeyOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/ConnectAppList.php000064400000011423150515725670015751 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/ConnectApps.json'; } /** * Streams ConnectAppInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ConnectAppInstance 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 ConnectAppInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of ConnectAppInstance 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 ConnectAppPage Page of ConnectAppInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ConnectAppPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ConnectAppPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ConnectAppInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ConnectAppPage Page of ConnectAppInstance */ public function getPage(string $targetUrl): ConnectAppPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ConnectAppPage($this->version, $response, $this->solution); } /** * Constructs a ConnectAppContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): ConnectAppContext { return new ConnectAppContext($this->version, $this->solution['accountSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.ConnectAppList]'; } }src/Twilio/Rest/Api/V2010/Account/SigningKeyList.php000064400000011432150515725670015766 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/SigningKeys.json'; } /** * Streams SigningKeyInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads SigningKeyInstance 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 SigningKeyInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of SigningKeyInstance 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 SigningKeyPage Page of SigningKeyInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SigningKeyPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new SigningKeyPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of SigningKeyInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return SigningKeyPage Page of SigningKeyInstance */ public function getPage(string $targetUrl): SigningKeyPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new SigningKeyPage($this->version, $response, $this->solution); } /** * Constructs a SigningKeyContext * * @param string $sid The sid */ public function getContext(string $sid): SigningKeyContext { return new SigningKeyContext($this->version, $this->solution['accountSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.SigningKeyList]'; } }src/Twilio/Rest/Api/V2010/Account/BalanceList.php000064400000002511150515725670015242 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Balance.json'; } /** * Fetch the BalanceInstance * * @return BalanceInstance Fetched BalanceInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): BalanceInstance { $payload = $this->version->fetch('GET', $this->uri); return new BalanceInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.BalanceList]'; } }src/Twilio/Rest/Api/V2010/Account/ShortCodeInstance.php000064400000010607150515725670016445 0ustar00properties = [ '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'), 'shortCode' => Values::array_get($payload, 'short_code'), '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'), 'smsUrl' => Values::array_get($payload, 'sms_url'), 'uri' => Values::array_get($payload, 'uri'), ]; $this->solution = ['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 ShortCodeContext Context for this ShortCodeInstance */ protected function proxy(): ShortCodeContext { if (!$this->context) { $this->context = new ShortCodeContext( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the ShortCodeInstance * * @return ShortCodeInstance Fetched ShortCodeInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ShortCodeInstance { return $this->proxy()->fetch(); } /** * Update the ShortCodeInstance * * @param array|Options $options Optional Arguments * @return ShortCodeInstance Updated ShortCodeInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ShortCodeInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.ShortCodeInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/ConferenceInstance.php000064400000011657150515725670016630 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'apiVersion' => Values::array_get($payload, 'api_version'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'region' => Values::array_get($payload, 'region'), 'sid' => Values::array_get($payload, 'sid'), 'status' => Values::array_get($payload, 'status'), 'uri' => Values::array_get($payload, 'uri'), 'subresourceUris' => Values::array_get($payload, 'subresource_uris'), 'reasonConferenceEnded' => Values::array_get($payload, 'reason_conference_ended'), 'callSidEndingConference' => Values::array_get($payload, 'call_sid_ending_conference'), ]; $this->solution = ['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 ConferenceContext Context for this ConferenceInstance */ protected function proxy(): ConferenceContext { if (!$this->context) { $this->context = new ConferenceContext( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the ConferenceInstance * * @return ConferenceInstance Fetched ConferenceInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ConferenceInstance { return $this->proxy()->fetch(); } /** * Update the ConferenceInstance * * @param array|Options $options Optional Arguments * @return ConferenceInstance Updated ConferenceInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ConferenceInstance { return $this->proxy()->update($options); } /** * Access the participants */ protected function getParticipants(): ParticipantList { return $this->proxy()->participants; } /** * Access the recordings */ protected function getRecordings(): RecordingList { return $this->proxy()->recordings; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.ConferenceInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumberOptions.php000064400000131773150515725670020360 0ustar00options['accountSid'] = $accountSid; $this->options['apiVersion'] = $apiVersion; $this->options['friendlyName'] = $friendlyName; $this->options['smsApplicationSid'] = $smsApplicationSid; $this->options['smsFallbackMethod'] = $smsFallbackMethod; $this->options['smsFallbackUrl'] = $smsFallbackUrl; $this->options['smsMethod'] = $smsMethod; $this->options['smsUrl'] = $smsUrl; $this->options['statusCallback'] = $statusCallback; $this->options['statusCallbackMethod'] = $statusCallbackMethod; $this->options['voiceApplicationSid'] = $voiceApplicationSid; $this->options['voiceCallerIdLookup'] = $voiceCallerIdLookup; $this->options['voiceFallbackMethod'] = $voiceFallbackMethod; $this->options['voiceFallbackUrl'] = $voiceFallbackUrl; $this->options['voiceMethod'] = $voiceMethod; $this->options['voiceUrl'] = $voiceUrl; $this->options['emergencyStatus'] = $emergencyStatus; $this->options['emergencyAddressSid'] = $emergencyAddressSid; $this->options['trunkSid'] = $trunkSid; $this->options['voiceReceiveMode'] = $voiceReceiveMode; $this->options['identitySid'] = $identitySid; $this->options['addressSid'] = $addressSid; $this->options['bundleSid'] = $bundleSid; } /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IncomingPhoneNumber resource to update. For more information, see [Exchanging Numbers Between Subaccounts](https://www.twilio.com/docs/iam/api/subaccounts#exchanging-numbers). * * @param string $accountSid The SID of the Account that created the resource * to update * @return $this Fluent Builder */ public function setAccountSid(string $accountSid): self { $this->options['accountSid'] = $accountSid; return $this; } /** * The API version to use for incoming calls made to the phone number. The default is `2010-04-01`. * * @param string $apiVersion The API version to use for incoming calls made to * the phone number * @return $this Fluent Builder */ public function setApiVersion(string $apiVersion): self { $this->options['apiVersion'] = $apiVersion; return $this; } /** * A descriptive string that you created to describe this phone number. It can be up to 64 characters long. By default, this is a formatted version of the phone number. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The SID of the application that should handle SMS messages sent to the number. If an `sms_application_sid` is present, we ignore all of the `sms_*_url` urls and use those set on the application. * * @param string $smsApplicationSid Unique string that identifies the * application * @return $this Fluent Builder */ public function setSmsApplicationSid(string $smsApplicationSid): self { $this->options['smsApplicationSid'] = $smsApplicationSid; return $this; } /** * The HTTP method that we should use to call `sms_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $smsFallbackMethod HTTP method used with sms_fallback_url * @return $this Fluent Builder */ public function setSmsFallbackMethod(string $smsFallbackMethod): self { $this->options['smsFallbackMethod'] = $smsFallbackMethod; return $this; } /** * The URL that we should call when an error occurs while requesting or executing the TwiML defined by `sms_url`. * * @param string $smsFallbackUrl The URL we call when an error occurs while * executing TwiML * @return $this Fluent Builder */ public function setSmsFallbackUrl(string $smsFallbackUrl): self { $this->options['smsFallbackUrl'] = $smsFallbackUrl; return $this; } /** * The HTTP method that we should use to call `sms_url`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $smsMethod The HTTP method to use with sms_url * @return $this Fluent Builder */ public function setSmsMethod(string $smsMethod): self { $this->options['smsMethod'] = $smsMethod; return $this; } /** * The URL we should call when the phone number receives an incoming SMS message. * * @param string $smsUrl The URL we should call when the phone number receives * an incoming SMS message * @return $this Fluent Builder */ public function setSmsUrl(string $smsUrl): self { $this->options['smsUrl'] = $smsUrl; return $this; } /** * The URL we should call using the `status_callback_method` to send status information to your application. * * @param string $statusCallback The URL we should call to send status * information to your application * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $statusCallbackMethod The HTTP method we should use to call * status_callback * @return $this Fluent Builder */ public function setStatusCallbackMethod(string $statusCallbackMethod): self { $this->options['statusCallbackMethod'] = $statusCallbackMethod; return $this; } /** * The SID of the application we should use to handle phone calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use only those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. * * @param string $voiceApplicationSid The SID of the application to handle the * phone number * @return $this Fluent Builder */ public function setVoiceApplicationSid(string $voiceApplicationSid): self { $this->options['voiceApplicationSid'] = $voiceApplicationSid; return $this; } /** * Whether to lookup the caller's name from the CNAM database and post it to your app. Can be: `true` or `false` and defaults to `false`. * * @param bool $voiceCallerIdLookup Whether to lookup the caller's name * @return $this Fluent Builder */ public function setVoiceCallerIdLookup(bool $voiceCallerIdLookup): self { $this->options['voiceCallerIdLookup'] = $voiceCallerIdLookup; return $this; } /** * The HTTP method that we should use to call `voice_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $voiceFallbackMethod The HTTP method used with fallback_url * @return $this Fluent Builder */ public function setVoiceFallbackMethod(string $voiceFallbackMethod): self { $this->options['voiceFallbackMethod'] = $voiceFallbackMethod; return $this; } /** * The URL that we should call when an error occurs retrieving or executing the TwiML requested by `url`. * * @param string $voiceFallbackUrl The URL we will call when an error occurs in * TwiML * @return $this Fluent Builder */ public function setVoiceFallbackUrl(string $voiceFallbackUrl): self { $this->options['voiceFallbackUrl'] = $voiceFallbackUrl; return $this; } /** * The HTTP method that we should use to call `voice_url`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $voiceMethod The HTTP method used with the voice_url * @return $this Fluent Builder */ public function setVoiceMethod(string $voiceMethod): self { $this->options['voiceMethod'] = $voiceMethod; return $this; } /** * The URL that we should call to answer a call to the phone number. The `voice_url` will not be called if a `voice_application_sid` or a `trunk_sid` is set. * * @param string $voiceUrl The URL we should call when the phone number * receives a call * @return $this Fluent Builder */ public function setVoiceUrl(string $voiceUrl): self { $this->options['voiceUrl'] = $voiceUrl; return $this; } /** * The parameter displays if emergency calling is enabled for this number. Active numbers may place emergency calls by dialing valid emergency numbers for the country. * * @param string $emergencyStatus Displays if emergency calling is enabled for * this number. * @return $this Fluent Builder */ public function setEmergencyStatus(string $emergencyStatus): self { $this->options['emergencyStatus'] = $emergencyStatus; return $this; } /** * The SID of the emergency address configuration to use for emergency calling from this phone number. * * @param string $emergencyAddressSid The emergency address configuration to * use for emergency calling * @return $this Fluent Builder */ public function setEmergencyAddressSid(string $emergencyAddressSid): self { $this->options['emergencyAddressSid'] = $emergencyAddressSid; return $this; } /** * The SID of the Trunk we should use to handle phone calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use only those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. * * @param string $trunkSid SID of the trunk to handle phone calls to the phone * number * @return $this Fluent Builder */ public function setTrunkSid(string $trunkSid): self { $this->options['trunkSid'] = $trunkSid; return $this; } /** * The configuration parameter for the phone number to receive incoming voice calls or faxes. Can be: `fax` or `voice` and defaults to `voice`. * * @param string $voiceReceiveMode Incoming call type: fax or voice * @return $this Fluent Builder */ public function setVoiceReceiveMode(string $voiceReceiveMode): self { $this->options['voiceReceiveMode'] = $voiceReceiveMode; return $this; } /** * The SID of the Identity resource that we should associate with the phone number. Some regions require an identity to meet local regulations. * * @param string $identitySid Unique string that identifies the identity * associated with number * @return $this Fluent Builder */ public function setIdentitySid(string $identitySid): self { $this->options['identitySid'] = $identitySid; return $this; } /** * The SID of the Address resource we should associate with the phone number. Some regions require addresses to meet local regulations. * * @param string $addressSid The SID of the Address resource associated with * the phone number * @return $this Fluent Builder */ public function setAddressSid(string $addressSid): self { $this->options['addressSid'] = $addressSid; return $this; } /** * The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. * * @param string $bundleSid The SID of the Bundle resource associated with * number * @return $this Fluent Builder */ public function setBundleSid(string $bundleSid): self { $this->options['bundleSid'] = $bundleSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.UpdateIncomingPhoneNumberOptions ' . $options . ']'; } } class ReadIncomingPhoneNumberOptions extends Options { /** * @param bool $beta Whether to include new phone numbers * @param string $friendlyName A string that identifies the IncomingPhoneNumber * resources to read * @param string $phoneNumber The phone numbers of the IncomingPhoneNumber * resources to read * @param string $origin Include phone numbers based on their origin. By * default, phone numbers of all origin are included. */ public function __construct(bool $beta = Values::NONE, string $friendlyName = Values::NONE, string $phoneNumber = Values::NONE, string $origin = Values::NONE) { $this->options['beta'] = $beta; $this->options['friendlyName'] = $friendlyName; $this->options['phoneNumber'] = $phoneNumber; $this->options['origin'] = $origin; } /** * Whether to include phone numbers new to the Twilio platform. Can be: `true` or `false` and the default is `true`. * * @param bool $beta Whether to include new phone numbers * @return $this Fluent Builder */ public function setBeta(bool $beta): self { $this->options['beta'] = $beta; return $this; } /** * A string that identifies the IncomingPhoneNumber resources to read. * * @param string $friendlyName A string that identifies the IncomingPhoneNumber * resources to read * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The phone numbers of the IncomingPhoneNumber resources to read. You can specify partial numbers and use '*' as a wildcard for any digit. * * @param string $phoneNumber The phone numbers of the IncomingPhoneNumber * resources to read * @return $this Fluent Builder */ public function setPhoneNumber(string $phoneNumber): self { $this->options['phoneNumber'] = $phoneNumber; return $this; } /** * Whether to include phone numbers based on their origin. Can be: `twilio` or `hosted`. By default, phone numbers of all origin are included. * * @param string $origin Include phone numbers based on their origin. By * default, phone numbers of all origin are included. * @return $this Fluent Builder */ public function setOrigin(string $origin): self { $this->options['origin'] = $origin; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadIncomingPhoneNumberOptions ' . $options . ']'; } } class CreateIncomingPhoneNumberOptions extends Options { /** * @param string $phoneNumber The phone number to purchase in E.164 format * @param string $areaCode The desired area code for the new phone number * @param string $apiVersion The API version to use for incoming calls made to * the new phone number * @param string $friendlyName A string to describe the new phone number * @param string $smsApplicationSid The SID of the application to handle SMS * messages * @param string $smsFallbackMethod HTTP method used with sms_fallback_url * @param string $smsFallbackUrl The URL we call when an error occurs while * executing TwiML * @param string $smsMethod The HTTP method to use with sms url * @param string $smsUrl The URL we should call when the new phone number * receives an incoming SMS message * @param string $statusCallback The URL we should call to send status * information to your application * @param string $statusCallbackMethod HTTP method we should use to call * status_callback * @param string $voiceApplicationSid The SID of the application to handle the * new phone number * @param bool $voiceCallerIdLookup Whether to lookup the caller's name * @param string $voiceFallbackMethod The HTTP method used with * voice_fallback_url * @param string $voiceFallbackUrl The URL we will call when an error occurs in * TwiML * @param string $voiceMethod The HTTP method used with the voice_url * @param string $voiceUrl The URL we should call when the phone number * receives a call * @param string $emergencyStatus Displays if emergency calling is enabled for * this number. * @param string $emergencyAddressSid The emergency address configuration to * use for emergency calling * @param string $trunkSid SID of the trunk to handle calls to the new phone * number * @param string $identitySid The SID of the Identity resource to associate * with the new phone number * @param string $addressSid The SID of the Address resource associated with * the phone number * @param string $voiceReceiveMode Incoming call type: fax or voice * @param string $bundleSid The SID of the Bundle resource associated with * number */ public function __construct(string $phoneNumber = Values::NONE, string $areaCode = Values::NONE, string $apiVersion = Values::NONE, string $friendlyName = Values::NONE, string $smsApplicationSid = Values::NONE, string $smsFallbackMethod = Values::NONE, string $smsFallbackUrl = Values::NONE, string $smsMethod = Values::NONE, string $smsUrl = Values::NONE, string $statusCallback = Values::NONE, string $statusCallbackMethod = Values::NONE, string $voiceApplicationSid = Values::NONE, bool $voiceCallerIdLookup = Values::NONE, string $voiceFallbackMethod = Values::NONE, string $voiceFallbackUrl = Values::NONE, string $voiceMethod = Values::NONE, string $voiceUrl = Values::NONE, string $emergencyStatus = Values::NONE, string $emergencyAddressSid = Values::NONE, string $trunkSid = Values::NONE, string $identitySid = Values::NONE, string $addressSid = Values::NONE, string $voiceReceiveMode = Values::NONE, string $bundleSid = Values::NONE) { $this->options['phoneNumber'] = $phoneNumber; $this->options['areaCode'] = $areaCode; $this->options['apiVersion'] = $apiVersion; $this->options['friendlyName'] = $friendlyName; $this->options['smsApplicationSid'] = $smsApplicationSid; $this->options['smsFallbackMethod'] = $smsFallbackMethod; $this->options['smsFallbackUrl'] = $smsFallbackUrl; $this->options['smsMethod'] = $smsMethod; $this->options['smsUrl'] = $smsUrl; $this->options['statusCallback'] = $statusCallback; $this->options['statusCallbackMethod'] = $statusCallbackMethod; $this->options['voiceApplicationSid'] = $voiceApplicationSid; $this->options['voiceCallerIdLookup'] = $voiceCallerIdLookup; $this->options['voiceFallbackMethod'] = $voiceFallbackMethod; $this->options['voiceFallbackUrl'] = $voiceFallbackUrl; $this->options['voiceMethod'] = $voiceMethod; $this->options['voiceUrl'] = $voiceUrl; $this->options['emergencyStatus'] = $emergencyStatus; $this->options['emergencyAddressSid'] = $emergencyAddressSid; $this->options['trunkSid'] = $trunkSid; $this->options['identitySid'] = $identitySid; $this->options['addressSid'] = $addressSid; $this->options['voiceReceiveMode'] = $voiceReceiveMode; $this->options['bundleSid'] = $bundleSid; } /** * The phone number to purchase specified in [E.164](https://www.twilio.com/docs/glossary/what-e164) format. E.164 phone numbers consist of a + followed by the country code and subscriber number without punctuation characters. For example, +14155551234. * * @param string $phoneNumber The phone number to purchase in E.164 format * @return $this Fluent Builder */ public function setPhoneNumber(string $phoneNumber): self { $this->options['phoneNumber'] = $phoneNumber; return $this; } /** * The desired area code for your new incoming phone number. Can be any three-digit, US or Canada area code. We will provision an available phone number within this area code for you. **You must provide an `area_code` or a `phone_number`.** (US and Canada only). * * @param string $areaCode The desired area code for the new phone number * @return $this Fluent Builder */ public function setAreaCode(string $areaCode): self { $this->options['areaCode'] = $areaCode; return $this; } /** * The API version to use for incoming calls made to the new phone number. The default is `2010-04-01`. * * @param string $apiVersion The API version to use for incoming calls made to * the new phone number * @return $this Fluent Builder */ public function setApiVersion(string $apiVersion): self { $this->options['apiVersion'] = $apiVersion; return $this; } /** * A descriptive string that you created to describe the new phone number. It can be up to 64 characters long. By default, this is a formatted version of the new phone number. * * @param string $friendlyName A string to describe the new phone number * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The SID of the application that should handle SMS messages sent to the new phone number. If an `sms_application_sid` is present, we ignore all of the `sms_*_url` urls and use those set on the application. * * @param string $smsApplicationSid The SID of the application to handle SMS * messages * @return $this Fluent Builder */ public function setSmsApplicationSid(string $smsApplicationSid): self { $this->options['smsApplicationSid'] = $smsApplicationSid; return $this; } /** * The HTTP method that we should use to call `sms_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $smsFallbackMethod HTTP method used with sms_fallback_url * @return $this Fluent Builder */ public function setSmsFallbackMethod(string $smsFallbackMethod): self { $this->options['smsFallbackMethod'] = $smsFallbackMethod; return $this; } /** * The URL that we should call when an error occurs while requesting or executing the TwiML defined by `sms_url`. * * @param string $smsFallbackUrl The URL we call when an error occurs while * executing TwiML * @return $this Fluent Builder */ public function setSmsFallbackUrl(string $smsFallbackUrl): self { $this->options['smsFallbackUrl'] = $smsFallbackUrl; return $this; } /** * The HTTP method that we should use to call `sms_url`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $smsMethod The HTTP method to use with sms url * @return $this Fluent Builder */ public function setSmsMethod(string $smsMethod): self { $this->options['smsMethod'] = $smsMethod; return $this; } /** * The URL we should call when the new phone number receives an incoming SMS message. * * @param string $smsUrl The URL we should call when the new phone number * receives an incoming SMS message * @return $this Fluent Builder */ public function setSmsUrl(string $smsUrl): self { $this->options['smsUrl'] = $smsUrl; return $this; } /** * The URL we should call using the `status_callback_method` to send status information to your application. * * @param string $statusCallback The URL we should call to send status * information to your application * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $statusCallbackMethod HTTP method we should use to call * status_callback * @return $this Fluent Builder */ public function setStatusCallbackMethod(string $statusCallbackMethod): self { $this->options['statusCallbackMethod'] = $statusCallbackMethod; return $this; } /** * The SID of the application we should use to handle calls to the new phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use only those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. * * @param string $voiceApplicationSid The SID of the application to handle the * new phone number * @return $this Fluent Builder */ public function setVoiceApplicationSid(string $voiceApplicationSid): self { $this->options['voiceApplicationSid'] = $voiceApplicationSid; return $this; } /** * Whether to lookup the caller's name from the CNAM database and post it to your app. Can be: `true` or `false` and defaults to `false`. * * @param bool $voiceCallerIdLookup Whether to lookup the caller's name * @return $this Fluent Builder */ public function setVoiceCallerIdLookup(bool $voiceCallerIdLookup): self { $this->options['voiceCallerIdLookup'] = $voiceCallerIdLookup; return $this; } /** * The HTTP method that we should use to call `voice_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $voiceFallbackMethod The HTTP method used with * voice_fallback_url * @return $this Fluent Builder */ public function setVoiceFallbackMethod(string $voiceFallbackMethod): self { $this->options['voiceFallbackMethod'] = $voiceFallbackMethod; return $this; } /** * The URL that we should call when an error occurs retrieving or executing the TwiML requested by `url`. * * @param string $voiceFallbackUrl The URL we will call when an error occurs in * TwiML * @return $this Fluent Builder */ public function setVoiceFallbackUrl(string $voiceFallbackUrl): self { $this->options['voiceFallbackUrl'] = $voiceFallbackUrl; return $this; } /** * The HTTP method that we should use to call `voice_url`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $voiceMethod The HTTP method used with the voice_url * @return $this Fluent Builder */ public function setVoiceMethod(string $voiceMethod): self { $this->options['voiceMethod'] = $voiceMethod; return $this; } /** * The URL that we should call to answer a call to the new phone number. The `voice_url` will not be called if a `voice_application_sid` or a `trunk_sid` is set. * * @param string $voiceUrl The URL we should call when the phone number * receives a call * @return $this Fluent Builder */ public function setVoiceUrl(string $voiceUrl): self { $this->options['voiceUrl'] = $voiceUrl; return $this; } /** * The parameter displays if emergency calling is enabled for this number. Active numbers may place emergency calls by dialing valid emergency numbers for the country. * * @param string $emergencyStatus Displays if emergency calling is enabled for * this number. * @return $this Fluent Builder */ public function setEmergencyStatus(string $emergencyStatus): self { $this->options['emergencyStatus'] = $emergencyStatus; return $this; } /** * The SID of the emergency address configuration to use for emergency calling from the new phone number. * * @param string $emergencyAddressSid The emergency address configuration to * use for emergency calling * @return $this Fluent Builder */ public function setEmergencyAddressSid(string $emergencyAddressSid): self { $this->options['emergencyAddressSid'] = $emergencyAddressSid; return $this; } /** * The SID of the Trunk we should use to handle calls to the new phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use only those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. * * @param string $trunkSid SID of the trunk to handle calls to the new phone * number * @return $this Fluent Builder */ public function setTrunkSid(string $trunkSid): self { $this->options['trunkSid'] = $trunkSid; return $this; } /** * The SID of the Identity resource that we should associate with the new phone number. Some regions require an identity to meet local regulations. * * @param string $identitySid The SID of the Identity resource to associate * with the new phone number * @return $this Fluent Builder */ public function setIdentitySid(string $identitySid): self { $this->options['identitySid'] = $identitySid; return $this; } /** * The SID of the Address resource we should associate with the new phone number. Some regions require addresses to meet local regulations. * * @param string $addressSid The SID of the Address resource associated with * the phone number * @return $this Fluent Builder */ public function setAddressSid(string $addressSid): self { $this->options['addressSid'] = $addressSid; return $this; } /** * The configuration parameter for the new phone number to receive incoming voice calls or faxes. Can be: `fax` or `voice` and defaults to `voice`. * * @param string $voiceReceiveMode Incoming call type: fax or voice * @return $this Fluent Builder */ public function setVoiceReceiveMode(string $voiceReceiveMode): self { $this->options['voiceReceiveMode'] = $voiceReceiveMode; return $this; } /** * The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. * * @param string $bundleSid The SID of the Bundle resource associated with * number * @return $this Fluent Builder */ public function setBundleSid(string $bundleSid): self { $this->options['bundleSid'] = $bundleSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.CreateIncomingPhoneNumberOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/SipInstance.php000064400000003112150515725670015277 0ustar00solution = ['accountSid' => $accountSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Api.V2010.SipInstance]'; } }src/Twilio/Rest/Api/V2010/Account/KeyContext.php000064400000005232150515725670015161 0ustar00solution = ['accountSid' => $accountSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Keys/' . \rawurlencode($sid) . '.json'; } /** * Fetch the KeyInstance * * @return KeyInstance Fetched KeyInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): KeyInstance { $payload = $this->version->fetch('GET', $this->uri); return new KeyInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Update the KeyInstance * * @param array|Options $options Optional Arguments * @return KeyInstance Updated KeyInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): KeyInstance { $options = new Values($options); $data = Values::of(['FriendlyName' => $options['friendlyName'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new KeyInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Delete the KeyInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.KeyContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/ApplicationList.php000064400000015344150515725670016170 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Applications.json'; } /** * Create the ApplicationInstance * * @param array|Options $options Optional Arguments * @return ApplicationInstance Created ApplicationInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): ApplicationInstance { $options = new Values($options); $data = Values::of([ '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'], 'FriendlyName' => $options['friendlyName'], ]); $payload = $this->version->create('POST', $this->uri, [], $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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $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(array $options = [], int $limit = null, $pageSize = null): array { 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 ApplicationPage Page of ApplicationInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ApplicationPage { $options = new Values($options); $params = Values::of([ '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 ApplicationPage Page of ApplicationInstance */ public function getPage(string $targetUrl): ApplicationPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ApplicationPage($this->version, $response, $this->solution); } /** * Constructs a ApplicationContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): ApplicationContext { return new ApplicationContext($this->version, $this->solution['accountSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.ApplicationList]'; } }src/Twilio/Rest/Api/V2010/Account/SigningKeyInstance.php000064400000007550150515725670016625 0ustar00properties = [ 'sid' => Values::array_get($payload, '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')), ]; $this->solution = ['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 SigningKeyContext Context for this SigningKeyInstance */ protected function proxy(): SigningKeyContext { if (!$this->context) { $this->context = new SigningKeyContext( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the SigningKeyInstance * * @return SigningKeyInstance Fetched SigningKeyInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SigningKeyInstance { return $this->proxy()->fetch(); } /** * Update the SigningKeyInstance * * @param array|Options $options Optional Arguments * @return SigningKeyInstance Updated SigningKeyInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SigningKeyInstance { return $this->proxy()->update($options); } /** * Delete the SigningKeyInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.SigningKeyInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/OutgoingCallerIdPage.php000064400000002336150515725670017056 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return OutgoingCallerIdInstance \Twilio\Rest\Api\V2010\Account\OutgoingCallerIdInstance */ public function buildInstance(array $payload): OutgoingCallerIdInstance { return new OutgoingCallerIdInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.OutgoingCallerIdPage]'; } }src/Twilio/Rest/Api/V2010/Account/UsagePage.php000064400000002234150515725670014724 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return UsageInstance \Twilio\Rest\Api\V2010\Account\UsageInstance */ public function buildInstance(array $payload): UsageInstance { return new UsageInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.UsagePage]'; } }src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumberList.php000064400000023557150515725670017640 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/IncomingPhoneNumbers.json'; } /** * Streams IncomingPhoneNumberInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads IncomingPhoneNumberInstance 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 IncomingPhoneNumberInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of IncomingPhoneNumberInstance 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 IncomingPhoneNumberPage Page of IncomingPhoneNumberInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): IncomingPhoneNumberPage { $options = new Values($options); $params = Values::of([ 'Beta' => Serialize::booleanToString($options['beta']), 'FriendlyName' => $options['friendlyName'], 'PhoneNumber' => $options['phoneNumber'], 'Origin' => $options['origin'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new IncomingPhoneNumberPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of IncomingPhoneNumberInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return IncomingPhoneNumberPage Page of IncomingPhoneNumberInstance */ public function getPage(string $targetUrl): IncomingPhoneNumberPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new IncomingPhoneNumberPage($this->version, $response, $this->solution); } /** * Create the IncomingPhoneNumberInstance * * @param array|Options $options Optional Arguments * @return IncomingPhoneNumberInstance Created IncomingPhoneNumberInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): IncomingPhoneNumberInstance { $options = new Values($options); $data = Values::of([ 'PhoneNumber' => $options['phoneNumber'], 'AreaCode' => $options['areaCode'], 'ApiVersion' => $options['apiVersion'], 'FriendlyName' => $options['friendlyName'], 'SmsApplicationSid' => $options['smsApplicationSid'], 'SmsFallbackMethod' => $options['smsFallbackMethod'], 'SmsFallbackUrl' => $options['smsFallbackUrl'], 'SmsMethod' => $options['smsMethod'], 'SmsUrl' => $options['smsUrl'], 'StatusCallback' => $options['statusCallback'], 'StatusCallbackMethod' => $options['statusCallbackMethod'], 'VoiceApplicationSid' => $options['voiceApplicationSid'], 'VoiceCallerIdLookup' => Serialize::booleanToString($options['voiceCallerIdLookup']), 'VoiceFallbackMethod' => $options['voiceFallbackMethod'], 'VoiceFallbackUrl' => $options['voiceFallbackUrl'], 'VoiceMethod' => $options['voiceMethod'], 'VoiceUrl' => $options['voiceUrl'], 'EmergencyStatus' => $options['emergencyStatus'], 'EmergencyAddressSid' => $options['emergencyAddressSid'], 'TrunkSid' => $options['trunkSid'], 'IdentitySid' => $options['identitySid'], 'AddressSid' => $options['addressSid'], 'VoiceReceiveMode' => $options['voiceReceiveMode'], 'BundleSid' => $options['bundleSid'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new IncomingPhoneNumberInstance($this->version, $payload, $this->solution['accountSid']); } /** * Access the local */ protected function getLocal(): LocalList { if (!$this->_local) { $this->_local = new LocalList($this->version, $this->solution['accountSid']); } return $this->_local; } /** * Access the mobile */ protected function getMobile(): MobileList { if (!$this->_mobile) { $this->_mobile = new MobileList($this->version, $this->solution['accountSid']); } return $this->_mobile; } /** * Access the tollFree */ protected function getTollFree(): TollFreeList { if (!$this->_tollFree) { $this->_tollFree = new TollFreeList($this->version, $this->solution['accountSid']); } return $this->_tollFree; } /** * Constructs a IncomingPhoneNumberContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): IncomingPhoneNumberContext { return new IncomingPhoneNumberContext($this->version, $this->solution['accountSid'], $sid); } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return \Twilio\ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Api.V2010.IncomingPhoneNumberList]'; } }src/Twilio/Rest/Api/V2010/Account/CallOptions.php000064400000142721150515725670015320 0ustar00options['url'] = $url; $this->options['twiml'] = $twiml; $this->options['applicationSid'] = $applicationSid; $this->options['method'] = $method; $this->options['fallbackUrl'] = $fallbackUrl; $this->options['fallbackMethod'] = $fallbackMethod; $this->options['statusCallback'] = $statusCallback; $this->options['statusCallbackEvent'] = $statusCallbackEvent; $this->options['statusCallbackMethod'] = $statusCallbackMethod; $this->options['sendDigits'] = $sendDigits; $this->options['timeout'] = $timeout; $this->options['record'] = $record; $this->options['recordingChannels'] = $recordingChannels; $this->options['recordingStatusCallback'] = $recordingStatusCallback; $this->options['recordingStatusCallbackMethod'] = $recordingStatusCallbackMethod; $this->options['sipAuthUsername'] = $sipAuthUsername; $this->options['sipAuthPassword'] = $sipAuthPassword; $this->options['machineDetection'] = $machineDetection; $this->options['machineDetectionTimeout'] = $machineDetectionTimeout; $this->options['recordingStatusCallbackEvent'] = $recordingStatusCallbackEvent; $this->options['trim'] = $trim; $this->options['callerId'] = $callerId; $this->options['machineDetectionSpeechThreshold'] = $machineDetectionSpeechThreshold; $this->options['machineDetectionSpeechEndThreshold'] = $machineDetectionSpeechEndThreshold; $this->options['machineDetectionSilenceTimeout'] = $machineDetectionSilenceTimeout; $this->options['asyncAmd'] = $asyncAmd; $this->options['asyncAmdStatusCallback'] = $asyncAmdStatusCallback; $this->options['asyncAmdStatusCallbackMethod'] = $asyncAmdStatusCallbackMethod; $this->options['byoc'] = $byoc; $this->options['callReason'] = $callReason; $this->options['callToken'] = $callToken; $this->options['recordingTrack'] = $recordingTrack; $this->options['timeLimit'] = $timeLimit; } /** * The absolute URL that returns the TwiML instructions for the call. We will call this URL using the `method` when the call connects. For more information, see the [Url Parameter](https://www.twilio.com/docs/voice/make-calls#specify-a-url-parameter) section in [Making Calls](https://www.twilio.com/docs/voice/make-calls). * * @param string $url The absolute URL that returns TwiML for this call * @return $this Fluent Builder */ public function setUrl(string $url): self { $this->options['url'] = $url; return $this; } /** * TwiML instructions for the call Twilio will use without fetching Twiml from url parameter. If both `twiml` and `url` are provided then `twiml` parameter will be ignored. Max 4000 characters. * * @param string $twiml TwiML instructions for the call * @return $this Fluent Builder */ public function setTwiml(string $twiml): self { $this->options['twiml'] = $twiml; return $this; } /** * The SID of the Application resource that will handle the call, if the call will be handled by an application. * * @param string $applicationSid The SID of the Application resource that will * handle the call * @return $this Fluent Builder */ public function setApplicationSid(string $applicationSid): self { $this->options['applicationSid'] = $applicationSid; return $this; } /** * The HTTP method we should use when calling the `url` parameter's value. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored. * * @param string $method HTTP method to use to fetch TwiML * @return $this Fluent Builder */ public function setMethod(string $method): self { $this->options['method'] = $method; return $this; } /** * The URL that we call using the `fallback_method` if an error occurs when requesting or executing the TwiML at `url`. If an `application_sid` parameter is present, this parameter is ignored. * * @param string $fallbackUrl Fallback URL in case of error * @return $this Fluent Builder */ public function setFallbackUrl(string $fallbackUrl): self { $this->options['fallbackUrl'] = $fallbackUrl; return $this; } /** * The HTTP method that we should use to request the `fallback_url`. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored. * * @param string $fallbackMethod HTTP Method to use with fallback_url * @return $this Fluent Builder */ public function setFallbackMethod(string $fallbackMethod): self { $this->options['fallbackMethod'] = $fallbackMethod; return $this; } /** * The URL we should call using the `status_callback_method` to send status information to your application. If no `status_callback_event` is specified, we will send the `completed` status. If an `application_sid` parameter is present, this parameter is ignored. URLs must contain a valid hostname (underscores are not permitted). * * @param string $statusCallback The URL we should call to send status * information to your application * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * The call progress events that we will send to the `status_callback` URL. Can be: `initiated`, `ringing`, `answered`, and `completed`. If no event is specified, we send the `completed` status. If you want to receive multiple events, specify each one in a separate `status_callback_event` parameter. See the code sample for [monitoring call progress](https://www.twilio.com/docs/voice/api/call-resource?code-sample=code-create-a-call-resource-and-specify-a-statuscallbackevent&code-sdk-version=json). If an `application_sid` is present, this parameter is ignored. * * @param string[] $statusCallbackEvent The call progress events that we send * to the `status_callback` URL. * @return $this Fluent Builder */ public function setStatusCallbackEvent(array $statusCallbackEvent): self { $this->options['statusCallbackEvent'] = $statusCallbackEvent; return $this; } /** * The HTTP method we should use when calling the `status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored. * * @param string $statusCallbackMethod HTTP Method to use with status_callback * @return $this Fluent Builder */ public function setStatusCallbackMethod(string $statusCallbackMethod): self { $this->options['statusCallbackMethod'] = $statusCallbackMethod; return $this; } /** * A string of keys to dial after connecting to the number, maximum of 32 digits. Valid digits in the string include: any digit (`0`-`9`), '`#`', '`*`' and '`w`', to insert a half second pause. For example, if you connected to a company phone number and wanted to pause for one second, and then dial extension 1234 followed by the pound key, the value of this parameter would be `ww1234#`. Remember to URL-encode this string, since the '`#`' character has special meaning in a URL. If both `SendDigits` and `MachineDetection` parameters are provided, then `MachineDetection` will be ignored. * * @param string $sendDigits The digits to dial after connecting to the number * @return $this Fluent Builder */ public function setSendDigits(string $sendDigits): self { $this->options['sendDigits'] = $sendDigits; return $this; } /** * The integer number of seconds that we should allow the phone to ring before assuming there is no answer. The default is `60` seconds and the maximum is `600` seconds. For some call flows, we will add a 5-second buffer to the timeout value you provide. For this reason, a timeout value of 10 seconds could result in an actual timeout closer to 15 seconds. You can set this to a short time, such as `15` seconds, to hang up before reaching an answering machine or voicemail. * * @param int $timeout Number of seconds to wait for an answer * @return $this Fluent Builder */ public function setTimeout(int $timeout): self { $this->options['timeout'] = $timeout; return $this; } /** * Whether to record the call. Can be `true` to record the phone call, or `false` to not. The default is `false`. The `recording_url` is sent to the `status_callback` URL. * * @param bool $record Whether to record the call * @return $this Fluent Builder */ public function setRecord(bool $record): self { $this->options['record'] = $record; return $this; } /** * The number of channels in the final recording. Can be: `mono` or `dual`. The default is `mono`. `mono` records both legs of the call in a single channel of the recording file. `dual` records each leg to a separate channel of the recording file. The first channel of a dual-channel recording contains the parent call and the second channel contains the child call. * * @param string $recordingChannels The number of channels in the final * recording * @return $this Fluent Builder */ public function setRecordingChannels(string $recordingChannels): self { $this->options['recordingChannels'] = $recordingChannels; return $this; } /** * The URL that we call when the recording is available to be accessed. * * @param string $recordingStatusCallback The URL that we call when the * recording is available to be accessed * @return $this Fluent Builder */ public function setRecordingStatusCallback(string $recordingStatusCallback): self { $this->options['recordingStatusCallback'] = $recordingStatusCallback; return $this; } /** * The HTTP method we should use when calling the `recording_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. * * @param string $recordingStatusCallbackMethod The HTTP method we should use * when calling the * `recording_status_callback` URL * @return $this Fluent Builder */ public function setRecordingStatusCallbackMethod(string $recordingStatusCallbackMethod): self { $this->options['recordingStatusCallbackMethod'] = $recordingStatusCallbackMethod; return $this; } /** * The username used to authenticate the caller making a SIP call. * * @param string $sipAuthUsername The username used to authenticate the caller * making a SIP call * @return $this Fluent Builder */ public function setSipAuthUsername(string $sipAuthUsername): self { $this->options['sipAuthUsername'] = $sipAuthUsername; return $this; } /** * The password required to authenticate the user account specified in `sip_auth_username`. * * @param string $sipAuthPassword The password required to authenticate the * user account specified in `sip_auth_username`. * @return $this Fluent Builder */ public function setSipAuthPassword(string $sipAuthPassword): self { $this->options['sipAuthPassword'] = $sipAuthPassword; return $this; } /** * Whether to detect if a human, answering machine, or fax has picked up the call. Can be: `Enable` or `DetectMessageEnd`. Use `Enable` if you would like us to return `AnsweredBy` as soon as the called party is identified. Use `DetectMessageEnd`, if you would like to leave a message on an answering machine. If `send_digits` is provided, this parameter is ignored. For more information, see [Answering Machine Detection](https://www.twilio.com/docs/voice/answering-machine-detection). * * @param string $machineDetection Enable machine detection or end of greeting * detection * @return $this Fluent Builder */ public function setMachineDetection(string $machineDetection): self { $this->options['machineDetection'] = $machineDetection; return $this; } /** * The number of seconds that we should attempt to detect an answering machine before timing out and sending a voice request with `AnsweredBy` of `unknown`. The default timeout is 30 seconds. * * @param int $machineDetectionTimeout Number of seconds to wait for machine * detection * @return $this Fluent Builder */ public function setMachineDetectionTimeout(int $machineDetectionTimeout): self { $this->options['machineDetectionTimeout'] = $machineDetectionTimeout; return $this; } /** * The recording status events that will trigger calls to the URL specified in `recording_status_callback`. Can be: `in-progress`, `completed` and `absent`. Defaults to `completed`. Separate multiple values with a space. * * @param string[] $recordingStatusCallbackEvent The recording status events * that will trigger calls to the * URL specified in * `recording_status_callback` * @return $this Fluent Builder */ public function setRecordingStatusCallbackEvent(array $recordingStatusCallbackEvent): self { $this->options['recordingStatusCallbackEvent'] = $recordingStatusCallbackEvent; return $this; } /** * Whether to trim any leading and trailing silence from the recording. Can be: `trim-silence` or `do-not-trim` and the default is `trim-silence`. * * @param string $trim Set this parameter to control trimming of silence on the * recording. * @return $this Fluent Builder */ public function setTrim(string $trim): self { $this->options['trim'] = $trim; return $this; } /** * The phone number, SIP address, or Client identifier that made this call. Phone numbers are in [E.164 format](https://wwnw.twilio.com/docs/glossary/what-e164) (e.g., +16175551212). SIP addresses are formatted as `name@company.com`. * * @param string $callerId The phone number, SIP address, or Client identifier * that made this call. Phone numbers are in E.164 * format (e.g., +16175551212). SIP addresses are * formatted as `name@company.com`. * @return $this Fluent Builder */ public function setCallerId(string $callerId): self { $this->options['callerId'] = $callerId; return $this; } /** * The number of milliseconds that is used as the measuring stick for the length of the speech activity, where durations lower than this value will be interpreted as a human and longer than this value as a machine. Possible Values: 1000-6000. Default: 2400. * * @param int $machineDetectionSpeechThreshold Number of milliseconds for * measuring stick for the length * of the speech activity * @return $this Fluent Builder */ public function setMachineDetectionSpeechThreshold(int $machineDetectionSpeechThreshold): self { $this->options['machineDetectionSpeechThreshold'] = $machineDetectionSpeechThreshold; return $this; } /** * The number of milliseconds of silence after speech activity at which point the speech activity is considered complete. Possible Values: 500-5000. Default: 1200. * * @param int $machineDetectionSpeechEndThreshold Number of milliseconds of * silence after speech activity * @return $this Fluent Builder */ public function setMachineDetectionSpeechEndThreshold(int $machineDetectionSpeechEndThreshold): self { $this->options['machineDetectionSpeechEndThreshold'] = $machineDetectionSpeechEndThreshold; return $this; } /** * The number of milliseconds of initial silence after which an `unknown` AnsweredBy result will be returned. Possible Values: 2000-10000. Default: 5000. * * @param int $machineDetectionSilenceTimeout Number of milliseconds of initial * silence * @return $this Fluent Builder */ public function setMachineDetectionSilenceTimeout(int $machineDetectionSilenceTimeout): self { $this->options['machineDetectionSilenceTimeout'] = $machineDetectionSilenceTimeout; return $this; } /** * Select whether to perform answering machine detection in the background. Default, blocks the execution of the call until Answering Machine Detection is completed. Can be: `true` or `false`. * * @param string $asyncAmd Enable asynchronous AMD * @return $this Fluent Builder */ public function setAsyncAmd(string $asyncAmd): self { $this->options['asyncAmd'] = $asyncAmd; return $this; } /** * The URL that we should call using the `async_amd_status_callback_method` to notify customer application whether the call was answered by human, machine or fax. * * @param string $asyncAmdStatusCallback The URL we should call to send amd * status information to your application * @return $this Fluent Builder */ public function setAsyncAmdStatusCallback(string $asyncAmdStatusCallback): self { $this->options['asyncAmdStatusCallback'] = $asyncAmdStatusCallback; return $this; } /** * The HTTP method we should use when calling the `async_amd_status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. * * @param string $asyncAmdStatusCallbackMethod HTTP Method to use with * async_amd_status_callback * @return $this Fluent Builder */ public function setAsyncAmdStatusCallbackMethod(string $asyncAmdStatusCallbackMethod): self { $this->options['asyncAmdStatusCallbackMethod'] = $asyncAmdStatusCallbackMethod; return $this; } /** * The SID of a BYOC (Bring Your Own Carrier) trunk to route this call with. Note that `byoc` is only meaningful when `to` is a phone number; it will otherwise be ignored. (Beta) * * @param string $byoc BYOC trunk SID (Beta) * @return $this Fluent Builder */ public function setByoc(string $byoc): self { $this->options['byoc'] = $byoc; return $this; } /** * The Reason for the outgoing call. Use it to specify the purpose of the call that is presented on the called party's phone. (Branded Calls Beta) * * @param string $callReason Reason for the call (Branded Calls Beta) * @return $this Fluent Builder */ public function setCallReason(string $callReason): self { $this->options['callReason'] = $callReason; return $this; } /** * A token string needed to invoke a forwarded call. A call_token is generated when an incoming call is received on a Twilio number. Pass an incoming call's call_token value to a forwarded call via the call_token parameter when creating a new call. A forwarded call should bear the same CallerID of the original incoming call. * * @param string $callToken A token string needed to invoke a forwarded call * with a CallerId recieved on a previous incoming call * @return $this Fluent Builder */ public function setCallToken(string $callToken): self { $this->options['callToken'] = $callToken; return $this; } /** * The audio track to record for the call. Can be: `inbound`, `outbound` or `both`. The default is `both`. `inbound` records the audio that is received by Twilio. `outbound` records the audio that is generated from Twilio. `both` records the audio that is received and generated by Twilio. * * @param string $recordingTrack Which track(s) to record * @return $this Fluent Builder */ public function setRecordingTrack(string $recordingTrack): self { $this->options['recordingTrack'] = $recordingTrack; return $this; } /** * The maximum duration of the call in seconds. Constraints depend on account and configuration. * * @param int $timeLimit The maximum duration of the call in seconds. * @return $this Fluent Builder */ public function setTimeLimit(int $timeLimit): self { $this->options['timeLimit'] = $timeLimit; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.CreateCallOptions ' . $options . ']'; } } class ReadCallOptions extends Options { /** * @param string $to Phone number or Client identifier of calls to include * @param string $from Phone number or Client identifier to filter `from` on * @param string $parentCallSid Parent call SID to filter on * @param string $status The status of the resources to read * @param string $startTimeBefore Only include calls that started on this date * @param string $startTime Only include calls that started on this date * @param string $startTimeAfter Only include calls that started on this date * @param string $endTimeBefore Only include calls that ended on this date * @param string $endTime Only include calls that ended on this date * @param string $endTimeAfter Only include calls that ended on this date */ public function __construct(string $to = Values::NONE, string $from = Values::NONE, string $parentCallSid = Values::NONE, string $status = Values::NONE, string $startTimeBefore = Values::NONE, string $startTime = Values::NONE, string $startTimeAfter = Values::NONE, string $endTimeBefore = Values::NONE, string $endTime = Values::NONE, string $endTimeAfter = Values::NONE) { $this->options['to'] = $to; $this->options['from'] = $from; $this->options['parentCallSid'] = $parentCallSid; $this->options['status'] = $status; $this->options['startTimeBefore'] = $startTimeBefore; $this->options['startTime'] = $startTime; $this->options['startTimeAfter'] = $startTimeAfter; $this->options['endTimeBefore'] = $endTimeBefore; $this->options['endTime'] = $endTime; $this->options['endTimeAfter'] = $endTimeAfter; } /** * Only show calls made to this phone number, SIP address, Client identifier or SIM SID. * * @param string $to Phone number or Client identifier of calls to include * @return $this Fluent Builder */ public function setTo(string $to): self { $this->options['to'] = $to; return $this; } /** * Only include calls from this phone number, SIP address, Client identifier or SIM SID. * * @param string $from Phone number or Client identifier to filter `from` on * @return $this Fluent Builder */ public function setFrom(string $from): self { $this->options['from'] = $from; return $this; } /** * Only include calls spawned by calls with this SID. * * @param string $parentCallSid Parent call SID to filter on * @return $this Fluent Builder */ public function setParentCallSid(string $parentCallSid): self { $this->options['parentCallSid'] = $parentCallSid; return $this; } /** * The status of the calls to include. Can be: `queued`, `ringing`, `in-progress`, `canceled`, `completed`, `failed`, `busy`, or `no-answer`. * * @param string $status The status of the resources to read * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. * * @param string $startTimeBefore Only include calls that started on this date * @return $this Fluent Builder */ public function setStartTimeBefore(string $startTimeBefore): self { $this->options['startTimeBefore'] = $startTimeBefore; return $this; } /** * Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. * * @param string $startTime Only include calls that started on this date * @return $this Fluent Builder */ public function setStartTime(string $startTime): self { $this->options['startTime'] = $startTime; return $this; } /** * Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. * * @param string $startTimeAfter Only include calls that started on this date * @return $this Fluent Builder */ public function setStartTimeAfter(string $startTimeAfter): self { $this->options['startTimeAfter'] = $startTimeAfter; return $this; } /** * Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. * * @param string $endTimeBefore Only include calls that ended on this date * @return $this Fluent Builder */ public function setEndTimeBefore(string $endTimeBefore): self { $this->options['endTimeBefore'] = $endTimeBefore; return $this; } /** * Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. * * @param string $endTime Only include calls that ended on this date * @return $this Fluent Builder */ public function setEndTime(string $endTime): self { $this->options['endTime'] = $endTime; return $this; } /** * Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. * * @param string $endTimeAfter Only include calls that ended on this date * @return $this Fluent Builder */ public function setEndTimeAfter(string $endTimeAfter): self { $this->options['endTimeAfter'] = $endTimeAfter; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadCallOptions ' . $options . ']'; } } class UpdateCallOptions extends Options { /** * @param string $url The absolute URL that returns TwiML for this call * @param string $method HTTP method to use to fetch TwiML * @param string $status The new status to update the call with. * @param string $fallbackUrl Fallback URL in case of error * @param string $fallbackMethod HTTP Method to use with fallback_url * @param string $statusCallback The URL we should call to send status * information to your application * @param string $statusCallbackMethod HTTP Method to use to call * status_callback * @param string $twiml TwiML instructions for the call * @param int $timeLimit The maximum duration of the call in seconds. */ public function __construct(string $url = Values::NONE, string $method = Values::NONE, string $status = Values::NONE, string $fallbackUrl = Values::NONE, string $fallbackMethod = Values::NONE, string $statusCallback = Values::NONE, string $statusCallbackMethod = Values::NONE, string $twiml = Values::NONE, int $timeLimit = Values::NONE) { $this->options['url'] = $url; $this->options['method'] = $method; $this->options['status'] = $status; $this->options['fallbackUrl'] = $fallbackUrl; $this->options['fallbackMethod'] = $fallbackMethod; $this->options['statusCallback'] = $statusCallback; $this->options['statusCallbackMethod'] = $statusCallbackMethod; $this->options['twiml'] = $twiml; $this->options['timeLimit'] = $timeLimit; } /** * The absolute URL that returns the TwiML instructions for the call. We will call this URL using the `method` when the call connects. For more information, see the [Url Parameter](https://www.twilio.com/docs/voice/make-calls#specify-a-url-parameter) section in [Making Calls](https://www.twilio.com/docs/voice/make-calls). * * @param string $url The absolute URL that returns TwiML for this call * @return $this Fluent Builder */ public function setUrl(string $url): self { $this->options['url'] = $url; return $this; } /** * The HTTP method we should use when calling the `url`. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored. * * @param string $method HTTP method to use to fetch TwiML * @return $this Fluent Builder */ public function setMethod(string $method): self { $this->options['method'] = $method; return $this; } /** * The new status of the resource. Can be: `canceled` or `completed`. Specifying `canceled` will attempt to hang up calls that are queued or ringing; however, it will not affect calls already in progress. Specifying `completed` will attempt to hang up a call even if it's already in progress. * * @param string $status The new status to update the call with. * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * The URL that we call using the `fallback_method` if an error occurs when requesting or executing the TwiML at `url`. If an `application_sid` parameter is present, this parameter is ignored. * * @param string $fallbackUrl Fallback URL in case of error * @return $this Fluent Builder */ public function setFallbackUrl(string $fallbackUrl): self { $this->options['fallbackUrl'] = $fallbackUrl; return $this; } /** * The HTTP method that we should use to request the `fallback_url`. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored. * * @param string $fallbackMethod HTTP Method to use with fallback_url * @return $this Fluent Builder */ public function setFallbackMethod(string $fallbackMethod): self { $this->options['fallbackMethod'] = $fallbackMethod; return $this; } /** * The URL we should call using the `status_callback_method` to send status information to your application. If no `status_callback_event` is specified, we will send the `completed` status. If an `application_sid` parameter is present, this parameter is ignored. URLs must contain a valid hostname (underscores are not permitted). * * @param string $statusCallback The URL we should call to send status * information to your application * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * The HTTP method we should use when requesting the `status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored. * * @param string $statusCallbackMethod HTTP Method to use to call * status_callback * @return $this Fluent Builder */ public function setStatusCallbackMethod(string $statusCallbackMethod): self { $this->options['statusCallbackMethod'] = $statusCallbackMethod; return $this; } /** * TwiML instructions for the call Twilio will use without fetching Twiml from url. Twiml and url parameters are mutually exclusive * * @param string $twiml TwiML instructions for the call * @return $this Fluent Builder */ public function setTwiml(string $twiml): self { $this->options['twiml'] = $twiml; return $this; } /** * The maximum duration of the call in seconds. Constraints depend on account and configuration. * * @param int $timeLimit The maximum duration of the call in seconds. * @return $this Fluent Builder */ public function setTimeLimit(int $timeLimit): self { $this->options['timeLimit'] = $timeLimit; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.UpdateCallOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountryList.php000064400000012620150515725670021326 0ustar00solution = ['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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $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(int $limit = null, $pageSize = null): array { 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 AvailablePhoneNumberCountryPage Page of * AvailablePhoneNumberCountryInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): AvailablePhoneNumberCountryPage { $params = Values::of(['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 AvailablePhoneNumberCountryPage Page of * AvailablePhoneNumberCountryInstance */ public function getPage(string $targetUrl): AvailablePhoneNumberCountryPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new AvailablePhoneNumberCountryPage($this->version, $response, $this->solution); } /** * Constructs a AvailablePhoneNumberCountryContext * * @param string $countryCode The ISO country code of the country to fetch * available phone number information about */ public function getContext(string $countryCode): AvailablePhoneNumberCountryContext { return new AvailablePhoneNumberCountryContext( $this->version, $this->solution['accountSid'], $countryCode ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.AvailablePhoneNumberCountryList]'; } }src/Twilio/Rest/Api/V2010/Account/KeyList.php000064400000011265150515725670014453 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Keys.json'; } /** * Streams KeyInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads KeyInstance 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 KeyInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of KeyInstance 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 KeyPage Page of KeyInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): KeyPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new KeyPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of KeyInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return KeyPage Page of KeyInstance */ public function getPage(string $targetUrl): KeyPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new KeyPage($this->version, $response, $this->solution); } /** * Constructs a KeyContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): KeyContext { return new KeyContext($this->version, $this->solution['accountSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.KeyList]'; } }src/Twilio/Rest/Api/V2010/Account/OutgoingCallerIdContext.php000064400000005535150515725670017632 0ustar00solution = ['accountSid' => $accountSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/OutgoingCallerIds/' . \rawurlencode($sid) . '.json'; } /** * Fetch the OutgoingCallerIdInstance * * @return OutgoingCallerIdInstance Fetched OutgoingCallerIdInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): OutgoingCallerIdInstance { $payload = $this->version->fetch('GET', $this->uri); return new OutgoingCallerIdInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Update the OutgoingCallerIdInstance * * @param array|Options $options Optional Arguments * @return OutgoingCallerIdInstance Updated OutgoingCallerIdInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): OutgoingCallerIdInstance { $options = new Values($options); $data = Values::of(['FriendlyName' => $options['friendlyName'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new OutgoingCallerIdInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Delete the OutgoingCallerIdInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.OutgoingCallerIdContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/NotificationOptions.php000064400000007366150515725670017100 0ustar00options['log'] = $log; $this->options['messageDateBefore'] = $messageDateBefore; $this->options['messageDate'] = $messageDate; $this->options['messageDateAfter'] = $messageDateAfter; } /** * Only read notifications of the specified log level. Can be: `0` to read only ERROR notifications or `1` to read only WARNING notifications. By default, all notifications are read. * * @param int $log Filter by log level * @return $this Fluent Builder */ public function setLog(int $log): self { $this->options['log'] = $log; return $this; } /** * Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. * * @param string $messageDateBefore Filter by date * @return $this Fluent Builder */ public function setMessageDateBefore(string $messageDateBefore): self { $this->options['messageDateBefore'] = $messageDateBefore; return $this; } /** * Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. * * @param string $messageDate Filter by date * @return $this Fluent Builder */ public function setMessageDate(string $messageDate): self { $this->options['messageDate'] = $messageDate; return $this; } /** * Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. * * @param string $messageDateAfter Filter by date * @return $this Fluent Builder */ public function setMessageDateAfter(string $messageDateAfter): self { $this->options['messageDateAfter'] = $messageDateAfter; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadNotificationOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/ConferencePage.php000064400000002272150515725670015731 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ConferenceInstance \Twilio\Rest\Api\V2010\Account\ConferenceInstance */ public function buildInstance(array $payload): ConferenceInstance { return new ConferenceInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.ConferencePage]'; } }src/Twilio/Rest/Api/V2010/Account/RecordingOptions.php000064400000013156150515725670016360 0ustar00options['dateCreatedBefore'] = $dateCreatedBefore; $this->options['dateCreated'] = $dateCreated; $this->options['dateCreatedAfter'] = $dateCreatedAfter; $this->options['callSid'] = $callSid; $this->options['conferenceSid'] = $conferenceSid; } /** * Only include recordings that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read recordings that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read recordings that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read recordings that were created on or after midnight of this date. * * @param string $dateCreatedBefore Only include recordings that were created * on this date * @return $this Fluent Builder */ public function setDateCreatedBefore(string $dateCreatedBefore): self { $this->options['dateCreatedBefore'] = $dateCreatedBefore; return $this; } /** * Only include recordings that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read recordings that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read recordings that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read recordings that were created on or after midnight of this date. * * @param string $dateCreated Only include recordings that were created on this * date * @return $this Fluent Builder */ public function setDateCreated(string $dateCreated): self { $this->options['dateCreated'] = $dateCreated; return $this; } /** * Only include recordings that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read recordings that were created on this date. You can also specify an inequality, such as `DateCreated<=YYYY-MM-DD`, to read recordings that were created on or before midnight of this date, and `DateCreated>=YYYY-MM-DD` to read recordings that were created on or after midnight of this date. * * @param string $dateCreatedAfter Only include recordings that were created on * this date * @return $this Fluent Builder */ public function setDateCreatedAfter(string $dateCreatedAfter): self { $this->options['dateCreatedAfter'] = $dateCreatedAfter; return $this; } /** * The [Call](https://www.twilio.com/docs/voice/api/call-resource) SID of the resources to read. * * @param string $callSid The Call SID of the resources to read * @return $this Fluent Builder */ public function setCallSid(string $callSid): self { $this->options['callSid'] = $callSid; return $this; } /** * The Conference SID that identifies the conference associated with the recording to read. * * @param string $conferenceSid Read by unique Conference SID for the recording * @return $this Fluent Builder */ public function setConferenceSid(string $conferenceSid): self { $this->options['conferenceSid'] = $conferenceSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadRecordingOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/NewSigningKeyPage.php000064400000002314150515725670016400 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return NewSigningKeyInstance \Twilio\Rest\Api\V2010\Account\NewSigningKeyInstance */ public function buildInstance(array $payload): NewSigningKeyInstance { return new NewSigningKeyInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.NewSigningKeyPage]'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountryInstance.php000064400000012607150515725670022164 0ustar00properties = [ '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 = [ '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 AvailablePhoneNumberCountryContext Context for this * AvailablePhoneNumberCountryInstance */ protected function proxy(): AvailablePhoneNumberCountryContext { if (!$this->context) { $this->context = new AvailablePhoneNumberCountryContext( $this->version, $this->solution['accountSid'], $this->solution['countryCode'] ); } return $this->context; } /** * Fetch the AvailablePhoneNumberCountryInstance * * @return AvailablePhoneNumberCountryInstance Fetched * AvailablePhoneNumberCountryInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AvailablePhoneNumberCountryInstance { return $this->proxy()->fetch(); } /** * Access the local */ protected function getLocal(): LocalList { return $this->proxy()->local; } /** * Access the tollFree */ protected function getTollFree(): TollFreeList { return $this->proxy()->tollFree; } /** * Access the mobile */ protected function getMobile(): MobileList { return $this->proxy()->mobile; } /** * Access the national */ protected function getNational(): NationalList { return $this->proxy()->national; } /** * Access the voip */ protected function getVoip(): VoipList { return $this->proxy()->voip; } /** * Access the sharedCost */ protected function getSharedCost(): SharedCostList { return $this->proxy()->sharedCost; } /** * Access the machineToMachine */ protected function getMachineToMachine(): MachineToMachineList { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.AvailablePhoneNumberCountryInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/ValidationRequestList.php000064400000004066150515725670017367 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/OutgoingCallerIds.json'; } /** * Create the ValidationRequestInstance * * @param string $phoneNumber The phone number to verify in E.164 format * @param array|Options $options Optional Arguments * @return ValidationRequestInstance Created ValidationRequestInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $phoneNumber, array $options = []): ValidationRequestInstance { $options = new Values($options); $data = Values::of([ 'PhoneNumber' => $phoneNumber, 'FriendlyName' => $options['friendlyName'], 'CallDelay' => $options['callDelay'], 'Extension' => $options['extension'], 'StatusCallback' => $options['statusCallback'], 'StatusCallbackMethod' => $options['statusCallbackMethod'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ValidationRequestInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.ValidationRequestList]'; } }src/Twilio/Rest/Api/V2010/Account/TokenInstance.php000064400000004574150515725670015641 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'iceServers' => Values::array_get($payload, 'ice_servers'), 'password' => Values::array_get($payload, 'password'), 'ttl' => Values::array_get($payload, 'ttl'), 'username' => Values::array_get($payload, 'username'), ]; $this->solution = ['accountSid' => $accountSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Api.V2010.TokenInstance]'; } }src/Twilio/Rest/Api/V2010/Account/KeyInstance.php000064400000007437150515725670015312 0ustar00properties = [ 'sid' => Values::array_get($payload, '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')), ]; $this->solution = ['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 KeyContext Context for this KeyInstance */ protected function proxy(): KeyContext { if (!$this->context) { $this->context = new KeyContext( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the KeyInstance * * @return KeyInstance Fetched KeyInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): KeyInstance { return $this->proxy()->fetch(); } /** * Update the KeyInstance * * @param array|Options $options Optional Arguments * @return KeyInstance Updated KeyInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): KeyInstance { return $this->proxy()->update($options); } /** * Delete the KeyInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.KeyInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/AuthorizedConnectAppList.php000064400000012052150515725670020007 0ustar00solution = ['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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $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(int $limit = null, $pageSize = null): array { 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 AuthorizedConnectAppPage Page of AuthorizedConnectAppInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): AuthorizedConnectAppPage { $params = Values::of(['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 AuthorizedConnectAppPage Page of AuthorizedConnectAppInstance */ public function getPage(string $targetUrl): AuthorizedConnectAppPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new AuthorizedConnectAppPage($this->version, $response, $this->solution); } /** * Constructs a AuthorizedConnectAppContext * * @param string $connectAppSid The SID of the Connect App to fetch */ public function getContext(string $connectAppSid): AuthorizedConnectAppContext { return new AuthorizedConnectAppContext( $this->version, $this->solution['accountSid'], $connectAppSid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.AuthorizedConnectAppList]'; } }src/Twilio/Rest/Api/V2010/Account/ValidationRequestOptions.php000064400000012047150515725670020105 0ustar00options['friendlyName'] = $friendlyName; $this->options['callDelay'] = $callDelay; $this->options['extension'] = $extension; $this->options['statusCallback'] = $statusCallback; $this->options['statusCallbackMethod'] = $statusCallbackMethod; } /** * A descriptive string that you create to describe the new caller ID resource. It can be up to 64 characters long. The default value is a formatted version of the phone number. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The number of seconds to delay before initiating the verification call. Can be an integer between `0` and `60`, inclusive. The default is `0`. * * @param int $callDelay The number of seconds to delay before initiating the * verification call * @return $this Fluent Builder */ public function setCallDelay(int $callDelay): self { $this->options['callDelay'] = $callDelay; return $this; } /** * The digits to dial after connecting the verification call. * * @param string $extension The digits to dial after connecting the * verification call * @return $this Fluent Builder */ public function setExtension(string $extension): self { $this->options['extension'] = $extension; return $this; } /** * The URL we should call using the `status_callback_method` to send status information about the verification process to your application. * * @param string $statusCallback The URL we should call to send status * information to your application * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST`, and the default is `POST`. * * @param string $statusCallbackMethod The HTTP method we should use to call * status_callback * @return $this Fluent Builder */ public function setStatusCallbackMethod(string $statusCallbackMethod): self { $this->options['statusCallbackMethod'] = $statusCallbackMethod; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.CreateValidationRequestOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/TokenPage.php000064400000002234150515725670014740 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return TokenInstance \Twilio\Rest\Api\V2010\Account\TokenInstance */ public function buildInstance(array $payload): TokenInstance { return new TokenInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.TokenPage]'; } }src/Twilio/Rest/Api/V2010/Account/NewKeyPage.php000064400000002242150515725670015061 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return NewKeyInstance \Twilio\Rest\Api\V2010\Account\NewKeyInstance */ public function buildInstance(array $payload): NewKeyInstance { return new NewKeyInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.NewKeyPage]'; } }src/Twilio/Rest/Api/V2010/Account/CallPage.php000064400000002226150515725670014534 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CallInstance \Twilio\Rest\Api\V2010\Account\CallInstance */ public function buildInstance(array $payload): CallInstance { return new CallInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.CallPage]'; } }src/Twilio/Rest/Api/V2010/Account/ConferenceContext.php000064400000011661150515725670016503 0ustar00solution = ['accountSid' => $accountSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Conferences/' . \rawurlencode($sid) . '.json'; } /** * Fetch the ConferenceInstance * * @return ConferenceInstance Fetched ConferenceInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ConferenceInstance { $payload = $this->version->fetch('GET', $this->uri); return new ConferenceInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Update the ConferenceInstance * * @param array|Options $options Optional Arguments * @return ConferenceInstance Updated ConferenceInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ConferenceInstance { $options = new Values($options); $data = Values::of([ 'Status' => $options['status'], 'AnnounceUrl' => $options['announceUrl'], 'AnnounceMethod' => $options['announceMethod'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ConferenceInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Access the participants */ protected function getParticipants(): ParticipantList { if (!$this->_participants) { $this->_participants = new ParticipantList( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->_participants; } /** * Access the recordings */ protected function getRecordings(): RecordingList { if (!$this->_recordings) { $this->_recordings = new RecordingList( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->_recordings; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.ConferenceContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/AddressContext.php000064400000011636150515725670016023 0ustar00solution = ['accountSid' => $accountSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Addresses/' . \rawurlencode($sid) . '.json'; } /** * Delete the AddressInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Fetch the AddressInstance * * @return AddressInstance Fetched AddressInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AddressInstance { $payload = $this->version->fetch('GET', $this->uri); 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 * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): AddressInstance { $options = new Values($options); $data = Values::of([ '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, [], $data); return new AddressInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Access the dependentPhoneNumbers */ protected function getDependentPhoneNumbers(): DependentPhoneNumberList { 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 ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.AddressContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/NewKeyList.php000064400000003165150515725670015125 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Keys.json'; } /** * Create the NewKeyInstance * * @param array|Options $options Optional Arguments * @return NewKeyInstance Created NewKeyInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): NewKeyInstance { $options = new Values($options); $data = Values::of(['FriendlyName' => $options['friendlyName'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new NewKeyInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.NewKeyList]'; } }src/Twilio/Rest/Api/V2010/Account/AuthorizedConnectAppInstance.php000064400000010315150515725670020640 0ustar00properties = [ '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 = [ '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 AuthorizedConnectAppContext Context for this * AuthorizedConnectAppInstance */ protected function proxy(): AuthorizedConnectAppContext { if (!$this->context) { $this->context = new AuthorizedConnectAppContext( $this->version, $this->solution['accountSid'], $this->solution['connectAppSid'] ); } return $this->context; } /** * Fetch the AuthorizedConnectAppInstance * * @return AuthorizedConnectAppInstance Fetched AuthorizedConnectAppInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AuthorizedConnectAppInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.AuthorizedConnectAppInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/TokenOptions.php000064400000002610150515725670015515 0ustar00options['ttl'] = $ttl; } /** * The duration in seconds for which the generated credentials are valid. The default value is 86400 (24 hours). * * @param int $ttl The duration in seconds the credentials are valid * @return $this Fluent Builder */ public function setTtl(int $ttl): self { $this->options['ttl'] = $ttl; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.CreateTokenOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/OutgoingCallerIdList.php000064400000012537150515725670017121 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/OutgoingCallerIds.json'; } /** * Streams OutgoingCallerIdInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads OutgoingCallerIdInstance 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 OutgoingCallerIdInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of OutgoingCallerIdInstance 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 OutgoingCallerIdPage Page of OutgoingCallerIdInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): OutgoingCallerIdPage { $options = new Values($options); $params = Values::of([ 'PhoneNumber' => $options['phoneNumber'], 'FriendlyName' => $options['friendlyName'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new OutgoingCallerIdPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of OutgoingCallerIdInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return OutgoingCallerIdPage Page of OutgoingCallerIdInstance */ public function getPage(string $targetUrl): OutgoingCallerIdPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new OutgoingCallerIdPage($this->version, $response, $this->solution); } /** * Constructs a OutgoingCallerIdContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): OutgoingCallerIdContext { return new OutgoingCallerIdContext($this->version, $this->solution['accountSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.OutgoingCallerIdList]'; } }src/Twilio/Rest/Api/V2010/Account/TranscriptionInstance.php000064400000010565150515725670017415 0ustar00properties = [ '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')), 'duration' => Values::array_get($payload, 'duration'), 'price' => Values::array_get($payload, 'price'), 'priceUnit' => Values::array_get($payload, 'price_unit'), 'recordingSid' => Values::array_get($payload, 'recording_sid'), 'sid' => Values::array_get($payload, 'sid'), 'status' => Values::array_get($payload, 'status'), 'transcriptionText' => Values::array_get($payload, 'transcription_text'), 'type' => Values::array_get($payload, 'type'), 'uri' => Values::array_get($payload, 'uri'), ]; $this->solution = ['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 TranscriptionContext Context for this TranscriptionInstance */ protected function proxy(): TranscriptionContext { if (!$this->context) { $this->context = new TranscriptionContext( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the TranscriptionInstance * * @return TranscriptionInstance Fetched TranscriptionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TranscriptionInstance { return $this->proxy()->fetch(); } /** * Delete the TranscriptionInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.TranscriptionInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/CallList.php000064400000024452150515725670014600 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Calls.json'; } /** * Create the CallInstance * * @param string $to Phone number, SIP address, or client identifier to call * @param string $from Twilio number from which to originate the call * @param array|Options $options Optional Arguments * @return CallInstance Created CallInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $to, string $from, array $options = []): CallInstance { $options = new Values($options); $data = Values::of([ 'To' => $to, 'From' => $from, 'Url' => $options['url'], 'Twiml' => $options['twiml'], 'ApplicationSid' => $options['applicationSid'], 'Method' => $options['method'], 'FallbackUrl' => $options['fallbackUrl'], 'FallbackMethod' => $options['fallbackMethod'], 'StatusCallback' => $options['statusCallback'], 'StatusCallbackEvent' => Serialize::map($options['statusCallbackEvent'], function($e) { return $e; }), 'StatusCallbackMethod' => $options['statusCallbackMethod'], 'SendDigits' => $options['sendDigits'], 'Timeout' => $options['timeout'], 'Record' => Serialize::booleanToString($options['record']), 'RecordingChannels' => $options['recordingChannels'], 'RecordingStatusCallback' => $options['recordingStatusCallback'], 'RecordingStatusCallbackMethod' => $options['recordingStatusCallbackMethod'], 'SipAuthUsername' => $options['sipAuthUsername'], 'SipAuthPassword' => $options['sipAuthPassword'], 'MachineDetection' => $options['machineDetection'], 'MachineDetectionTimeout' => $options['machineDetectionTimeout'], 'RecordingStatusCallbackEvent' => Serialize::map($options['recordingStatusCallbackEvent'], function($e) { return $e; }), 'Trim' => $options['trim'], 'CallerId' => $options['callerId'], 'MachineDetectionSpeechThreshold' => $options['machineDetectionSpeechThreshold'], 'MachineDetectionSpeechEndThreshold' => $options['machineDetectionSpeechEndThreshold'], 'MachineDetectionSilenceTimeout' => $options['machineDetectionSilenceTimeout'], 'AsyncAmd' => $options['asyncAmd'], 'AsyncAmdStatusCallback' => $options['asyncAmdStatusCallback'], 'AsyncAmdStatusCallbackMethod' => $options['asyncAmdStatusCallbackMethod'], 'Byoc' => $options['byoc'], 'CallReason' => $options['callReason'], 'CallToken' => $options['callToken'], 'RecordingTrack' => $options['recordingTrack'], 'TimeLimit' => $options['timeLimit'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new CallInstance($this->version, $payload, $this->solution['accountSid']); } /** * Streams CallInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads CallInstance 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 CallInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of CallInstance 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 CallPage Page of CallInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): CallPage { $options = new Values($options); $params = Values::of([ 'To' => $options['to'], 'From' => $options['from'], 'ParentCallSid' => $options['parentCallSid'], 'Status' => $options['status'], 'StartTime<' => Serialize::iso8601DateTime($options['startTimeBefore']), 'StartTime' => Serialize::iso8601DateTime($options['startTime']), 'StartTime>' => Serialize::iso8601DateTime($options['startTimeAfter']), 'EndTime<' => Serialize::iso8601DateTime($options['endTimeBefore']), 'EndTime' => Serialize::iso8601DateTime($options['endTime']), 'EndTime>' => Serialize::iso8601DateTime($options['endTimeAfter']), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new CallPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of CallInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return CallPage Page of CallInstance */ public function getPage(string $targetUrl): CallPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new CallPage($this->version, $response, $this->solution); } /** * Access the feedbackSummaries */ protected function getFeedbackSummaries(): FeedbackSummaryList { if (!$this->_feedbackSummaries) { $this->_feedbackSummaries = new FeedbackSummaryList($this->version, $this->solution['accountSid']); } return $this->_feedbackSummaries; } /** * Constructs a CallContext * * @param string $sid The SID of the Call resource to fetch */ public function getContext(string $sid): CallContext { return new CallContext($this->version, $this->solution['accountSid'], $sid); } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return \Twilio\ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Api.V2010.CallList]'; } }src/Twilio/Rest/Api/V2010/Account/ConnectAppOptions.php000064400000016255150515725670016501 0ustar00options['authorizeRedirectUrl'] = $authorizeRedirectUrl; $this->options['companyName'] = $companyName; $this->options['deauthorizeCallbackMethod'] = $deauthorizeCallbackMethod; $this->options['deauthorizeCallbackUrl'] = $deauthorizeCallbackUrl; $this->options['description'] = $description; $this->options['friendlyName'] = $friendlyName; $this->options['homepageUrl'] = $homepageUrl; $this->options['permissions'] = $permissions; } /** * The URL to redirect the user to after we authenticate the user and obtain authorization to access the Connect App. * * @param string $authorizeRedirectUrl The URL to redirect the user to after * authorization * @return $this Fluent Builder */ public function setAuthorizeRedirectUrl(string $authorizeRedirectUrl): self { $this->options['authorizeRedirectUrl'] = $authorizeRedirectUrl; return $this; } /** * The company name to set for the Connect App. * * @param string $companyName The company name to set for the Connect App * @return $this Fluent Builder */ public function setCompanyName(string $companyName): self { $this->options['companyName'] = $companyName; return $this; } /** * The HTTP method to use when calling `deauthorize_callback_url`. * * @param string $deauthorizeCallbackMethod The HTTP method to use when calling * deauthorize_callback_url * @return $this Fluent Builder */ public function setDeauthorizeCallbackMethod(string $deauthorizeCallbackMethod): self { $this->options['deauthorizeCallbackMethod'] = $deauthorizeCallbackMethod; return $this; } /** * The URL to call using the `deauthorize_callback_method` to de-authorize the Connect App. * * @param string $deauthorizeCallbackUrl The URL to call to de-authorize the * Connect App * @return $this Fluent Builder */ public function setDeauthorizeCallbackUrl(string $deauthorizeCallbackUrl): self { $this->options['deauthorizeCallbackUrl'] = $deauthorizeCallbackUrl; return $this; } /** * A description of the Connect App. * * @param string $description A description of the Connect App * @return $this Fluent Builder */ public function setDescription(string $description): self { $this->options['description'] = $description; return $this; } /** * A descriptive string that you create to describe the resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * A public URL where users can obtain more information about this Connect App. * * @param string $homepageUrl A public URL where users can obtain more * information * @return $this Fluent Builder */ public function setHomepageUrl(string $homepageUrl): self { $this->options['homepageUrl'] = $homepageUrl; return $this; } /** * A comma-separated list of the permissions you will request from the users of this ConnectApp. Can include: `get-all` and `post-all`. * * @param string[] $permissions The set of permissions that your ConnectApp * will request * @return $this Fluent Builder */ public function setPermissions(array $permissions): self { $this->options['permissions'] = $permissions; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.UpdateConnectAppOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/SigningKeyContext.php000064400000005221150515725670016476 0ustar00solution = ['accountSid' => $accountSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/SigningKeys/' . \rawurlencode($sid) . '.json'; } /** * Fetch the SigningKeyInstance * * @return SigningKeyInstance Fetched SigningKeyInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SigningKeyInstance { $payload = $this->version->fetch('GET', $this->uri); return new SigningKeyInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Update the SigningKeyInstance * * @param array|Options $options Optional Arguments * @return SigningKeyInstance Updated SigningKeyInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SigningKeyInstance { $options = new Values($options); $data = Values::of(['FriendlyName' => $options['friendlyName'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new SigningKeyInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Delete the SigningKeyInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.SigningKeyContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/MessageInstance.php000064400000013440150515725670016135 0ustar00properties = [ 'body' => Values::array_get($payload, 'body'), 'numSegments' => Values::array_get($payload, 'num_segments'), 'direction' => Values::array_get($payload, 'direction'), 'from' => Values::array_get($payload, 'from'), 'to' => Values::array_get($payload, 'to'), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'price' => Values::array_get($payload, 'price'), 'errorMessage' => Values::array_get($payload, 'error_message'), 'uri' => Values::array_get($payload, 'uri'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'numMedia' => Values::array_get($payload, 'num_media'), 'status' => Values::array_get($payload, 'status'), 'messagingServiceSid' => Values::array_get($payload, 'messaging_service_sid'), 'sid' => Values::array_get($payload, 'sid'), 'dateSent' => Deserialize::dateTime(Values::array_get($payload, 'date_sent')), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'errorCode' => Values::array_get($payload, 'error_code'), 'priceUnit' => Values::array_get($payload, 'price_unit'), 'apiVersion' => Values::array_get($payload, 'api_version'), 'subresourceUris' => Values::array_get($payload, 'subresource_uris'), ]; $this->solution = ['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 MessageContext Context for this MessageInstance */ protected function proxy(): MessageContext { if (!$this->context) { $this->context = new MessageContext( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->context; } /** * Delete the MessageInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Fetch the MessageInstance * * @return MessageInstance Fetched MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MessageInstance { return $this->proxy()->fetch(); } /** * Update the MessageInstance * * @param array|Options $options Optional Arguments * @return MessageInstance Updated MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): MessageInstance { return $this->proxy()->update($options); } /** * Access the media */ protected function getMedia(): MediaList { return $this->proxy()->media; } /** * Access the feedback */ protected function getFeedback(): FeedbackList { return $this->proxy()->feedback; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.MessageInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/MessageList.php000064400000016176150515725670015315 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Messages.json'; } /** * Create the MessageInstance * * @param string $to The destination phone number * @param array|Options $options Optional Arguments * @return MessageInstance Created MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $to, array $options = []): MessageInstance { $options = new Values($options); $data = Values::of([ 'To' => $to, 'From' => $options['from'], 'MessagingServiceSid' => $options['messagingServiceSid'], 'Body' => $options['body'], 'MediaUrl' => Serialize::map($options['mediaUrl'], function($e) { return $e; }), 'StatusCallback' => $options['statusCallback'], 'ApplicationSid' => $options['applicationSid'], 'MaxPrice' => $options['maxPrice'], 'ProvideFeedback' => Serialize::booleanToString($options['provideFeedback']), 'Attempt' => $options['attempt'], 'ValidityPeriod' => $options['validityPeriod'], 'ForceDelivery' => Serialize::booleanToString($options['forceDelivery']), 'ContentRetention' => $options['contentRetention'], 'AddressRetention' => $options['addressRetention'], 'SmartEncoded' => Serialize::booleanToString($options['smartEncoded']), 'PersistentAction' => Serialize::map($options['persistentAction'], function($e) { return $e; }), 'SendAsMms' => Serialize::booleanToString($options['sendAsMms']), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new MessageInstance($this->version, $payload, $this->solution['accountSid']); } /** * Streams MessageInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads MessageInstance 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 MessageInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of MessageInstance 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 MessagePage Page of MessageInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): MessagePage { $options = new Values($options); $params = Values::of([ 'To' => $options['to'], 'From' => $options['from'], 'DateSent<' => Serialize::iso8601DateTime($options['dateSentBefore']), 'DateSent' => Serialize::iso8601DateTime($options['dateSent']), 'DateSent>' => Serialize::iso8601DateTime($options['dateSentAfter']), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new MessagePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of MessageInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return MessagePage Page of MessageInstance */ public function getPage(string $targetUrl): MessagePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new MessagePage($this->version, $response, $this->solution); } /** * Constructs a MessageContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): MessageContext { return new MessageContext($this->version, $this->solution['accountSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.MessageList]'; } }src/Twilio/Rest/Api/V2010/Account/ConferenceList.php000064400000013343150515725670015771 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Conferences.json'; } /** * Streams ConferenceInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ConferenceInstance 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 ConferenceInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of ConferenceInstance 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 ConferencePage Page of ConferenceInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ConferencePage { $options = new Values($options); $params = Values::of([ 'DateCreated<' => Serialize::iso8601Date($options['dateCreatedBefore']), 'DateCreated' => Serialize::iso8601Date($options['dateCreated']), 'DateCreated>' => Serialize::iso8601Date($options['dateCreatedAfter']), 'DateUpdated<' => Serialize::iso8601Date($options['dateUpdatedBefore']), 'DateUpdated' => Serialize::iso8601Date($options['dateUpdated']), 'DateUpdated>' => Serialize::iso8601Date($options['dateUpdatedAfter']), 'FriendlyName' => $options['friendlyName'], 'Status' => $options['status'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ConferencePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ConferenceInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ConferencePage Page of ConferenceInstance */ public function getPage(string $targetUrl): ConferencePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ConferencePage($this->version, $response, $this->solution); } /** * Constructs a ConferenceContext * * @param string $sid The unique string that identifies this resource */ public function getContext(string $sid): ConferenceContext { return new ConferenceContext($this->version, $this->solution['accountSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.ConferenceList]'; } }src/Twilio/Rest/Api/V2010/Account/RecordingList.php000064400000012746150515725670015644 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Recordings.json'; } /** * Streams RecordingInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads RecordingInstance 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 RecordingInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of RecordingInstance 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 RecordingPage Page of RecordingInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): RecordingPage { $options = new Values($options); $params = Values::of([ 'DateCreated<' => Serialize::iso8601DateTime($options['dateCreatedBefore']), 'DateCreated' => Serialize::iso8601DateTime($options['dateCreated']), 'DateCreated>' => Serialize::iso8601DateTime($options['dateCreatedAfter']), 'CallSid' => $options['callSid'], 'ConferenceSid' => $options['conferenceSid'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new RecordingPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of RecordingInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return RecordingPage Page of RecordingInstance */ public function getPage(string $targetUrl): RecordingPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new RecordingPage($this->version, $response, $this->solution); } /** * Constructs a RecordingContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): RecordingContext { return new RecordingContext($this->version, $this->solution['accountSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.RecordingList]'; } }src/Twilio/Rest/Api/V2010/Account/KeyPage.php000064400000002220150515725670014403 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return KeyInstance \Twilio\Rest\Api\V2010\Account\KeyInstance */ public function buildInstance(array $payload): KeyInstance { return new KeyInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.KeyPage]'; } }src/Twilio/Rest/Api/V2010/Account/ApplicationContext.php000064400000007253150515725670016701 0ustar00solution = ['accountSid' => $accountSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Applications/' . \rawurlencode($sid) . '.json'; } /** * Delete the ApplicationInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Fetch the ApplicationInstance * * @return ApplicationInstance Fetched ApplicationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ApplicationInstance { $payload = $this->version->fetch('GET', $this->uri); 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 * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ApplicationInstance { $options = new Values($options); $data = Values::of([ '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, [], $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.ApplicationContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/NotificationList.php000064400000012724150515725670016352 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Notifications.json'; } /** * Streams NotificationInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads NotificationInstance 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 NotificationInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of NotificationInstance 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 NotificationPage Page of NotificationInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): NotificationPage { $options = new Values($options); $params = Values::of([ 'Log' => $options['log'], 'MessageDate<' => Serialize::iso8601Date($options['messageDateBefore']), 'MessageDate' => Serialize::iso8601Date($options['messageDate']), 'MessageDate>' => Serialize::iso8601Date($options['messageDateAfter']), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new NotificationPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of NotificationInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return NotificationPage Page of NotificationInstance */ public function getPage(string $targetUrl): NotificationPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new NotificationPage($this->version, $response, $this->solution); } /** * Constructs a NotificationContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): NotificationContext { return new NotificationContext($this->version, $this->solution['accountSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.NotificationList]'; } }src/Twilio/Rest/Api/V2010/Account/ApplicationOptions.php000064400000064723150515725670016715 0ustar00options['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; $this->options['friendlyName'] = $friendlyName; } /** * The API version to use to start a new TwiML session. Can be: `2010-04-01` or `2008-08-01`. The default value is the account's default API version. * * @param string $apiVersion The API version to use to start a new TwiML session * @return $this Fluent Builder */ public function setApiVersion(string $apiVersion): self { $this->options['apiVersion'] = $apiVersion; return $this; } /** * The URL we should call when the phone number assigned to this application receives a call. * * @param string $voiceUrl The URL to call when the phone number receives a call * @return $this Fluent Builder */ public function setVoiceUrl(string $voiceUrl): self { $this->options['voiceUrl'] = $voiceUrl; return $this; } /** * The HTTP method we should use to call `voice_url`. Can be: `GET` or `POST`. * * @param string $voiceMethod The HTTP method to use with the voice_url * @return $this Fluent Builder */ public function setVoiceMethod(string $voiceMethod): self { $this->options['voiceMethod'] = $voiceMethod; return $this; } /** * The URL that we should call when an error occurs retrieving or executing the TwiML requested by `url`. * * @param string $voiceFallbackUrl The URL to call when a TwiML error occurs * @return $this Fluent Builder */ public function setVoiceFallbackUrl(string $voiceFallbackUrl): self { $this->options['voiceFallbackUrl'] = $voiceFallbackUrl; return $this; } /** * The HTTP method we should use to call `voice_fallback_url`. Can be: `GET` or `POST`. * * @param string $voiceFallbackMethod The HTTP method to use with * voice_fallback_url * @return $this Fluent Builder */ public function setVoiceFallbackMethod(string $voiceFallbackMethod): self { $this->options['voiceFallbackMethod'] = $voiceFallbackMethod; return $this; } /** * The URL we should call using the `status_callback_method` to send status information to your application. * * @param string $statusCallback The URL to send status information to your * application * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST`. * * @param string $statusCallbackMethod The HTTP method to use to call * status_callback * @return $this Fluent Builder */ public function setStatusCallbackMethod(string $statusCallbackMethod): self { $this->options['statusCallbackMethod'] = $statusCallbackMethod; return $this; } /** * Whether we should look up the caller's caller-ID name from the CNAM database (additional charges apply). Can be: `true` or `false`. * * @param bool $voiceCallerIdLookup Whether to lookup the caller's name * @return $this Fluent Builder */ public function setVoiceCallerIdLookup(bool $voiceCallerIdLookup): self { $this->options['voiceCallerIdLookup'] = $voiceCallerIdLookup; return $this; } /** * The URL we should call when the phone number receives an incoming SMS message. * * @param string $smsUrl The URL to call when the phone number receives an * incoming SMS message * @return $this Fluent Builder */ public function setSmsUrl(string $smsUrl): self { $this->options['smsUrl'] = $smsUrl; return $this; } /** * The HTTP method we should use to call `sms_url`. Can be: `GET` or `POST`. * * @param string $smsMethod The HTTP method to use with sms_url * @return $this Fluent Builder */ public function setSmsMethod(string $smsMethod): self { $this->options['smsMethod'] = $smsMethod; return $this; } /** * The URL that we should call when an error occurs while retrieving or executing the TwiML from `sms_url`. * * @param string $smsFallbackUrl The URL to call when an error occurs while * retrieving or executing the TwiML * @return $this Fluent Builder */ public function setSmsFallbackUrl(string $smsFallbackUrl): self { $this->options['smsFallbackUrl'] = $smsFallbackUrl; return $this; } /** * The HTTP method we should use to call `sms_fallback_url`. Can be: `GET` or `POST`. * * @param string $smsFallbackMethod The HTTP method to use with sms_fallback_url * @return $this Fluent Builder */ public function setSmsFallbackMethod(string $smsFallbackMethod): self { $this->options['smsFallbackMethod'] = $smsFallbackMethod; return $this; } /** * The URL we should call using a POST method to send status information about SMS messages sent by the application. * * @param string $smsStatusCallback The URL to send status information to your * application * @return $this Fluent Builder */ public function setSmsStatusCallback(string $smsStatusCallback): self { $this->options['smsStatusCallback'] = $smsStatusCallback; return $this; } /** * The URL we should call using a POST method to send message status information to your application. * * @param string $messageStatusCallback The URL to send message status * information to your application * @return $this Fluent Builder */ public function setMessageStatusCallback(string $messageStatusCallback): self { $this->options['messageStatusCallback'] = $messageStatusCallback; return $this; } /** * A descriptive string that you create to describe the new application. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the new resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.CreateApplicationOptions ' . $options . ']'; } } class ReadApplicationOptions extends Options { /** * @param string $friendlyName The string that identifies the Application * resources to read */ public function __construct(string $friendlyName = Values::NONE) { $this->options['friendlyName'] = $friendlyName; } /** * The string that identifies the Application resources to read. * * @param string $friendlyName The string that identifies the Application * resources to read * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadApplicationOptions ' . $options . ']'; } } class UpdateApplicationOptions extends Options { /** * @param string $friendlyName A string to describe the resource * @param string $apiVersion The API version to use to start a new TwiML session * @param string $voiceUrl The URL to call when the phone number receives a call * @param string $voiceMethod The HTTP method to use with the voice_url * @param string $voiceFallbackUrl The URL to call when a TwiML error occurs * @param string $voiceFallbackMethod The HTTP method to use with * voice_fallback_url * @param string $statusCallback The URL to send status information to your * application * @param string $statusCallbackMethod The HTTP method to use to call * status_callback * @param bool $voiceCallerIdLookup Whether to lookup the caller's name * @param string $smsUrl The URL to call when the phone number receives an * incoming SMS message * @param string $smsMethod The HTTP method to use with sms_url * @param string $smsFallbackUrl The URL to call when an error occurs while * retrieving or executing the TwiML * @param string $smsFallbackMethod The HTTP method to use with sms_fallback_url * @param string $smsStatusCallback Same as message_status_callback. * Deprecated, included for backwards * compatibility. * @param string $messageStatusCallback The URL to send message status * information to your application */ public function __construct(string $friendlyName = Values::NONE, string $apiVersion = Values::NONE, string $voiceUrl = Values::NONE, string $voiceMethod = Values::NONE, string $voiceFallbackUrl = Values::NONE, string $voiceFallbackMethod = Values::NONE, string $statusCallback = Values::NONE, string $statusCallbackMethod = Values::NONE, bool $voiceCallerIdLookup = Values::NONE, string $smsUrl = Values::NONE, string $smsMethod = Values::NONE, string $smsFallbackUrl = Values::NONE, string $smsFallbackMethod = Values::NONE, string $smsStatusCallback = Values::NONE, string $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 descriptive string that you create to describe the resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The API version to use to start a new TwiML session. Can be: `2010-04-01` or `2008-08-01`. The default value is your account's default API version. * * @param string $apiVersion The API version to use to start a new TwiML session * @return $this Fluent Builder */ public function setApiVersion(string $apiVersion): self { $this->options['apiVersion'] = $apiVersion; return $this; } /** * The URL we should call when the phone number assigned to this application receives a call. * * @param string $voiceUrl The URL to call when the phone number receives a call * @return $this Fluent Builder */ public function setVoiceUrl(string $voiceUrl): self { $this->options['voiceUrl'] = $voiceUrl; return $this; } /** * The HTTP method we should use to call `voice_url`. Can be: `GET` or `POST`. * * @param string $voiceMethod The HTTP method to use with the voice_url * @return $this Fluent Builder */ public function setVoiceMethod(string $voiceMethod): self { $this->options['voiceMethod'] = $voiceMethod; return $this; } /** * The URL that we should call when an error occurs retrieving or executing the TwiML requested by `url`. * * @param string $voiceFallbackUrl The URL to call when a TwiML error occurs * @return $this Fluent Builder */ public function setVoiceFallbackUrl(string $voiceFallbackUrl): self { $this->options['voiceFallbackUrl'] = $voiceFallbackUrl; return $this; } /** * The HTTP method we should use to call `voice_fallback_url`. Can be: `GET` or `POST`. * * @param string $voiceFallbackMethod The HTTP method to use with * voice_fallback_url * @return $this Fluent Builder */ public function setVoiceFallbackMethod(string $voiceFallbackMethod): self { $this->options['voiceFallbackMethod'] = $voiceFallbackMethod; return $this; } /** * The URL we should call using the `status_callback_method` to send status information to your application. * * @param string $statusCallback The URL to send status information to your * application * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST`. * * @param string $statusCallbackMethod The HTTP method to use to call * status_callback * @return $this Fluent Builder */ public function setStatusCallbackMethod(string $statusCallbackMethod): self { $this->options['statusCallbackMethod'] = $statusCallbackMethod; return $this; } /** * Whether we should look up the caller's caller-ID name from the CNAM database (additional charges apply). Can be: `true` or `false`. * * @param bool $voiceCallerIdLookup Whether to lookup the caller's name * @return $this Fluent Builder */ public function setVoiceCallerIdLookup(bool $voiceCallerIdLookup): self { $this->options['voiceCallerIdLookup'] = $voiceCallerIdLookup; return $this; } /** * The URL we should call when the phone number receives an incoming SMS message. * * @param string $smsUrl The URL to call when the phone number receives an * incoming SMS message * @return $this Fluent Builder */ public function setSmsUrl(string $smsUrl): self { $this->options['smsUrl'] = $smsUrl; return $this; } /** * The HTTP method we should use to call `sms_url`. Can be: `GET` or `POST`. * * @param string $smsMethod The HTTP method to use with sms_url * @return $this Fluent Builder */ public function setSmsMethod(string $smsMethod): self { $this->options['smsMethod'] = $smsMethod; return $this; } /** * The URL that we should call when an error occurs while retrieving or executing the TwiML from `sms_url`. * * @param string $smsFallbackUrl The URL to call when an error occurs while * retrieving or executing the TwiML * @return $this Fluent Builder */ public function setSmsFallbackUrl(string $smsFallbackUrl): self { $this->options['smsFallbackUrl'] = $smsFallbackUrl; return $this; } /** * The HTTP method we should use to call `sms_fallback_url`. Can be: `GET` or `POST`. * * @param string $smsFallbackMethod The HTTP method to use with sms_fallback_url * @return $this Fluent Builder */ public function setSmsFallbackMethod(string $smsFallbackMethod): self { $this->options['smsFallbackMethod'] = $smsFallbackMethod; return $this; } /** * Same as message_status_callback: The URL we should call using a POST method to send status information about SMS messages sent by the application. Deprecated, included for backwards compatibility. * * @param string $smsStatusCallback Same as message_status_callback. * Deprecated, included for backwards * compatibility. * @return $this Fluent Builder */ public function setSmsStatusCallback(string $smsStatusCallback): self { $this->options['smsStatusCallback'] = $smsStatusCallback; return $this; } /** * The URL we should call using a POST method to send message status information to your application. * * @param string $messageStatusCallback The URL to send message status * information to your application * @return $this Fluent Builder */ public function setMessageStatusCallback(string $messageStatusCallback): self { $this->options['messageStatusCallback'] = $messageStatusCallback; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.UpdateApplicationOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/Address/DependentPhoneNumberInstance.php000064400000011345150515725670022211 0ustar00properties = [ '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 = ['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(string $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(): string { return '[Twilio.Api.V2010.DependentPhoneNumberInstance]'; } }src/Twilio/Rest/Api/V2010/Account/Address/DependentPhoneNumberList.php000064400000011530150515725670021354 0ustar00solution = ['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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $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(int $limit = null, $pageSize = null): array { 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 DependentPhoneNumberPage Page of DependentPhoneNumberInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): DependentPhoneNumberPage { $params = Values::of(['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 DependentPhoneNumberPage Page of DependentPhoneNumberInstance */ public function getPage(string $targetUrl): DependentPhoneNumberPage { $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(): string { return '[Twilio.Api.V2010.DependentPhoneNumberList]'; } }src/Twilio/Rest/Api/V2010/Account/Address/DependentPhoneNumberPage.php000064400000002537150515725670021324 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return DependentPhoneNumberInstance \Twilio\Rest\Api\V2010\Account\Address\DependentPhoneNumberInstance */ public function buildInstance(array $payload): DependentPhoneNumberInstance { return new DependentPhoneNumberInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['addressSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.DependentPhoneNumberPage]'; } }src/Twilio/Rest/Api/V2010/Account/ConferenceOptions.php000064400000025465150515725670016521 0ustar00options['dateCreatedBefore'] = $dateCreatedBefore; $this->options['dateCreated'] = $dateCreated; $this->options['dateCreatedAfter'] = $dateCreatedAfter; $this->options['dateUpdatedBefore'] = $dateUpdatedBefore; $this->options['dateUpdated'] = $dateUpdated; $this->options['dateUpdatedAfter'] = $dateUpdatedAfter; $this->options['friendlyName'] = $friendlyName; $this->options['status'] = $status; } /** * The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that started on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that started on or after midnight on a date, use `>=YYYY-MM-DD`. * * @param string $dateCreatedBefore The `YYYY-MM-DD` value of the resources to * read * @return $this Fluent Builder */ public function setDateCreatedBefore(string $dateCreatedBefore): self { $this->options['dateCreatedBefore'] = $dateCreatedBefore; return $this; } /** * The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that started on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that started on or after midnight on a date, use `>=YYYY-MM-DD`. * * @param string $dateCreated The `YYYY-MM-DD` value of the resources to read * @return $this Fluent Builder */ public function setDateCreated(string $dateCreated): self { $this->options['dateCreated'] = $dateCreated; return $this; } /** * The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that started on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that started on or after midnight on a date, use `>=YYYY-MM-DD`. * * @param string $dateCreatedAfter The `YYYY-MM-DD` value of the resources to * read * @return $this Fluent Builder */ public function setDateCreatedAfter(string $dateCreatedAfter): self { $this->options['dateCreatedAfter'] = $dateCreatedAfter; return $this; } /** * The `date_updated` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that were last updated on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that were last updated on or after midnight on a given date, use `>=YYYY-MM-DD`. * * @param string $dateUpdatedBefore The `YYYY-MM-DD` value of the resources to * read * @return $this Fluent Builder */ public function setDateUpdatedBefore(string $dateUpdatedBefore): self { $this->options['dateUpdatedBefore'] = $dateUpdatedBefore; return $this; } /** * The `date_updated` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that were last updated on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that were last updated on or after midnight on a given date, use `>=YYYY-MM-DD`. * * @param string $dateUpdated The `YYYY-MM-DD` value of the resources to read * @return $this Fluent Builder */ public function setDateUpdated(string $dateUpdated): self { $this->options['dateUpdated'] = $dateUpdated; return $this; } /** * The `date_updated` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that were last updated on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that were last updated on or after midnight on a given date, use `>=YYYY-MM-DD`. * * @param string $dateUpdatedAfter The `YYYY-MM-DD` value of the resources to * read * @return $this Fluent Builder */ public function setDateUpdatedAfter(string $dateUpdatedAfter): self { $this->options['dateUpdatedAfter'] = $dateUpdatedAfter; return $this; } /** * The string that identifies the Conference resources to read. * * @param string $friendlyName The string that identifies the Conference * resources to read * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The status of the resources to read. Can be: `init`, `in-progress`, or `completed`. * * @param string $status The status of the resources to read * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadConferenceOptions ' . $options . ']'; } } class UpdateConferenceOptions extends Options { /** * @param string $status The new status of the resource * @param string $announceUrl The URL we should call to announce something into * the conference * @param string $announceMethod he HTTP method used to call announce_url */ public function __construct(string $status = Values::NONE, string $announceUrl = Values::NONE, string $announceMethod = Values::NONE) { $this->options['status'] = $status; $this->options['announceUrl'] = $announceUrl; $this->options['announceMethod'] = $announceMethod; } /** * The new status of the resource. Can be: Can be: `init`, `in-progress`, or `completed`. Specifying `completed` will end the conference and hang up all participants * * @param string $status The new status of the resource * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * The URL we should call to announce something into the conference. The URL can return an MP3, a WAV, or a TwiML document with `` or ``. * * @param string $announceUrl The URL we should call to announce something into * the conference * @return $this Fluent Builder */ public function setAnnounceUrl(string $announceUrl): self { $this->options['announceUrl'] = $announceUrl; return $this; } /** * The HTTP method used to call `announce_url`. Can be: `GET` or `POST` and the default is `POST` * * @param string $announceMethod he HTTP method used to call announce_url * @return $this Fluent Builder */ public function setAnnounceMethod(string $announceMethod): self { $this->options['announceMethod'] = $announceMethod; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.UpdateConferenceOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/Call/FeedbackOptions.php000064400000007073150515725670017004 0ustar00options['issue'] = $issue; } /** * A list of one or more issues experienced during the call. Issues can be: `imperfect-audio`, `dropped-call`, `incorrect-caller-id`, `post-dial-delay`, `digits-not-captured`, `audio-latency`, `unsolicited-call`, or `one-way-audio`. * * @param string[] $issue Issues experienced during the call * @return $this Fluent Builder */ public function setIssue(array $issue): self { $this->options['issue'] = $issue; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.CreateFeedbackOptions ' . $options . ']'; } } class UpdateFeedbackOptions extends Options { /** * @param int $qualityScore The call quality expressed as an integer from 1 to 5 * @param string[] $issue Issues experienced during the call */ public function __construct(int $qualityScore = Values::NONE, array $issue = Values::ARRAY_NONE) { $this->options['qualityScore'] = $qualityScore; $this->options['issue'] = $issue; } /** * The call quality expressed as an integer from `1` to `5` where `1` represents very poor call quality and `5` represents a perfect call. * * @param int $qualityScore The call quality expressed as an integer from 1 to 5 * @return $this Fluent Builder */ public function setQualityScore(int $qualityScore): self { $this->options['qualityScore'] = $qualityScore; return $this; } /** * One or more issues experienced during the call. The issues can be: `imperfect-audio`, `dropped-call`, `incorrect-caller-id`, `post-dial-delay`, `digits-not-captured`, `audio-latency`, `unsolicited-call`, or `one-way-audio`. * * @param string[] $issue Issues experienced during the call * @return $this Fluent Builder */ public function setIssue(array $issue): self { $this->options['issue'] = $issue; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.UpdateFeedbackOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/Call/FeedbackSummaryInstance.php000064400000011376150515725670020474 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'callCount' => Values::array_get($payload, 'call_count'), 'callFeedbackCount' => Values::array_get($payload, 'call_feedback_count'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'endDate' => Deserialize::dateTime(Values::array_get($payload, 'end_date')), 'includeSubaccounts' => Values::array_get($payload, 'include_subaccounts'), 'issues' => Values::array_get($payload, 'issues'), 'qualityScoreAverage' => Values::array_get($payload, 'quality_score_average'), 'qualityScoreMedian' => Values::array_get($payload, 'quality_score_median'), 'qualityScoreStandardDeviation' => Values::array_get($payload, 'quality_score_standard_deviation'), 'sid' => Values::array_get($payload, 'sid'), 'startDate' => Deserialize::dateTime(Values::array_get($payload, 'start_date')), 'status' => Values::array_get($payload, 'status'), ]; $this->solution = ['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 FeedbackSummaryContext Context for this FeedbackSummaryInstance */ protected function proxy(): FeedbackSummaryContext { if (!$this->context) { $this->context = new FeedbackSummaryContext( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the FeedbackSummaryInstance * * @return FeedbackSummaryInstance Fetched FeedbackSummaryInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FeedbackSummaryInstance { return $this->proxy()->fetch(); } /** * Delete the FeedbackSummaryInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.FeedbackSummaryInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Call/NotificationPage.php000064400000002446150515725670017166 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return NotificationInstance \Twilio\Rest\Api\V2010\Account\Call\NotificationInstance */ public function buildInstance(array $payload): NotificationInstance { return new NotificationInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['callSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.NotificationPage]'; } }src/Twilio/Rest/Api/V2010/Account/Call/SiprecList.php000064400000035400150515725670016020 0ustar00solution = ['accountSid' => $accountSid, 'callSid' => $callSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Calls/' . \rawurlencode($callSid) . '/Siprec.json'; } /** * Create the SiprecInstance * * @param array|Options $options Optional Arguments * @return SiprecInstance Created SiprecInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): SiprecInstance { $options = new Values($options); $data = Values::of([ 'Name' => $options['name'], 'ConnectorName' => $options['connectorName'], 'Track' => $options['track'], 'StatusCallback' => $options['statusCallback'], 'StatusCallbackMethod' => $options['statusCallbackMethod'], 'Parameter1.Name' => $options['parameter1Name'], 'Parameter1.Value' => $options['parameter1Value'], 'Parameter2.Name' => $options['parameter2Name'], 'Parameter2.Value' => $options['parameter2Value'], 'Parameter3.Name' => $options['parameter3Name'], 'Parameter3.Value' => $options['parameter3Value'], 'Parameter4.Name' => $options['parameter4Name'], 'Parameter4.Value' => $options['parameter4Value'], 'Parameter5.Name' => $options['parameter5Name'], 'Parameter5.Value' => $options['parameter5Value'], 'Parameter6.Name' => $options['parameter6Name'], 'Parameter6.Value' => $options['parameter6Value'], 'Parameter7.Name' => $options['parameter7Name'], 'Parameter7.Value' => $options['parameter7Value'], 'Parameter8.Name' => $options['parameter8Name'], 'Parameter8.Value' => $options['parameter8Value'], 'Parameter9.Name' => $options['parameter9Name'], 'Parameter9.Value' => $options['parameter9Value'], 'Parameter10.Name' => $options['parameter10Name'], 'Parameter10.Value' => $options['parameter10Value'], 'Parameter11.Name' => $options['parameter11Name'], 'Parameter11.Value' => $options['parameter11Value'], 'Parameter12.Name' => $options['parameter12Name'], 'Parameter12.Value' => $options['parameter12Value'], 'Parameter13.Name' => $options['parameter13Name'], 'Parameter13.Value' => $options['parameter13Value'], 'Parameter14.Name' => $options['parameter14Name'], 'Parameter14.Value' => $options['parameter14Value'], 'Parameter15.Name' => $options['parameter15Name'], 'Parameter15.Value' => $options['parameter15Value'], 'Parameter16.Name' => $options['parameter16Name'], 'Parameter16.Value' => $options['parameter16Value'], 'Parameter17.Name' => $options['parameter17Name'], 'Parameter17.Value' => $options['parameter17Value'], 'Parameter18.Name' => $options['parameter18Name'], 'Parameter18.Value' => $options['parameter18Value'], 'Parameter19.Name' => $options['parameter19Name'], 'Parameter19.Value' => $options['parameter19Value'], 'Parameter20.Name' => $options['parameter20Name'], 'Parameter20.Value' => $options['parameter20Value'], 'Parameter21.Name' => $options['parameter21Name'], 'Parameter21.Value' => $options['parameter21Value'], 'Parameter22.Name' => $options['parameter22Name'], 'Parameter22.Value' => $options['parameter22Value'], 'Parameter23.Name' => $options['parameter23Name'], 'Parameter23.Value' => $options['parameter23Value'], 'Parameter24.Name' => $options['parameter24Name'], 'Parameter24.Value' => $options['parameter24Value'], 'Parameter25.Name' => $options['parameter25Name'], 'Parameter25.Value' => $options['parameter25Value'], 'Parameter26.Name' => $options['parameter26Name'], 'Parameter26.Value' => $options['parameter26Value'], 'Parameter27.Name' => $options['parameter27Name'], 'Parameter27.Value' => $options['parameter27Value'], 'Parameter28.Name' => $options['parameter28Name'], 'Parameter28.Value' => $options['parameter28Value'], 'Parameter29.Name' => $options['parameter29Name'], 'Parameter29.Value' => $options['parameter29Value'], 'Parameter30.Name' => $options['parameter30Name'], 'Parameter30.Value' => $options['parameter30Value'], 'Parameter31.Name' => $options['parameter31Name'], 'Parameter31.Value' => $options['parameter31Value'], 'Parameter32.Name' => $options['parameter32Name'], 'Parameter32.Value' => $options['parameter32Value'], 'Parameter33.Name' => $options['parameter33Name'], 'Parameter33.Value' => $options['parameter33Value'], 'Parameter34.Name' => $options['parameter34Name'], 'Parameter34.Value' => $options['parameter34Value'], 'Parameter35.Name' => $options['parameter35Name'], 'Parameter35.Value' => $options['parameter35Value'], 'Parameter36.Name' => $options['parameter36Name'], 'Parameter36.Value' => $options['parameter36Value'], 'Parameter37.Name' => $options['parameter37Name'], 'Parameter37.Value' => $options['parameter37Value'], 'Parameter38.Name' => $options['parameter38Name'], 'Parameter38.Value' => $options['parameter38Value'], 'Parameter39.Name' => $options['parameter39Name'], 'Parameter39.Value' => $options['parameter39Value'], 'Parameter40.Name' => $options['parameter40Name'], 'Parameter40.Value' => $options['parameter40Value'], 'Parameter41.Name' => $options['parameter41Name'], 'Parameter41.Value' => $options['parameter41Value'], 'Parameter42.Name' => $options['parameter42Name'], 'Parameter42.Value' => $options['parameter42Value'], 'Parameter43.Name' => $options['parameter43Name'], 'Parameter43.Value' => $options['parameter43Value'], 'Parameter44.Name' => $options['parameter44Name'], 'Parameter44.Value' => $options['parameter44Value'], 'Parameter45.Name' => $options['parameter45Name'], 'Parameter45.Value' => $options['parameter45Value'], 'Parameter46.Name' => $options['parameter46Name'], 'Parameter46.Value' => $options['parameter46Value'], 'Parameter47.Name' => $options['parameter47Name'], 'Parameter47.Value' => $options['parameter47Value'], 'Parameter48.Name' => $options['parameter48Name'], 'Parameter48.Value' => $options['parameter48Value'], 'Parameter49.Name' => $options['parameter49Name'], 'Parameter49.Value' => $options['parameter49Value'], 'Parameter50.Name' => $options['parameter50Name'], 'Parameter50.Value' => $options['parameter50Value'], 'Parameter51.Name' => $options['parameter51Name'], 'Parameter51.Value' => $options['parameter51Value'], 'Parameter52.Name' => $options['parameter52Name'], 'Parameter52.Value' => $options['parameter52Value'], 'Parameter53.Name' => $options['parameter53Name'], 'Parameter53.Value' => $options['parameter53Value'], 'Parameter54.Name' => $options['parameter54Name'], 'Parameter54.Value' => $options['parameter54Value'], 'Parameter55.Name' => $options['parameter55Name'], 'Parameter55.Value' => $options['parameter55Value'], 'Parameter56.Name' => $options['parameter56Name'], 'Parameter56.Value' => $options['parameter56Value'], 'Parameter57.Name' => $options['parameter57Name'], 'Parameter57.Value' => $options['parameter57Value'], 'Parameter58.Name' => $options['parameter58Name'], 'Parameter58.Value' => $options['parameter58Value'], 'Parameter59.Name' => $options['parameter59Name'], 'Parameter59.Value' => $options['parameter59Value'], 'Parameter60.Name' => $options['parameter60Name'], 'Parameter60.Value' => $options['parameter60Value'], 'Parameter61.Name' => $options['parameter61Name'], 'Parameter61.Value' => $options['parameter61Value'], 'Parameter62.Name' => $options['parameter62Name'], 'Parameter62.Value' => $options['parameter62Value'], 'Parameter63.Name' => $options['parameter63Name'], 'Parameter63.Value' => $options['parameter63Value'], 'Parameter64.Name' => $options['parameter64Name'], 'Parameter64.Value' => $options['parameter64Value'], 'Parameter65.Name' => $options['parameter65Name'], 'Parameter65.Value' => $options['parameter65Value'], 'Parameter66.Name' => $options['parameter66Name'], 'Parameter66.Value' => $options['parameter66Value'], 'Parameter67.Name' => $options['parameter67Name'], 'Parameter67.Value' => $options['parameter67Value'], 'Parameter68.Name' => $options['parameter68Name'], 'Parameter68.Value' => $options['parameter68Value'], 'Parameter69.Name' => $options['parameter69Name'], 'Parameter69.Value' => $options['parameter69Value'], 'Parameter70.Name' => $options['parameter70Name'], 'Parameter70.Value' => $options['parameter70Value'], 'Parameter71.Name' => $options['parameter71Name'], 'Parameter71.Value' => $options['parameter71Value'], 'Parameter72.Name' => $options['parameter72Name'], 'Parameter72.Value' => $options['parameter72Value'], 'Parameter73.Name' => $options['parameter73Name'], 'Parameter73.Value' => $options['parameter73Value'], 'Parameter74.Name' => $options['parameter74Name'], 'Parameter74.Value' => $options['parameter74Value'], 'Parameter75.Name' => $options['parameter75Name'], 'Parameter75.Value' => $options['parameter75Value'], 'Parameter76.Name' => $options['parameter76Name'], 'Parameter76.Value' => $options['parameter76Value'], 'Parameter77.Name' => $options['parameter77Name'], 'Parameter77.Value' => $options['parameter77Value'], 'Parameter78.Name' => $options['parameter78Name'], 'Parameter78.Value' => $options['parameter78Value'], 'Parameter79.Name' => $options['parameter79Name'], 'Parameter79.Value' => $options['parameter79Value'], 'Parameter80.Name' => $options['parameter80Name'], 'Parameter80.Value' => $options['parameter80Value'], 'Parameter81.Name' => $options['parameter81Name'], 'Parameter81.Value' => $options['parameter81Value'], 'Parameter82.Name' => $options['parameter82Name'], 'Parameter82.Value' => $options['parameter82Value'], 'Parameter83.Name' => $options['parameter83Name'], 'Parameter83.Value' => $options['parameter83Value'], 'Parameter84.Name' => $options['parameter84Name'], 'Parameter84.Value' => $options['parameter84Value'], 'Parameter85.Name' => $options['parameter85Name'], 'Parameter85.Value' => $options['parameter85Value'], 'Parameter86.Name' => $options['parameter86Name'], 'Parameter86.Value' => $options['parameter86Value'], 'Parameter87.Name' => $options['parameter87Name'], 'Parameter87.Value' => $options['parameter87Value'], 'Parameter88.Name' => $options['parameter88Name'], 'Parameter88.Value' => $options['parameter88Value'], 'Parameter89.Name' => $options['parameter89Name'], 'Parameter89.Value' => $options['parameter89Value'], 'Parameter90.Name' => $options['parameter90Name'], 'Parameter90.Value' => $options['parameter90Value'], 'Parameter91.Name' => $options['parameter91Name'], 'Parameter91.Value' => $options['parameter91Value'], 'Parameter92.Name' => $options['parameter92Name'], 'Parameter92.Value' => $options['parameter92Value'], 'Parameter93.Name' => $options['parameter93Name'], 'Parameter93.Value' => $options['parameter93Value'], 'Parameter94.Name' => $options['parameter94Name'], 'Parameter94.Value' => $options['parameter94Value'], 'Parameter95.Name' => $options['parameter95Name'], 'Parameter95.Value' => $options['parameter95Value'], 'Parameter96.Name' => $options['parameter96Name'], 'Parameter96.Value' => $options['parameter96Value'], 'Parameter97.Name' => $options['parameter97Name'], 'Parameter97.Value' => $options['parameter97Value'], 'Parameter98.Name' => $options['parameter98Name'], 'Parameter98.Value' => $options['parameter98Value'], 'Parameter99.Name' => $options['parameter99Name'], 'Parameter99.Value' => $options['parameter99Value'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new SiprecInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['callSid'] ); } /** * Constructs a SiprecContext * * @param string $sid The SID of the Siprec resource, or the `name` */ public function getContext(string $sid): SiprecContext { return new SiprecContext( $this->version, $this->solution['accountSid'], $this->solution['callSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.SiprecList]'; } }src/Twilio/Rest/Api/V2010/Account/Call/FeedbackList.php000064400000002353150515725670016260 0ustar00solution = ['accountSid' => $accountSid, 'callSid' => $callSid, ]; } /** * Constructs a FeedbackContext */ public function getContext(): FeedbackContext { return new FeedbackContext( $this->version, $this->solution['accountSid'], $this->solution['callSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.FeedbackList]'; } }src/Twilio/Rest/Api/V2010/Account/Call/SiprecOptions.php000064400000344567150515725670016561 0ustar00options['name'] = $name; $this->options['connectorName'] = $connectorName; $this->options['track'] = $track; $this->options['statusCallback'] = $statusCallback; $this->options['statusCallbackMethod'] = $statusCallbackMethod; $this->options['parameter1Name'] = $parameter1Name; $this->options['parameter1Value'] = $parameter1Value; $this->options['parameter2Name'] = $parameter2Name; $this->options['parameter2Value'] = $parameter2Value; $this->options['parameter3Name'] = $parameter3Name; $this->options['parameter3Value'] = $parameter3Value; $this->options['parameter4Name'] = $parameter4Name; $this->options['parameter4Value'] = $parameter4Value; $this->options['parameter5Name'] = $parameter5Name; $this->options['parameter5Value'] = $parameter5Value; $this->options['parameter6Name'] = $parameter6Name; $this->options['parameter6Value'] = $parameter6Value; $this->options['parameter7Name'] = $parameter7Name; $this->options['parameter7Value'] = $parameter7Value; $this->options['parameter8Name'] = $parameter8Name; $this->options['parameter8Value'] = $parameter8Value; $this->options['parameter9Name'] = $parameter9Name; $this->options['parameter9Value'] = $parameter9Value; $this->options['parameter10Name'] = $parameter10Name; $this->options['parameter10Value'] = $parameter10Value; $this->options['parameter11Name'] = $parameter11Name; $this->options['parameter11Value'] = $parameter11Value; $this->options['parameter12Name'] = $parameter12Name; $this->options['parameter12Value'] = $parameter12Value; $this->options['parameter13Name'] = $parameter13Name; $this->options['parameter13Value'] = $parameter13Value; $this->options['parameter14Name'] = $parameter14Name; $this->options['parameter14Value'] = $parameter14Value; $this->options['parameter15Name'] = $parameter15Name; $this->options['parameter15Value'] = $parameter15Value; $this->options['parameter16Name'] = $parameter16Name; $this->options['parameter16Value'] = $parameter16Value; $this->options['parameter17Name'] = $parameter17Name; $this->options['parameter17Value'] = $parameter17Value; $this->options['parameter18Name'] = $parameter18Name; $this->options['parameter18Value'] = $parameter18Value; $this->options['parameter19Name'] = $parameter19Name; $this->options['parameter19Value'] = $parameter19Value; $this->options['parameter20Name'] = $parameter20Name; $this->options['parameter20Value'] = $parameter20Value; $this->options['parameter21Name'] = $parameter21Name; $this->options['parameter21Value'] = $parameter21Value; $this->options['parameter22Name'] = $parameter22Name; $this->options['parameter22Value'] = $parameter22Value; $this->options['parameter23Name'] = $parameter23Name; $this->options['parameter23Value'] = $parameter23Value; $this->options['parameter24Name'] = $parameter24Name; $this->options['parameter24Value'] = $parameter24Value; $this->options['parameter25Name'] = $parameter25Name; $this->options['parameter25Value'] = $parameter25Value; $this->options['parameter26Name'] = $parameter26Name; $this->options['parameter26Value'] = $parameter26Value; $this->options['parameter27Name'] = $parameter27Name; $this->options['parameter27Value'] = $parameter27Value; $this->options['parameter28Name'] = $parameter28Name; $this->options['parameter28Value'] = $parameter28Value; $this->options['parameter29Name'] = $parameter29Name; $this->options['parameter29Value'] = $parameter29Value; $this->options['parameter30Name'] = $parameter30Name; $this->options['parameter30Value'] = $parameter30Value; $this->options['parameter31Name'] = $parameter31Name; $this->options['parameter31Value'] = $parameter31Value; $this->options['parameter32Name'] = $parameter32Name; $this->options['parameter32Value'] = $parameter32Value; $this->options['parameter33Name'] = $parameter33Name; $this->options['parameter33Value'] = $parameter33Value; $this->options['parameter34Name'] = $parameter34Name; $this->options['parameter34Value'] = $parameter34Value; $this->options['parameter35Name'] = $parameter35Name; $this->options['parameter35Value'] = $parameter35Value; $this->options['parameter36Name'] = $parameter36Name; $this->options['parameter36Value'] = $parameter36Value; $this->options['parameter37Name'] = $parameter37Name; $this->options['parameter37Value'] = $parameter37Value; $this->options['parameter38Name'] = $parameter38Name; $this->options['parameter38Value'] = $parameter38Value; $this->options['parameter39Name'] = $parameter39Name; $this->options['parameter39Value'] = $parameter39Value; $this->options['parameter40Name'] = $parameter40Name; $this->options['parameter40Value'] = $parameter40Value; $this->options['parameter41Name'] = $parameter41Name; $this->options['parameter41Value'] = $parameter41Value; $this->options['parameter42Name'] = $parameter42Name; $this->options['parameter42Value'] = $parameter42Value; $this->options['parameter43Name'] = $parameter43Name; $this->options['parameter43Value'] = $parameter43Value; $this->options['parameter44Name'] = $parameter44Name; $this->options['parameter44Value'] = $parameter44Value; $this->options['parameter45Name'] = $parameter45Name; $this->options['parameter45Value'] = $parameter45Value; $this->options['parameter46Name'] = $parameter46Name; $this->options['parameter46Value'] = $parameter46Value; $this->options['parameter47Name'] = $parameter47Name; $this->options['parameter47Value'] = $parameter47Value; $this->options['parameter48Name'] = $parameter48Name; $this->options['parameter48Value'] = $parameter48Value; $this->options['parameter49Name'] = $parameter49Name; $this->options['parameter49Value'] = $parameter49Value; $this->options['parameter50Name'] = $parameter50Name; $this->options['parameter50Value'] = $parameter50Value; $this->options['parameter51Name'] = $parameter51Name; $this->options['parameter51Value'] = $parameter51Value; $this->options['parameter52Name'] = $parameter52Name; $this->options['parameter52Value'] = $parameter52Value; $this->options['parameter53Name'] = $parameter53Name; $this->options['parameter53Value'] = $parameter53Value; $this->options['parameter54Name'] = $parameter54Name; $this->options['parameter54Value'] = $parameter54Value; $this->options['parameter55Name'] = $parameter55Name; $this->options['parameter55Value'] = $parameter55Value; $this->options['parameter56Name'] = $parameter56Name; $this->options['parameter56Value'] = $parameter56Value; $this->options['parameter57Name'] = $parameter57Name; $this->options['parameter57Value'] = $parameter57Value; $this->options['parameter58Name'] = $parameter58Name; $this->options['parameter58Value'] = $parameter58Value; $this->options['parameter59Name'] = $parameter59Name; $this->options['parameter59Value'] = $parameter59Value; $this->options['parameter60Name'] = $parameter60Name; $this->options['parameter60Value'] = $parameter60Value; $this->options['parameter61Name'] = $parameter61Name; $this->options['parameter61Value'] = $parameter61Value; $this->options['parameter62Name'] = $parameter62Name; $this->options['parameter62Value'] = $parameter62Value; $this->options['parameter63Name'] = $parameter63Name; $this->options['parameter63Value'] = $parameter63Value; $this->options['parameter64Name'] = $parameter64Name; $this->options['parameter64Value'] = $parameter64Value; $this->options['parameter65Name'] = $parameter65Name; $this->options['parameter65Value'] = $parameter65Value; $this->options['parameter66Name'] = $parameter66Name; $this->options['parameter66Value'] = $parameter66Value; $this->options['parameter67Name'] = $parameter67Name; $this->options['parameter67Value'] = $parameter67Value; $this->options['parameter68Name'] = $parameter68Name; $this->options['parameter68Value'] = $parameter68Value; $this->options['parameter69Name'] = $parameter69Name; $this->options['parameter69Value'] = $parameter69Value; $this->options['parameter70Name'] = $parameter70Name; $this->options['parameter70Value'] = $parameter70Value; $this->options['parameter71Name'] = $parameter71Name; $this->options['parameter71Value'] = $parameter71Value; $this->options['parameter72Name'] = $parameter72Name; $this->options['parameter72Value'] = $parameter72Value; $this->options['parameter73Name'] = $parameter73Name; $this->options['parameter73Value'] = $parameter73Value; $this->options['parameter74Name'] = $parameter74Name; $this->options['parameter74Value'] = $parameter74Value; $this->options['parameter75Name'] = $parameter75Name; $this->options['parameter75Value'] = $parameter75Value; $this->options['parameter76Name'] = $parameter76Name; $this->options['parameter76Value'] = $parameter76Value; $this->options['parameter77Name'] = $parameter77Name; $this->options['parameter77Value'] = $parameter77Value; $this->options['parameter78Name'] = $parameter78Name; $this->options['parameter78Value'] = $parameter78Value; $this->options['parameter79Name'] = $parameter79Name; $this->options['parameter79Value'] = $parameter79Value; $this->options['parameter80Name'] = $parameter80Name; $this->options['parameter80Value'] = $parameter80Value; $this->options['parameter81Name'] = $parameter81Name; $this->options['parameter81Value'] = $parameter81Value; $this->options['parameter82Name'] = $parameter82Name; $this->options['parameter82Value'] = $parameter82Value; $this->options['parameter83Name'] = $parameter83Name; $this->options['parameter83Value'] = $parameter83Value; $this->options['parameter84Name'] = $parameter84Name; $this->options['parameter84Value'] = $parameter84Value; $this->options['parameter85Name'] = $parameter85Name; $this->options['parameter85Value'] = $parameter85Value; $this->options['parameter86Name'] = $parameter86Name; $this->options['parameter86Value'] = $parameter86Value; $this->options['parameter87Name'] = $parameter87Name; $this->options['parameter87Value'] = $parameter87Value; $this->options['parameter88Name'] = $parameter88Name; $this->options['parameter88Value'] = $parameter88Value; $this->options['parameter89Name'] = $parameter89Name; $this->options['parameter89Value'] = $parameter89Value; $this->options['parameter90Name'] = $parameter90Name; $this->options['parameter90Value'] = $parameter90Value; $this->options['parameter91Name'] = $parameter91Name; $this->options['parameter91Value'] = $parameter91Value; $this->options['parameter92Name'] = $parameter92Name; $this->options['parameter92Value'] = $parameter92Value; $this->options['parameter93Name'] = $parameter93Name; $this->options['parameter93Value'] = $parameter93Value; $this->options['parameter94Name'] = $parameter94Name; $this->options['parameter94Value'] = $parameter94Value; $this->options['parameter95Name'] = $parameter95Name; $this->options['parameter95Value'] = $parameter95Value; $this->options['parameter96Name'] = $parameter96Name; $this->options['parameter96Value'] = $parameter96Value; $this->options['parameter97Name'] = $parameter97Name; $this->options['parameter97Value'] = $parameter97Value; $this->options['parameter98Name'] = $parameter98Name; $this->options['parameter98Value'] = $parameter98Value; $this->options['parameter99Name'] = $parameter99Name; $this->options['parameter99Value'] = $parameter99Value; } /** * The user-specified name of this Siprec, if one was given when the Siprec was created. This may be used to stop the Siprec. * * @param string $name The name of this resource * @return $this Fluent Builder */ public function setName(string $name): self { $this->options['name'] = $name; return $this; } /** * Unique name used when configuring the connector via Marketplace Add-on. * * @param string $connectorName Unique name used when configuring the connector * via Marketplace Add-on. * @return $this Fluent Builder */ public function setConnectorName(string $connectorName): self { $this->options['connectorName'] = $connectorName; return $this; } /** * One of `inbound_track`, `outbound_track`, `both_tracks`. * * @param string $track One of `inbound_track`, `outbound_track`, `both_tracks`. * @return $this Fluent Builder */ public function setTrack(string $track): self { $this->options['track'] = $track; return $this; } /** * Absolute URL of the status callback. * * @param string $statusCallback Absolute URL of the status callback. * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * The http method for the status_callback (one of GET, POST). * * @param string $statusCallbackMethod The http method for the status_callback. * @return $this Fluent Builder */ public function setStatusCallbackMethod(string $statusCallbackMethod): self { $this->options['statusCallbackMethod'] = $statusCallbackMethod; return $this; } /** * Parameter name * * @param string $parameter1Name Parameter name * @return $this Fluent Builder */ public function setParameter1Name(string $parameter1Name): self { $this->options['parameter1Name'] = $parameter1Name; return $this; } /** * Parameter value * * @param string $parameter1Value Parameter value * @return $this Fluent Builder */ public function setParameter1Value(string $parameter1Value): self { $this->options['parameter1Value'] = $parameter1Value; return $this; } /** * Parameter name * * @param string $parameter2Name Parameter name * @return $this Fluent Builder */ public function setParameter2Name(string $parameter2Name): self { $this->options['parameter2Name'] = $parameter2Name; return $this; } /** * Parameter value * * @param string $parameter2Value Parameter value * @return $this Fluent Builder */ public function setParameter2Value(string $parameter2Value): self { $this->options['parameter2Value'] = $parameter2Value; return $this; } /** * Parameter name * * @param string $parameter3Name Parameter name * @return $this Fluent Builder */ public function setParameter3Name(string $parameter3Name): self { $this->options['parameter3Name'] = $parameter3Name; return $this; } /** * Parameter value * * @param string $parameter3Value Parameter value * @return $this Fluent Builder */ public function setParameter3Value(string $parameter3Value): self { $this->options['parameter3Value'] = $parameter3Value; return $this; } /** * Parameter name * * @param string $parameter4Name Parameter name * @return $this Fluent Builder */ public function setParameter4Name(string $parameter4Name): self { $this->options['parameter4Name'] = $parameter4Name; return $this; } /** * Parameter value * * @param string $parameter4Value Parameter value * @return $this Fluent Builder */ public function setParameter4Value(string $parameter4Value): self { $this->options['parameter4Value'] = $parameter4Value; return $this; } /** * Parameter name * * @param string $parameter5Name Parameter name * @return $this Fluent Builder */ public function setParameter5Name(string $parameter5Name): self { $this->options['parameter5Name'] = $parameter5Name; return $this; } /** * Parameter value * * @param string $parameter5Value Parameter value * @return $this Fluent Builder */ public function setParameter5Value(string $parameter5Value): self { $this->options['parameter5Value'] = $parameter5Value; return $this; } /** * Parameter name * * @param string $parameter6Name Parameter name * @return $this Fluent Builder */ public function setParameter6Name(string $parameter6Name): self { $this->options['parameter6Name'] = $parameter6Name; return $this; } /** * Parameter value * * @param string $parameter6Value Parameter value * @return $this Fluent Builder */ public function setParameter6Value(string $parameter6Value): self { $this->options['parameter6Value'] = $parameter6Value; return $this; } /** * Parameter name * * @param string $parameter7Name Parameter name * @return $this Fluent Builder */ public function setParameter7Name(string $parameter7Name): self { $this->options['parameter7Name'] = $parameter7Name; return $this; } /** * Parameter value * * @param string $parameter7Value Parameter value * @return $this Fluent Builder */ public function setParameter7Value(string $parameter7Value): self { $this->options['parameter7Value'] = $parameter7Value; return $this; } /** * Parameter name * * @param string $parameter8Name Parameter name * @return $this Fluent Builder */ public function setParameter8Name(string $parameter8Name): self { $this->options['parameter8Name'] = $parameter8Name; return $this; } /** * Parameter value * * @param string $parameter8Value Parameter value * @return $this Fluent Builder */ public function setParameter8Value(string $parameter8Value): self { $this->options['parameter8Value'] = $parameter8Value; return $this; } /** * Parameter name * * @param string $parameter9Name Parameter name * @return $this Fluent Builder */ public function setParameter9Name(string $parameter9Name): self { $this->options['parameter9Name'] = $parameter9Name; return $this; } /** * Parameter value * * @param string $parameter9Value Parameter value * @return $this Fluent Builder */ public function setParameter9Value(string $parameter9Value): self { $this->options['parameter9Value'] = $parameter9Value; return $this; } /** * Parameter name * * @param string $parameter10Name Parameter name * @return $this Fluent Builder */ public function setParameter10Name(string $parameter10Name): self { $this->options['parameter10Name'] = $parameter10Name; return $this; } /** * Parameter value * * @param string $parameter10Value Parameter value * @return $this Fluent Builder */ public function setParameter10Value(string $parameter10Value): self { $this->options['parameter10Value'] = $parameter10Value; return $this; } /** * Parameter name * * @param string $parameter11Name Parameter name * @return $this Fluent Builder */ public function setParameter11Name(string $parameter11Name): self { $this->options['parameter11Name'] = $parameter11Name; return $this; } /** * Parameter value * * @param string $parameter11Value Parameter value * @return $this Fluent Builder */ public function setParameter11Value(string $parameter11Value): self { $this->options['parameter11Value'] = $parameter11Value; return $this; } /** * Parameter name * * @param string $parameter12Name Parameter name * @return $this Fluent Builder */ public function setParameter12Name(string $parameter12Name): self { $this->options['parameter12Name'] = $parameter12Name; return $this; } /** * Parameter value * * @param string $parameter12Value Parameter value * @return $this Fluent Builder */ public function setParameter12Value(string $parameter12Value): self { $this->options['parameter12Value'] = $parameter12Value; return $this; } /** * Parameter name * * @param string $parameter13Name Parameter name * @return $this Fluent Builder */ public function setParameter13Name(string $parameter13Name): self { $this->options['parameter13Name'] = $parameter13Name; return $this; } /** * Parameter value * * @param string $parameter13Value Parameter value * @return $this Fluent Builder */ public function setParameter13Value(string $parameter13Value): self { $this->options['parameter13Value'] = $parameter13Value; return $this; } /** * Parameter name * * @param string $parameter14Name Parameter name * @return $this Fluent Builder */ public function setParameter14Name(string $parameter14Name): self { $this->options['parameter14Name'] = $parameter14Name; return $this; } /** * Parameter value * * @param string $parameter14Value Parameter value * @return $this Fluent Builder */ public function setParameter14Value(string $parameter14Value): self { $this->options['parameter14Value'] = $parameter14Value; return $this; } /** * Parameter name * * @param string $parameter15Name Parameter name * @return $this Fluent Builder */ public function setParameter15Name(string $parameter15Name): self { $this->options['parameter15Name'] = $parameter15Name; return $this; } /** * Parameter value * * @param string $parameter15Value Parameter value * @return $this Fluent Builder */ public function setParameter15Value(string $parameter15Value): self { $this->options['parameter15Value'] = $parameter15Value; return $this; } /** * Parameter name * * @param string $parameter16Name Parameter name * @return $this Fluent Builder */ public function setParameter16Name(string $parameter16Name): self { $this->options['parameter16Name'] = $parameter16Name; return $this; } /** * Parameter value * * @param string $parameter16Value Parameter value * @return $this Fluent Builder */ public function setParameter16Value(string $parameter16Value): self { $this->options['parameter16Value'] = $parameter16Value; return $this; } /** * Parameter name * * @param string $parameter17Name Parameter name * @return $this Fluent Builder */ public function setParameter17Name(string $parameter17Name): self { $this->options['parameter17Name'] = $parameter17Name; return $this; } /** * Parameter value * * @param string $parameter17Value Parameter value * @return $this Fluent Builder */ public function setParameter17Value(string $parameter17Value): self { $this->options['parameter17Value'] = $parameter17Value; return $this; } /** * Parameter name * * @param string $parameter18Name Parameter name * @return $this Fluent Builder */ public function setParameter18Name(string $parameter18Name): self { $this->options['parameter18Name'] = $parameter18Name; return $this; } /** * Parameter value * * @param string $parameter18Value Parameter value * @return $this Fluent Builder */ public function setParameter18Value(string $parameter18Value): self { $this->options['parameter18Value'] = $parameter18Value; return $this; } /** * Parameter name * * @param string $parameter19Name Parameter name * @return $this Fluent Builder */ public function setParameter19Name(string $parameter19Name): self { $this->options['parameter19Name'] = $parameter19Name; return $this; } /** * Parameter value * * @param string $parameter19Value Parameter value * @return $this Fluent Builder */ public function setParameter19Value(string $parameter19Value): self { $this->options['parameter19Value'] = $parameter19Value; return $this; } /** * Parameter name * * @param string $parameter20Name Parameter name * @return $this Fluent Builder */ public function setParameter20Name(string $parameter20Name): self { $this->options['parameter20Name'] = $parameter20Name; return $this; } /** * Parameter value * * @param string $parameter20Value Parameter value * @return $this Fluent Builder */ public function setParameter20Value(string $parameter20Value): self { $this->options['parameter20Value'] = $parameter20Value; return $this; } /** * Parameter name * * @param string $parameter21Name Parameter name * @return $this Fluent Builder */ public function setParameter21Name(string $parameter21Name): self { $this->options['parameter21Name'] = $parameter21Name; return $this; } /** * Parameter value * * @param string $parameter21Value Parameter value * @return $this Fluent Builder */ public function setParameter21Value(string $parameter21Value): self { $this->options['parameter21Value'] = $parameter21Value; return $this; } /** * Parameter name * * @param string $parameter22Name Parameter name * @return $this Fluent Builder */ public function setParameter22Name(string $parameter22Name): self { $this->options['parameter22Name'] = $parameter22Name; return $this; } /** * Parameter value * * @param string $parameter22Value Parameter value * @return $this Fluent Builder */ public function setParameter22Value(string $parameter22Value): self { $this->options['parameter22Value'] = $parameter22Value; return $this; } /** * Parameter name * * @param string $parameter23Name Parameter name * @return $this Fluent Builder */ public function setParameter23Name(string $parameter23Name): self { $this->options['parameter23Name'] = $parameter23Name; return $this; } /** * Parameter value * * @param string $parameter23Value Parameter value * @return $this Fluent Builder */ public function setParameter23Value(string $parameter23Value): self { $this->options['parameter23Value'] = $parameter23Value; return $this; } /** * Parameter name * * @param string $parameter24Name Parameter name * @return $this Fluent Builder */ public function setParameter24Name(string $parameter24Name): self { $this->options['parameter24Name'] = $parameter24Name; return $this; } /** * Parameter value * * @param string $parameter24Value Parameter value * @return $this Fluent Builder */ public function setParameter24Value(string $parameter24Value): self { $this->options['parameter24Value'] = $parameter24Value; return $this; } /** * Parameter name * * @param string $parameter25Name Parameter name * @return $this Fluent Builder */ public function setParameter25Name(string $parameter25Name): self { $this->options['parameter25Name'] = $parameter25Name; return $this; } /** * Parameter value * * @param string $parameter25Value Parameter value * @return $this Fluent Builder */ public function setParameter25Value(string $parameter25Value): self { $this->options['parameter25Value'] = $parameter25Value; return $this; } /** * Parameter name * * @param string $parameter26Name Parameter name * @return $this Fluent Builder */ public function setParameter26Name(string $parameter26Name): self { $this->options['parameter26Name'] = $parameter26Name; return $this; } /** * Parameter value * * @param string $parameter26Value Parameter value * @return $this Fluent Builder */ public function setParameter26Value(string $parameter26Value): self { $this->options['parameter26Value'] = $parameter26Value; return $this; } /** * Parameter name * * @param string $parameter27Name Parameter name * @return $this Fluent Builder */ public function setParameter27Name(string $parameter27Name): self { $this->options['parameter27Name'] = $parameter27Name; return $this; } /** * Parameter value * * @param string $parameter27Value Parameter value * @return $this Fluent Builder */ public function setParameter27Value(string $parameter27Value): self { $this->options['parameter27Value'] = $parameter27Value; return $this; } /** * Parameter name * * @param string $parameter28Name Parameter name * @return $this Fluent Builder */ public function setParameter28Name(string $parameter28Name): self { $this->options['parameter28Name'] = $parameter28Name; return $this; } /** * Parameter value * * @param string $parameter28Value Parameter value * @return $this Fluent Builder */ public function setParameter28Value(string $parameter28Value): self { $this->options['parameter28Value'] = $parameter28Value; return $this; } /** * Parameter name * * @param string $parameter29Name Parameter name * @return $this Fluent Builder */ public function setParameter29Name(string $parameter29Name): self { $this->options['parameter29Name'] = $parameter29Name; return $this; } /** * Parameter value * * @param string $parameter29Value Parameter value * @return $this Fluent Builder */ public function setParameter29Value(string $parameter29Value): self { $this->options['parameter29Value'] = $parameter29Value; return $this; } /** * Parameter name * * @param string $parameter30Name Parameter name * @return $this Fluent Builder */ public function setParameter30Name(string $parameter30Name): self { $this->options['parameter30Name'] = $parameter30Name; return $this; } /** * Parameter value * * @param string $parameter30Value Parameter value * @return $this Fluent Builder */ public function setParameter30Value(string $parameter30Value): self { $this->options['parameter30Value'] = $parameter30Value; return $this; } /** * Parameter name * * @param string $parameter31Name Parameter name * @return $this Fluent Builder */ public function setParameter31Name(string $parameter31Name): self { $this->options['parameter31Name'] = $parameter31Name; return $this; } /** * Parameter value * * @param string $parameter31Value Parameter value * @return $this Fluent Builder */ public function setParameter31Value(string $parameter31Value): self { $this->options['parameter31Value'] = $parameter31Value; return $this; } /** * Parameter name * * @param string $parameter32Name Parameter name * @return $this Fluent Builder */ public function setParameter32Name(string $parameter32Name): self { $this->options['parameter32Name'] = $parameter32Name; return $this; } /** * Parameter value * * @param string $parameter32Value Parameter value * @return $this Fluent Builder */ public function setParameter32Value(string $parameter32Value): self { $this->options['parameter32Value'] = $parameter32Value; return $this; } /** * Parameter name * * @param string $parameter33Name Parameter name * @return $this Fluent Builder */ public function setParameter33Name(string $parameter33Name): self { $this->options['parameter33Name'] = $parameter33Name; return $this; } /** * Parameter value * * @param string $parameter33Value Parameter value * @return $this Fluent Builder */ public function setParameter33Value(string $parameter33Value): self { $this->options['parameter33Value'] = $parameter33Value; return $this; } /** * Parameter name * * @param string $parameter34Name Parameter name * @return $this Fluent Builder */ public function setParameter34Name(string $parameter34Name): self { $this->options['parameter34Name'] = $parameter34Name; return $this; } /** * Parameter value * * @param string $parameter34Value Parameter value * @return $this Fluent Builder */ public function setParameter34Value(string $parameter34Value): self { $this->options['parameter34Value'] = $parameter34Value; return $this; } /** * Parameter name * * @param string $parameter35Name Parameter name * @return $this Fluent Builder */ public function setParameter35Name(string $parameter35Name): self { $this->options['parameter35Name'] = $parameter35Name; return $this; } /** * Parameter value * * @param string $parameter35Value Parameter value * @return $this Fluent Builder */ public function setParameter35Value(string $parameter35Value): self { $this->options['parameter35Value'] = $parameter35Value; return $this; } /** * Parameter name * * @param string $parameter36Name Parameter name * @return $this Fluent Builder */ public function setParameter36Name(string $parameter36Name): self { $this->options['parameter36Name'] = $parameter36Name; return $this; } /** * Parameter value * * @param string $parameter36Value Parameter value * @return $this Fluent Builder */ public function setParameter36Value(string $parameter36Value): self { $this->options['parameter36Value'] = $parameter36Value; return $this; } /** * Parameter name * * @param string $parameter37Name Parameter name * @return $this Fluent Builder */ public function setParameter37Name(string $parameter37Name): self { $this->options['parameter37Name'] = $parameter37Name; return $this; } /** * Parameter value * * @param string $parameter37Value Parameter value * @return $this Fluent Builder */ public function setParameter37Value(string $parameter37Value): self { $this->options['parameter37Value'] = $parameter37Value; return $this; } /** * Parameter name * * @param string $parameter38Name Parameter name * @return $this Fluent Builder */ public function setParameter38Name(string $parameter38Name): self { $this->options['parameter38Name'] = $parameter38Name; return $this; } /** * Parameter value * * @param string $parameter38Value Parameter value * @return $this Fluent Builder */ public function setParameter38Value(string $parameter38Value): self { $this->options['parameter38Value'] = $parameter38Value; return $this; } /** * Parameter name * * @param string $parameter39Name Parameter name * @return $this Fluent Builder */ public function setParameter39Name(string $parameter39Name): self { $this->options['parameter39Name'] = $parameter39Name; return $this; } /** * Parameter value * * @param string $parameter39Value Parameter value * @return $this Fluent Builder */ public function setParameter39Value(string $parameter39Value): self { $this->options['parameter39Value'] = $parameter39Value; return $this; } /** * Parameter name * * @param string $parameter40Name Parameter name * @return $this Fluent Builder */ public function setParameter40Name(string $parameter40Name): self { $this->options['parameter40Name'] = $parameter40Name; return $this; } /** * Parameter value * * @param string $parameter40Value Parameter value * @return $this Fluent Builder */ public function setParameter40Value(string $parameter40Value): self { $this->options['parameter40Value'] = $parameter40Value; return $this; } /** * Parameter name * * @param string $parameter41Name Parameter name * @return $this Fluent Builder */ public function setParameter41Name(string $parameter41Name): self { $this->options['parameter41Name'] = $parameter41Name; return $this; } /** * Parameter value * * @param string $parameter41Value Parameter value * @return $this Fluent Builder */ public function setParameter41Value(string $parameter41Value): self { $this->options['parameter41Value'] = $parameter41Value; return $this; } /** * Parameter name * * @param string $parameter42Name Parameter name * @return $this Fluent Builder */ public function setParameter42Name(string $parameter42Name): self { $this->options['parameter42Name'] = $parameter42Name; return $this; } /** * Parameter value * * @param string $parameter42Value Parameter value * @return $this Fluent Builder */ public function setParameter42Value(string $parameter42Value): self { $this->options['parameter42Value'] = $parameter42Value; return $this; } /** * Parameter name * * @param string $parameter43Name Parameter name * @return $this Fluent Builder */ public function setParameter43Name(string $parameter43Name): self { $this->options['parameter43Name'] = $parameter43Name; return $this; } /** * Parameter value * * @param string $parameter43Value Parameter value * @return $this Fluent Builder */ public function setParameter43Value(string $parameter43Value): self { $this->options['parameter43Value'] = $parameter43Value; return $this; } /** * Parameter name * * @param string $parameter44Name Parameter name * @return $this Fluent Builder */ public function setParameter44Name(string $parameter44Name): self { $this->options['parameter44Name'] = $parameter44Name; return $this; } /** * Parameter value * * @param string $parameter44Value Parameter value * @return $this Fluent Builder */ public function setParameter44Value(string $parameter44Value): self { $this->options['parameter44Value'] = $parameter44Value; return $this; } /** * Parameter name * * @param string $parameter45Name Parameter name * @return $this Fluent Builder */ public function setParameter45Name(string $parameter45Name): self { $this->options['parameter45Name'] = $parameter45Name; return $this; } /** * Parameter value * * @param string $parameter45Value Parameter value * @return $this Fluent Builder */ public function setParameter45Value(string $parameter45Value): self { $this->options['parameter45Value'] = $parameter45Value; return $this; } /** * Parameter name * * @param string $parameter46Name Parameter name * @return $this Fluent Builder */ public function setParameter46Name(string $parameter46Name): self { $this->options['parameter46Name'] = $parameter46Name; return $this; } /** * Parameter value * * @param string $parameter46Value Parameter value * @return $this Fluent Builder */ public function setParameter46Value(string $parameter46Value): self { $this->options['parameter46Value'] = $parameter46Value; return $this; } /** * Parameter name * * @param string $parameter47Name Parameter name * @return $this Fluent Builder */ public function setParameter47Name(string $parameter47Name): self { $this->options['parameter47Name'] = $parameter47Name; return $this; } /** * Parameter value * * @param string $parameter47Value Parameter value * @return $this Fluent Builder */ public function setParameter47Value(string $parameter47Value): self { $this->options['parameter47Value'] = $parameter47Value; return $this; } /** * Parameter name * * @param string $parameter48Name Parameter name * @return $this Fluent Builder */ public function setParameter48Name(string $parameter48Name): self { $this->options['parameter48Name'] = $parameter48Name; return $this; } /** * Parameter value * * @param string $parameter48Value Parameter value * @return $this Fluent Builder */ public function setParameter48Value(string $parameter48Value): self { $this->options['parameter48Value'] = $parameter48Value; return $this; } /** * Parameter name * * @param string $parameter49Name Parameter name * @return $this Fluent Builder */ public function setParameter49Name(string $parameter49Name): self { $this->options['parameter49Name'] = $parameter49Name; return $this; } /** * Parameter value * * @param string $parameter49Value Parameter value * @return $this Fluent Builder */ public function setParameter49Value(string $parameter49Value): self { $this->options['parameter49Value'] = $parameter49Value; return $this; } /** * Parameter name * * @param string $parameter50Name Parameter name * @return $this Fluent Builder */ public function setParameter50Name(string $parameter50Name): self { $this->options['parameter50Name'] = $parameter50Name; return $this; } /** * Parameter value * * @param string $parameter50Value Parameter value * @return $this Fluent Builder */ public function setParameter50Value(string $parameter50Value): self { $this->options['parameter50Value'] = $parameter50Value; return $this; } /** * Parameter name * * @param string $parameter51Name Parameter name * @return $this Fluent Builder */ public function setParameter51Name(string $parameter51Name): self { $this->options['parameter51Name'] = $parameter51Name; return $this; } /** * Parameter value * * @param string $parameter51Value Parameter value * @return $this Fluent Builder */ public function setParameter51Value(string $parameter51Value): self { $this->options['parameter51Value'] = $parameter51Value; return $this; } /** * Parameter name * * @param string $parameter52Name Parameter name * @return $this Fluent Builder */ public function setParameter52Name(string $parameter52Name): self { $this->options['parameter52Name'] = $parameter52Name; return $this; } /** * Parameter value * * @param string $parameter52Value Parameter value * @return $this Fluent Builder */ public function setParameter52Value(string $parameter52Value): self { $this->options['parameter52Value'] = $parameter52Value; return $this; } /** * Parameter name * * @param string $parameter53Name Parameter name * @return $this Fluent Builder */ public function setParameter53Name(string $parameter53Name): self { $this->options['parameter53Name'] = $parameter53Name; return $this; } /** * Parameter value * * @param string $parameter53Value Parameter value * @return $this Fluent Builder */ public function setParameter53Value(string $parameter53Value): self { $this->options['parameter53Value'] = $parameter53Value; return $this; } /** * Parameter name * * @param string $parameter54Name Parameter name * @return $this Fluent Builder */ public function setParameter54Name(string $parameter54Name): self { $this->options['parameter54Name'] = $parameter54Name; return $this; } /** * Parameter value * * @param string $parameter54Value Parameter value * @return $this Fluent Builder */ public function setParameter54Value(string $parameter54Value): self { $this->options['parameter54Value'] = $parameter54Value; return $this; } /** * Parameter name * * @param string $parameter55Name Parameter name * @return $this Fluent Builder */ public function setParameter55Name(string $parameter55Name): self { $this->options['parameter55Name'] = $parameter55Name; return $this; } /** * Parameter value * * @param string $parameter55Value Parameter value * @return $this Fluent Builder */ public function setParameter55Value(string $parameter55Value): self { $this->options['parameter55Value'] = $parameter55Value; return $this; } /** * Parameter name * * @param string $parameter56Name Parameter name * @return $this Fluent Builder */ public function setParameter56Name(string $parameter56Name): self { $this->options['parameter56Name'] = $parameter56Name; return $this; } /** * Parameter value * * @param string $parameter56Value Parameter value * @return $this Fluent Builder */ public function setParameter56Value(string $parameter56Value): self { $this->options['parameter56Value'] = $parameter56Value; return $this; } /** * Parameter name * * @param string $parameter57Name Parameter name * @return $this Fluent Builder */ public function setParameter57Name(string $parameter57Name): self { $this->options['parameter57Name'] = $parameter57Name; return $this; } /** * Parameter value * * @param string $parameter57Value Parameter value * @return $this Fluent Builder */ public function setParameter57Value(string $parameter57Value): self { $this->options['parameter57Value'] = $parameter57Value; return $this; } /** * Parameter name * * @param string $parameter58Name Parameter name * @return $this Fluent Builder */ public function setParameter58Name(string $parameter58Name): self { $this->options['parameter58Name'] = $parameter58Name; return $this; } /** * Parameter value * * @param string $parameter58Value Parameter value * @return $this Fluent Builder */ public function setParameter58Value(string $parameter58Value): self { $this->options['parameter58Value'] = $parameter58Value; return $this; } /** * Parameter name * * @param string $parameter59Name Parameter name * @return $this Fluent Builder */ public function setParameter59Name(string $parameter59Name): self { $this->options['parameter59Name'] = $parameter59Name; return $this; } /** * Parameter value * * @param string $parameter59Value Parameter value * @return $this Fluent Builder */ public function setParameter59Value(string $parameter59Value): self { $this->options['parameter59Value'] = $parameter59Value; return $this; } /** * Parameter name * * @param string $parameter60Name Parameter name * @return $this Fluent Builder */ public function setParameter60Name(string $parameter60Name): self { $this->options['parameter60Name'] = $parameter60Name; return $this; } /** * Parameter value * * @param string $parameter60Value Parameter value * @return $this Fluent Builder */ public function setParameter60Value(string $parameter60Value): self { $this->options['parameter60Value'] = $parameter60Value; return $this; } /** * Parameter name * * @param string $parameter61Name Parameter name * @return $this Fluent Builder */ public function setParameter61Name(string $parameter61Name): self { $this->options['parameter61Name'] = $parameter61Name; return $this; } /** * Parameter value * * @param string $parameter61Value Parameter value * @return $this Fluent Builder */ public function setParameter61Value(string $parameter61Value): self { $this->options['parameter61Value'] = $parameter61Value; return $this; } /** * Parameter name * * @param string $parameter62Name Parameter name * @return $this Fluent Builder */ public function setParameter62Name(string $parameter62Name): self { $this->options['parameter62Name'] = $parameter62Name; return $this; } /** * Parameter value * * @param string $parameter62Value Parameter value * @return $this Fluent Builder */ public function setParameter62Value(string $parameter62Value): self { $this->options['parameter62Value'] = $parameter62Value; return $this; } /** * Parameter name * * @param string $parameter63Name Parameter name * @return $this Fluent Builder */ public function setParameter63Name(string $parameter63Name): self { $this->options['parameter63Name'] = $parameter63Name; return $this; } /** * Parameter value * * @param string $parameter63Value Parameter value * @return $this Fluent Builder */ public function setParameter63Value(string $parameter63Value): self { $this->options['parameter63Value'] = $parameter63Value; return $this; } /** * Parameter name * * @param string $parameter64Name Parameter name * @return $this Fluent Builder */ public function setParameter64Name(string $parameter64Name): self { $this->options['parameter64Name'] = $parameter64Name; return $this; } /** * Parameter value * * @param string $parameter64Value Parameter value * @return $this Fluent Builder */ public function setParameter64Value(string $parameter64Value): self { $this->options['parameter64Value'] = $parameter64Value; return $this; } /** * Parameter name * * @param string $parameter65Name Parameter name * @return $this Fluent Builder */ public function setParameter65Name(string $parameter65Name): self { $this->options['parameter65Name'] = $parameter65Name; return $this; } /** * Parameter value * * @param string $parameter65Value Parameter value * @return $this Fluent Builder */ public function setParameter65Value(string $parameter65Value): self { $this->options['parameter65Value'] = $parameter65Value; return $this; } /** * Parameter name * * @param string $parameter66Name Parameter name * @return $this Fluent Builder */ public function setParameter66Name(string $parameter66Name): self { $this->options['parameter66Name'] = $parameter66Name; return $this; } /** * Parameter value * * @param string $parameter66Value Parameter value * @return $this Fluent Builder */ public function setParameter66Value(string $parameter66Value): self { $this->options['parameter66Value'] = $parameter66Value; return $this; } /** * Parameter name * * @param string $parameter67Name Parameter name * @return $this Fluent Builder */ public function setParameter67Name(string $parameter67Name): self { $this->options['parameter67Name'] = $parameter67Name; return $this; } /** * Parameter value * * @param string $parameter67Value Parameter value * @return $this Fluent Builder */ public function setParameter67Value(string $parameter67Value): self { $this->options['parameter67Value'] = $parameter67Value; return $this; } /** * Parameter name * * @param string $parameter68Name Parameter name * @return $this Fluent Builder */ public function setParameter68Name(string $parameter68Name): self { $this->options['parameter68Name'] = $parameter68Name; return $this; } /** * Parameter value * * @param string $parameter68Value Parameter value * @return $this Fluent Builder */ public function setParameter68Value(string $parameter68Value): self { $this->options['parameter68Value'] = $parameter68Value; return $this; } /** * Parameter name * * @param string $parameter69Name Parameter name * @return $this Fluent Builder */ public function setParameter69Name(string $parameter69Name): self { $this->options['parameter69Name'] = $parameter69Name; return $this; } /** * Parameter value * * @param string $parameter69Value Parameter value * @return $this Fluent Builder */ public function setParameter69Value(string $parameter69Value): self { $this->options['parameter69Value'] = $parameter69Value; return $this; } /** * Parameter name * * @param string $parameter70Name Parameter name * @return $this Fluent Builder */ public function setParameter70Name(string $parameter70Name): self { $this->options['parameter70Name'] = $parameter70Name; return $this; } /** * Parameter value * * @param string $parameter70Value Parameter value * @return $this Fluent Builder */ public function setParameter70Value(string $parameter70Value): self { $this->options['parameter70Value'] = $parameter70Value; return $this; } /** * Parameter name * * @param string $parameter71Name Parameter name * @return $this Fluent Builder */ public function setParameter71Name(string $parameter71Name): self { $this->options['parameter71Name'] = $parameter71Name; return $this; } /** * Parameter value * * @param string $parameter71Value Parameter value * @return $this Fluent Builder */ public function setParameter71Value(string $parameter71Value): self { $this->options['parameter71Value'] = $parameter71Value; return $this; } /** * Parameter name * * @param string $parameter72Name Parameter name * @return $this Fluent Builder */ public function setParameter72Name(string $parameter72Name): self { $this->options['parameter72Name'] = $parameter72Name; return $this; } /** * Parameter value * * @param string $parameter72Value Parameter value * @return $this Fluent Builder */ public function setParameter72Value(string $parameter72Value): self { $this->options['parameter72Value'] = $parameter72Value; return $this; } /** * Parameter name * * @param string $parameter73Name Parameter name * @return $this Fluent Builder */ public function setParameter73Name(string $parameter73Name): self { $this->options['parameter73Name'] = $parameter73Name; return $this; } /** * Parameter value * * @param string $parameter73Value Parameter value * @return $this Fluent Builder */ public function setParameter73Value(string $parameter73Value): self { $this->options['parameter73Value'] = $parameter73Value; return $this; } /** * Parameter name * * @param string $parameter74Name Parameter name * @return $this Fluent Builder */ public function setParameter74Name(string $parameter74Name): self { $this->options['parameter74Name'] = $parameter74Name; return $this; } /** * Parameter value * * @param string $parameter74Value Parameter value * @return $this Fluent Builder */ public function setParameter74Value(string $parameter74Value): self { $this->options['parameter74Value'] = $parameter74Value; return $this; } /** * Parameter name * * @param string $parameter75Name Parameter name * @return $this Fluent Builder */ public function setParameter75Name(string $parameter75Name): self { $this->options['parameter75Name'] = $parameter75Name; return $this; } /** * Parameter value * * @param string $parameter75Value Parameter value * @return $this Fluent Builder */ public function setParameter75Value(string $parameter75Value): self { $this->options['parameter75Value'] = $parameter75Value; return $this; } /** * Parameter name * * @param string $parameter76Name Parameter name * @return $this Fluent Builder */ public function setParameter76Name(string $parameter76Name): self { $this->options['parameter76Name'] = $parameter76Name; return $this; } /** * Parameter value * * @param string $parameter76Value Parameter value * @return $this Fluent Builder */ public function setParameter76Value(string $parameter76Value): self { $this->options['parameter76Value'] = $parameter76Value; return $this; } /** * Parameter name * * @param string $parameter77Name Parameter name * @return $this Fluent Builder */ public function setParameter77Name(string $parameter77Name): self { $this->options['parameter77Name'] = $parameter77Name; return $this; } /** * Parameter value * * @param string $parameter77Value Parameter value * @return $this Fluent Builder */ public function setParameter77Value(string $parameter77Value): self { $this->options['parameter77Value'] = $parameter77Value; return $this; } /** * Parameter name * * @param string $parameter78Name Parameter name * @return $this Fluent Builder */ public function setParameter78Name(string $parameter78Name): self { $this->options['parameter78Name'] = $parameter78Name; return $this; } /** * Parameter value * * @param string $parameter78Value Parameter value * @return $this Fluent Builder */ public function setParameter78Value(string $parameter78Value): self { $this->options['parameter78Value'] = $parameter78Value; return $this; } /** * Parameter name * * @param string $parameter79Name Parameter name * @return $this Fluent Builder */ public function setParameter79Name(string $parameter79Name): self { $this->options['parameter79Name'] = $parameter79Name; return $this; } /** * Parameter value * * @param string $parameter79Value Parameter value * @return $this Fluent Builder */ public function setParameter79Value(string $parameter79Value): self { $this->options['parameter79Value'] = $parameter79Value; return $this; } /** * Parameter name * * @param string $parameter80Name Parameter name * @return $this Fluent Builder */ public function setParameter80Name(string $parameter80Name): self { $this->options['parameter80Name'] = $parameter80Name; return $this; } /** * Parameter value * * @param string $parameter80Value Parameter value * @return $this Fluent Builder */ public function setParameter80Value(string $parameter80Value): self { $this->options['parameter80Value'] = $parameter80Value; return $this; } /** * Parameter name * * @param string $parameter81Name Parameter name * @return $this Fluent Builder */ public function setParameter81Name(string $parameter81Name): self { $this->options['parameter81Name'] = $parameter81Name; return $this; } /** * Parameter value * * @param string $parameter81Value Parameter value * @return $this Fluent Builder */ public function setParameter81Value(string $parameter81Value): self { $this->options['parameter81Value'] = $parameter81Value; return $this; } /** * Parameter name * * @param string $parameter82Name Parameter name * @return $this Fluent Builder */ public function setParameter82Name(string $parameter82Name): self { $this->options['parameter82Name'] = $parameter82Name; return $this; } /** * Parameter value * * @param string $parameter82Value Parameter value * @return $this Fluent Builder */ public function setParameter82Value(string $parameter82Value): self { $this->options['parameter82Value'] = $parameter82Value; return $this; } /** * Parameter name * * @param string $parameter83Name Parameter name * @return $this Fluent Builder */ public function setParameter83Name(string $parameter83Name): self { $this->options['parameter83Name'] = $parameter83Name; return $this; } /** * Parameter value * * @param string $parameter83Value Parameter value * @return $this Fluent Builder */ public function setParameter83Value(string $parameter83Value): self { $this->options['parameter83Value'] = $parameter83Value; return $this; } /** * Parameter name * * @param string $parameter84Name Parameter name * @return $this Fluent Builder */ public function setParameter84Name(string $parameter84Name): self { $this->options['parameter84Name'] = $parameter84Name; return $this; } /** * Parameter value * * @param string $parameter84Value Parameter value * @return $this Fluent Builder */ public function setParameter84Value(string $parameter84Value): self { $this->options['parameter84Value'] = $parameter84Value; return $this; } /** * Parameter name * * @param string $parameter85Name Parameter name * @return $this Fluent Builder */ public function setParameter85Name(string $parameter85Name): self { $this->options['parameter85Name'] = $parameter85Name; return $this; } /** * Parameter value * * @param string $parameter85Value Parameter value * @return $this Fluent Builder */ public function setParameter85Value(string $parameter85Value): self { $this->options['parameter85Value'] = $parameter85Value; return $this; } /** * Parameter name * * @param string $parameter86Name Parameter name * @return $this Fluent Builder */ public function setParameter86Name(string $parameter86Name): self { $this->options['parameter86Name'] = $parameter86Name; return $this; } /** * Parameter value * * @param string $parameter86Value Parameter value * @return $this Fluent Builder */ public function setParameter86Value(string $parameter86Value): self { $this->options['parameter86Value'] = $parameter86Value; return $this; } /** * Parameter name * * @param string $parameter87Name Parameter name * @return $this Fluent Builder */ public function setParameter87Name(string $parameter87Name): self { $this->options['parameter87Name'] = $parameter87Name; return $this; } /** * Parameter value * * @param string $parameter87Value Parameter value * @return $this Fluent Builder */ public function setParameter87Value(string $parameter87Value): self { $this->options['parameter87Value'] = $parameter87Value; return $this; } /** * Parameter name * * @param string $parameter88Name Parameter name * @return $this Fluent Builder */ public function setParameter88Name(string $parameter88Name): self { $this->options['parameter88Name'] = $parameter88Name; return $this; } /** * Parameter value * * @param string $parameter88Value Parameter value * @return $this Fluent Builder */ public function setParameter88Value(string $parameter88Value): self { $this->options['parameter88Value'] = $parameter88Value; return $this; } /** * Parameter name * * @param string $parameter89Name Parameter name * @return $this Fluent Builder */ public function setParameter89Name(string $parameter89Name): self { $this->options['parameter89Name'] = $parameter89Name; return $this; } /** * Parameter value * * @param string $parameter89Value Parameter value * @return $this Fluent Builder */ public function setParameter89Value(string $parameter89Value): self { $this->options['parameter89Value'] = $parameter89Value; return $this; } /** * Parameter name * * @param string $parameter90Name Parameter name * @return $this Fluent Builder */ public function setParameter90Name(string $parameter90Name): self { $this->options['parameter90Name'] = $parameter90Name; return $this; } /** * Parameter value * * @param string $parameter90Value Parameter value * @return $this Fluent Builder */ public function setParameter90Value(string $parameter90Value): self { $this->options['parameter90Value'] = $parameter90Value; return $this; } /** * Parameter name * * @param string $parameter91Name Parameter name * @return $this Fluent Builder */ public function setParameter91Name(string $parameter91Name): self { $this->options['parameter91Name'] = $parameter91Name; return $this; } /** * Parameter value * * @param string $parameter91Value Parameter value * @return $this Fluent Builder */ public function setParameter91Value(string $parameter91Value): self { $this->options['parameter91Value'] = $parameter91Value; return $this; } /** * Parameter name * * @param string $parameter92Name Parameter name * @return $this Fluent Builder */ public function setParameter92Name(string $parameter92Name): self { $this->options['parameter92Name'] = $parameter92Name; return $this; } /** * Parameter value * * @param string $parameter92Value Parameter value * @return $this Fluent Builder */ public function setParameter92Value(string $parameter92Value): self { $this->options['parameter92Value'] = $parameter92Value; return $this; } /** * Parameter name * * @param string $parameter93Name Parameter name * @return $this Fluent Builder */ public function setParameter93Name(string $parameter93Name): self { $this->options['parameter93Name'] = $parameter93Name; return $this; } /** * Parameter value * * @param string $parameter93Value Parameter value * @return $this Fluent Builder */ public function setParameter93Value(string $parameter93Value): self { $this->options['parameter93Value'] = $parameter93Value; return $this; } /** * Parameter name * * @param string $parameter94Name Parameter name * @return $this Fluent Builder */ public function setParameter94Name(string $parameter94Name): self { $this->options['parameter94Name'] = $parameter94Name; return $this; } /** * Parameter value * * @param string $parameter94Value Parameter value * @return $this Fluent Builder */ public function setParameter94Value(string $parameter94Value): self { $this->options['parameter94Value'] = $parameter94Value; return $this; } /** * Parameter name * * @param string $parameter95Name Parameter name * @return $this Fluent Builder */ public function setParameter95Name(string $parameter95Name): self { $this->options['parameter95Name'] = $parameter95Name; return $this; } /** * Parameter value * * @param string $parameter95Value Parameter value * @return $this Fluent Builder */ public function setParameter95Value(string $parameter95Value): self { $this->options['parameter95Value'] = $parameter95Value; return $this; } /** * Parameter name * * @param string $parameter96Name Parameter name * @return $this Fluent Builder */ public function setParameter96Name(string $parameter96Name): self { $this->options['parameter96Name'] = $parameter96Name; return $this; } /** * Parameter value * * @param string $parameter96Value Parameter value * @return $this Fluent Builder */ public function setParameter96Value(string $parameter96Value): self { $this->options['parameter96Value'] = $parameter96Value; return $this; } /** * Parameter name * * @param string $parameter97Name Parameter name * @return $this Fluent Builder */ public function setParameter97Name(string $parameter97Name): self { $this->options['parameter97Name'] = $parameter97Name; return $this; } /** * Parameter value * * @param string $parameter97Value Parameter value * @return $this Fluent Builder */ public function setParameter97Value(string $parameter97Value): self { $this->options['parameter97Value'] = $parameter97Value; return $this; } /** * Parameter name * * @param string $parameter98Name Parameter name * @return $this Fluent Builder */ public function setParameter98Name(string $parameter98Name): self { $this->options['parameter98Name'] = $parameter98Name; return $this; } /** * Parameter value * * @param string $parameter98Value Parameter value * @return $this Fluent Builder */ public function setParameter98Value(string $parameter98Value): self { $this->options['parameter98Value'] = $parameter98Value; return $this; } /** * Parameter name * * @param string $parameter99Name Parameter name * @return $this Fluent Builder */ public function setParameter99Name(string $parameter99Name): self { $this->options['parameter99Name'] = $parameter99Name; return $this; } /** * Parameter value * * @param string $parameter99Value Parameter value * @return $this Fluent Builder */ public function setParameter99Value(string $parameter99Value): self { $this->options['parameter99Value'] = $parameter99Value; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.CreateSiprecOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/Call/NotificationContext.php000064400000003761150515725670017737 0ustar00solution = ['accountSid' => $accountSid, 'callSid' => $callSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Calls/' . \rawurlencode($callSid) . '/Notifications/' . \rawurlencode($sid) . '.json'; } /** * Fetch the NotificationInstance * * @return NotificationInstance Fetched NotificationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): NotificationInstance { $payload = $this->version->fetch('GET', $this->uri); return new NotificationInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['callSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.NotificationContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Call/NotificationInstance.php000064400000011436150515725670020055 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'apiVersion' => Values::array_get($payload, 'api_version'), 'callSid' => Values::array_get($payload, 'call_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'errorCode' => Values::array_get($payload, 'error_code'), 'log' => Values::array_get($payload, 'log'), 'messageDate' => Deserialize::dateTime(Values::array_get($payload, 'message_date')), 'messageText' => Values::array_get($payload, 'message_text'), 'moreInfo' => Values::array_get($payload, 'more_info'), 'requestMethod' => Values::array_get($payload, 'request_method'), 'requestUrl' => Values::array_get($payload, 'request_url'), 'requestVariables' => Values::array_get($payload, 'request_variables'), 'responseBody' => Values::array_get($payload, 'response_body'), 'responseHeaders' => Values::array_get($payload, 'response_headers'), 'sid' => Values::array_get($payload, 'sid'), 'uri' => Values::array_get($payload, 'uri'), ]; $this->solution = [ 'accountSid' => $accountSid, 'callSid' => $callSid, '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 NotificationContext Context for this NotificationInstance */ protected function proxy(): NotificationContext { if (!$this->context) { $this->context = new NotificationContext( $this->version, $this->solution['accountSid'], $this->solution['callSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the NotificationInstance * * @return NotificationInstance Fetched NotificationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): NotificationInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.NotificationInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Call/FeedbackInstance.php000064400000010307150515725670017107 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'issues' => Values::array_get($payload, 'issues'), 'qualityScore' => Values::array_get($payload, 'quality_score'), 'sid' => Values::array_get($payload, 'sid'), ]; $this->solution = ['accountSid' => $accountSid, 'callSid' => $callSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return FeedbackContext Context for this FeedbackInstance */ protected function proxy(): FeedbackContext { if (!$this->context) { $this->context = new FeedbackContext( $this->version, $this->solution['accountSid'], $this->solution['callSid'] ); } return $this->context; } /** * Fetch the FeedbackInstance * * @return FeedbackInstance Fetched FeedbackInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FeedbackInstance { return $this->proxy()->fetch(); } /** * Create the FeedbackInstance * * @param int $qualityScore The call quality expressed as an integer from 1 to 5 * @param array|Options $options Optional Arguments * @return FeedbackInstance Created FeedbackInstance * @throws TwilioException When an HTTP error occurs. */ public function create(int $qualityScore, array $options = []): FeedbackInstance { return $this->proxy()->create($qualityScore, $options); } /** * Update the FeedbackInstance * * @param array|Options $options Optional Arguments * @return FeedbackInstance Updated FeedbackInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): FeedbackInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.FeedbackInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Call/FeedbackSummaryList.php000064400000005056150515725670017641 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Calls/FeedbackSummary.json'; } /** * Create the FeedbackSummaryInstance * * @param \DateTime $startDate Only include feedback given on or after this date * @param \DateTime $endDate Only include feedback given on or before this date * @param array|Options $options Optional Arguments * @return FeedbackSummaryInstance Created FeedbackSummaryInstance * @throws TwilioException When an HTTP error occurs. */ public function create(\DateTime $startDate, \DateTime $endDate, array $options = []): FeedbackSummaryInstance { $options = new Values($options); $data = Values::of([ 'StartDate' => Serialize::iso8601Date($startDate), 'EndDate' => Serialize::iso8601Date($endDate), 'IncludeSubaccounts' => Serialize::booleanToString($options['includeSubaccounts']), 'StatusCallback' => $options['statusCallback'], 'StatusCallbackMethod' => $options['statusCallbackMethod'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new FeedbackSummaryInstance($this->version, $payload, $this->solution['accountSid']); } /** * Constructs a FeedbackSummaryContext * * @param string $sid A string that uniquely identifies this feedback summary * resource */ public function getContext(string $sid): FeedbackSummaryContext { return new FeedbackSummaryContext($this->version, $this->solution['accountSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.FeedbackSummaryList]'; } }src/Twilio/Rest/Api/V2010/Account/Call/NotificationOptions.php000064400000007373150515725670017751 0ustar00options['log'] = $log; $this->options['messageDateBefore'] = $messageDateBefore; $this->options['messageDate'] = $messageDate; $this->options['messageDateAfter'] = $messageDateAfter; } /** * Only read notifications of the specified log level. Can be: `0` to read only ERROR notifications or `1` to read only WARNING notifications. By default, all notifications are read. * * @param int $log Filter by log level * @return $this Fluent Builder */ public function setLog(int $log): self { $this->options['log'] = $log; return $this; } /** * Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. * * @param string $messageDateBefore Filter by date * @return $this Fluent Builder */ public function setMessageDateBefore(string $messageDateBefore): self { $this->options['messageDateBefore'] = $messageDateBefore; return $this; } /** * Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. * * @param string $messageDate Filter by date * @return $this Fluent Builder */ public function setMessageDate(string $messageDate): self { $this->options['messageDate'] = $messageDate; return $this; } /** * Only show notifications for the specified date, formatted as `YYYY-MM-DD`. You can also specify an inequality, such as `<=YYYY-MM-DD` for messages logged at or before midnight on a date, or `>=YYYY-MM-DD` for messages logged at or after midnight on a date. * * @param string $messageDateAfter Filter by date * @return $this Fluent Builder */ public function setMessageDateAfter(string $messageDateAfter): self { $this->options['messageDateAfter'] = $messageDateAfter; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadNotificationOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/Call/RecordingOptions.php000064400000030400150515725670017222 0ustar00options['recordingStatusCallbackEvent'] = $recordingStatusCallbackEvent; $this->options['recordingStatusCallback'] = $recordingStatusCallback; $this->options['recordingStatusCallbackMethod'] = $recordingStatusCallbackMethod; $this->options['trim'] = $trim; $this->options['recordingChannels'] = $recordingChannels; $this->options['recordingTrack'] = $recordingTrack; } /** * The recording status events on which we should call the `recording_status_callback` URL. Can be: `in-progress`, `completed` and `absent` and the default is `completed`. Separate multiple event values with a space. * * @param string[] $recordingStatusCallbackEvent The recording status changes * that should generate a callback * @return $this Fluent Builder */ public function setRecordingStatusCallbackEvent(array $recordingStatusCallbackEvent): self { $this->options['recordingStatusCallbackEvent'] = $recordingStatusCallbackEvent; return $this; } /** * The URL we should call using the `recording_status_callback_method` on each recording event specified in `recording_status_callback_event`. For more information, see [RecordingStatusCallback parameters](https://www.twilio.com/docs/voice/api/recording#recordingstatuscallback). * * @param string $recordingStatusCallback The callback URL on each selected * recording event * @return $this Fluent Builder */ public function setRecordingStatusCallback(string $recordingStatusCallback): self { $this->options['recordingStatusCallback'] = $recordingStatusCallback; return $this; } /** * The HTTP method we should use to call `recording_status_callback`. Can be: `GET` or `POST` and the default is `POST`. * * @param string $recordingStatusCallbackMethod The HTTP method we should use * to call * `recording_status_callback` * @return $this Fluent Builder */ public function setRecordingStatusCallbackMethod(string $recordingStatusCallbackMethod): self { $this->options['recordingStatusCallbackMethod'] = $recordingStatusCallbackMethod; return $this; } /** * Whether to trim any leading and trailing silence in the recording. Can be: `trim-silence` or `do-not-trim` and the default is `do-not-trim`. `trim-silence` trims the silence from the beginning and end of the recording and `do-not-trim` does not. * * @param string $trim Whether to trim the silence in the recording * @return $this Fluent Builder */ public function setTrim(string $trim): self { $this->options['trim'] = $trim; return $this; } /** * The number of channels used in the recording. Can be: `mono` or `dual` and the default is `mono`. `mono` records all parties of the call into one channel. `dual` records each party of a 2-party call into separate channels. * * @param string $recordingChannels The number of channels that the output * recording will be configured with * @return $this Fluent Builder */ public function setRecordingChannels(string $recordingChannels): self { $this->options['recordingChannels'] = $recordingChannels; return $this; } /** * The audio track to record for the call. Can be: `inbound`, `outbound` or `both`. The default is `both`. `inbound` records the audio that is received by Twilio. `outbound` records the audio that is generated from Twilio. `both` records the audio that is received and generated by Twilio. * * @param string $recordingTrack Which track(s) to record * @return $this Fluent Builder */ public function setRecordingTrack(string $recordingTrack): self { $this->options['recordingTrack'] = $recordingTrack; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.CreateRecordingOptions ' . $options . ']'; } } class UpdateRecordingOptions extends Options { /** * @param string $pauseBehavior Whether to record or not during the pause * period. */ public function __construct(string $pauseBehavior = Values::NONE) { $this->options['pauseBehavior'] = $pauseBehavior; } /** * Whether to record during a pause. Can be: `skip` or `silence` and the default is `silence`. `skip` does not record during the pause period, while `silence` will replace the actual audio of the call with silence during the pause period. This parameter only applies when setting `status` is set to `paused`. * * @param string $pauseBehavior Whether to record or not during the pause * period. * @return $this Fluent Builder */ public function setPauseBehavior(string $pauseBehavior): self { $this->options['pauseBehavior'] = $pauseBehavior; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.UpdateRecordingOptions ' . $options . ']'; } } class ReadRecordingOptions extends Options { /** * @param string $dateCreatedBefore The `YYYY-MM-DD` value of the resources to * read * @param string $dateCreated The `YYYY-MM-DD` value of the resources to read * @param string $dateCreatedAfter The `YYYY-MM-DD` value of the resources to * read */ public function __construct(string $dateCreatedBefore = Values::NONE, string $dateCreated = Values::NONE, string $dateCreatedAfter = Values::NONE) { $this->options['dateCreatedBefore'] = $dateCreatedBefore; $this->options['dateCreated'] = $dateCreated; $this->options['dateCreatedAfter'] = $dateCreatedAfter; } /** * The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. * * @param string $dateCreatedBefore The `YYYY-MM-DD` value of the resources to * read * @return $this Fluent Builder */ public function setDateCreatedBefore(string $dateCreatedBefore): self { $this->options['dateCreatedBefore'] = $dateCreatedBefore; return $this; } /** * The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. * * @param string $dateCreated The `YYYY-MM-DD` value of the resources to read * @return $this Fluent Builder */ public function setDateCreated(string $dateCreated): self { $this->options['dateCreated'] = $dateCreated; return $this; } /** * The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. * * @param string $dateCreatedAfter The `YYYY-MM-DD` value of the resources to * read * @return $this Fluent Builder */ public function setDateCreatedAfter(string $dateCreatedAfter): self { $this->options['dateCreatedAfter'] = $dateCreatedAfter; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadRecordingOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/Call/FeedbackPage.php000064400000002416150515725670016221 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return FeedbackInstance \Twilio\Rest\Api\V2010\Account\Call\FeedbackInstance */ public function buildInstance(array $payload): FeedbackInstance { return new FeedbackInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['callSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.FeedbackPage]'; } }src/Twilio/Rest/Api/V2010/Account/Call/FeedbackSummaryContext.php000064400000004174150515725670020352 0ustar00solution = ['accountSid' => $accountSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Calls/FeedbackSummary/' . \rawurlencode($sid) . '.json'; } /** * Fetch the FeedbackSummaryInstance * * @return FeedbackSummaryInstance Fetched FeedbackSummaryInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FeedbackSummaryInstance { $payload = $this->version->fetch('GET', $this->uri); return new FeedbackSummaryInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Delete the FeedbackSummaryInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.FeedbackSummaryContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Call/FeedbackSummaryOptions.php000064400000007303150515725670020356 0ustar00options['includeSubaccounts'] = $includeSubaccounts; $this->options['statusCallback'] = $statusCallback; $this->options['statusCallbackMethod'] = $statusCallbackMethod; } /** * Whether to also include Feedback resources from all subaccounts. `true` includes feedback from all subaccounts and `false`, the default, includes feedback from only the specified account. * * @param bool $includeSubaccounts `true` includes feedback from the specified * account and its subaccounts * @return $this Fluent Builder */ public function setIncludeSubaccounts(bool $includeSubaccounts): self { $this->options['includeSubaccounts'] = $includeSubaccounts; return $this; } /** * The URL that we will request when the feedback summary is complete. * * @param string $statusCallback The URL that we will request when the feedback * summary is complete * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * The HTTP method (`GET` or `POST`) we use to make the request to the `StatusCallback` URL. * * @param string $statusCallbackMethod The HTTP method we use to make requests * to the StatusCallback URL * @return $this Fluent Builder */ public function setStatusCallbackMethod(string $statusCallbackMethod): self { $this->options['statusCallbackMethod'] = $statusCallbackMethod; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.CreateFeedbackSummaryOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/Call/EventInstance.php000064400000003655150515725670016514 0ustar00properties = [ 'request' => Values::array_get($payload, 'request'), 'response' => Values::array_get($payload, 'response'), ]; $this->solution = ['accountSid' => $accountSid, 'callSid' => $callSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Api.V2010.EventInstance]'; } }src/Twilio/Rest/Api/V2010/Account/Call/FeedbackContext.php000064400000006663150515725670017001 0ustar00solution = ['accountSid' => $accountSid, 'callSid' => $callSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Calls/' . \rawurlencode($callSid) . '/Feedback.json'; } /** * Fetch the FeedbackInstance * * @return FeedbackInstance Fetched FeedbackInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FeedbackInstance { $payload = $this->version->fetch('GET', $this->uri); return new FeedbackInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['callSid'] ); } /** * Create the FeedbackInstance * * @param int $qualityScore The call quality expressed as an integer from 1 to 5 * @param array|Options $options Optional Arguments * @return FeedbackInstance Created FeedbackInstance * @throws TwilioException When an HTTP error occurs. */ public function create(int $qualityScore, array $options = []): FeedbackInstance { $options = new Values($options); $data = Values::of([ 'QualityScore' => $qualityScore, 'Issue' => Serialize::map($options['issue'], function($e) { return $e; }), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new FeedbackInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['callSid'] ); } /** * Update the FeedbackInstance * * @param array|Options $options Optional Arguments * @return FeedbackInstance Updated FeedbackInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): FeedbackInstance { $options = new Values($options); $data = Values::of([ 'QualityScore' => $options['qualityScore'], 'Issue' => Serialize::map($options['issue'], function($e) { return $e; }), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new FeedbackInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['callSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.FeedbackContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Call/SiprecContext.php000064400000004070150515725670016530 0ustar00solution = ['accountSid' => $accountSid, 'callSid' => $callSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Calls/' . \rawurlencode($callSid) . '/Siprec/' . \rawurlencode($sid) . '.json'; } /** * Update the SiprecInstance * * @param string $status The status. Must have the value `stopped` * @return SiprecInstance Updated SiprecInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $status): SiprecInstance { $data = Values::of(['Status' => $status, ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new SiprecInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['callSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.SiprecContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Call/EventList.php000064400000011067150515725670015657 0ustar00solution = ['accountSid' => $accountSid, 'callSid' => $callSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Calls/' . \rawurlencode($callSid) . '/Events.json'; } /** * Streams EventInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads EventInstance 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 EventInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of EventInstance 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 EventPage Page of EventInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): EventPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new EventPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of EventInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return EventPage Page of EventInstance */ public function getPage(string $targetUrl): EventPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new EventPage($this->version, $response, $this->solution); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.EventList]'; } }src/Twilio/Rest/Api/V2010/Account/Call/RecordingList.php000064400000015357150515725670016520 0ustar00solution = ['accountSid' => $accountSid, 'callSid' => $callSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Calls/' . \rawurlencode($callSid) . '/Recordings.json'; } /** * Create the RecordingInstance * * @param array|Options $options Optional Arguments * @return RecordingInstance Created RecordingInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): RecordingInstance { $options = new Values($options); $data = Values::of([ 'RecordingStatusCallbackEvent' => Serialize::map($options['recordingStatusCallbackEvent'], function($e) { return $e; }), 'RecordingStatusCallback' => $options['recordingStatusCallback'], 'RecordingStatusCallbackMethod' => $options['recordingStatusCallbackMethod'], 'Trim' => $options['trim'], 'RecordingChannels' => $options['recordingChannels'], 'RecordingTrack' => $options['recordingTrack'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new RecordingInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['callSid'] ); } /** * Streams RecordingInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads RecordingInstance 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 RecordingInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of RecordingInstance 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 RecordingPage Page of RecordingInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): RecordingPage { $options = new Values($options); $params = Values::of([ 'DateCreated<' => Serialize::iso8601Date($options['dateCreatedBefore']), 'DateCreated' => Serialize::iso8601Date($options['dateCreated']), 'DateCreated>' => Serialize::iso8601Date($options['dateCreatedAfter']), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new RecordingPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of RecordingInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return RecordingPage Page of RecordingInstance */ public function getPage(string $targetUrl): RecordingPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new RecordingPage($this->version, $response, $this->solution); } /** * Constructs a RecordingContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): RecordingContext { return new RecordingContext( $this->version, $this->solution['accountSid'], $this->solution['callSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.RecordingList]'; } }src/Twilio/Rest/Api/V2010/Account/Call/PaymentOptions.php000064400000043147150515725670016737 0ustar00 should wait for the * caller to press a digit between each subsequent digit, * after the first one, before moving on to validate the * digits captured. * @param string $tokenType Indicates whether the payment method should be * tokenized as a `one-time` or `reusable` token. * @param string $validCardTypes Credit card types separated by space that Pay * should accept. * @return CreatePaymentOptions Options builder */ public static function create(string $bankAccountType = Values::NONE, string $chargeAmount = Values::NONE, string $currency = Values::NONE, string $description = Values::NONE, string $input = Values::NONE, int $minPostalCodeLength = Values::NONE, array $parameter = Values::ARRAY_NONE, string $paymentConnector = Values::NONE, string $paymentMethod = Values::NONE, bool $postalCode = Values::NONE, bool $securityCode = Values::NONE, int $timeout = Values::NONE, string $tokenType = Values::NONE, string $validCardTypes = Values::NONE): CreatePaymentOptions { return new CreatePaymentOptions($bankAccountType, $chargeAmount, $currency, $description, $input, $minPostalCodeLength, $parameter, $paymentConnector, $paymentMethod, $postalCode, $securityCode, $timeout, $tokenType, $validCardTypes); } /** * @param string $capture The piece of payment information that you wish the * caller to enter. * @param string $status Indicates whether the current payment session should * be cancelled or completed. * @return UpdatePaymentOptions Options builder */ public static function update(string $capture = Values::NONE, string $status = Values::NONE): UpdatePaymentOptions { return new UpdatePaymentOptions($capture, $status); } } class CreatePaymentOptions extends Options { /** * @param string $bankAccountType Type of bank account if payment source is ACH. * @param string $chargeAmount A positive decimal value less than 1,000,000 to * charge against the credit card or bank account. * @param string $currency The currency of the `charge_amount`. * @param string $description The description can be used to provide more * details regarding the transaction. * @param string $input A list of inputs that should be accepted. Currently * only `dtmf` is supported. * @param int $minPostalCodeLength A positive integer that is used to validate * the length of the `PostalCode` inputted by * the user. * @param array $parameter A single level JSON string that is required when * accepting certain information specific only to ACH * payments. * @param string $paymentConnector This is the unique name corresponding to the * Payment Gateway Connector installed in the * Twilio Add-ons. * @param string $paymentMethod Type of payment being captured. * @param bool $postalCode Indicates whether the credit card PostalCode (zip * code) is a required piece of payment information * that must be provided by the caller. * @param bool $securityCode Indicates whether the credit card security code is * a required piece of payment information that must * be provided by the caller. * @param int $timeout The number of seconds that should wait for the * caller to press a digit between each subsequent digit, * after the first one, before moving on to validate the * digits captured. * @param string $tokenType Indicates whether the payment method should be * tokenized as a `one-time` or `reusable` token. * @param string $validCardTypes Credit card types separated by space that Pay * should accept. */ public function __construct(string $bankAccountType = Values::NONE, string $chargeAmount = Values::NONE, string $currency = Values::NONE, string $description = Values::NONE, string $input = Values::NONE, int $minPostalCodeLength = Values::NONE, array $parameter = Values::ARRAY_NONE, string $paymentConnector = Values::NONE, string $paymentMethod = Values::NONE, bool $postalCode = Values::NONE, bool $securityCode = Values::NONE, int $timeout = Values::NONE, string $tokenType = Values::NONE, string $validCardTypes = Values::NONE) { $this->options['bankAccountType'] = $bankAccountType; $this->options['chargeAmount'] = $chargeAmount; $this->options['currency'] = $currency; $this->options['description'] = $description; $this->options['input'] = $input; $this->options['minPostalCodeLength'] = $minPostalCodeLength; $this->options['parameter'] = $parameter; $this->options['paymentConnector'] = $paymentConnector; $this->options['paymentMethod'] = $paymentMethod; $this->options['postalCode'] = $postalCode; $this->options['securityCode'] = $securityCode; $this->options['timeout'] = $timeout; $this->options['tokenType'] = $tokenType; $this->options['validCardTypes'] = $validCardTypes; } /** * Type of bank account if payment source is ACH. One of `consumer-checking`, `consumer-savings`, or `commercial-checking`. The default value is `consumer-checking`. * * @param string $bankAccountType Type of bank account if payment source is ACH. * @return $this Fluent Builder */ public function setBankAccountType(string $bankAccountType): self { $this->options['bankAccountType'] = $bankAccountType; return $this; } /** * A positive decimal value less than 1,000,000 to charge against the credit card or bank account. Default currency can be overwritten with `currency` field. Leave blank or set to 0 to tokenize. * * @param string $chargeAmount A positive decimal value less than 1,000,000 to * charge against the credit card or bank account. * @return $this Fluent Builder */ public function setChargeAmount(string $chargeAmount): self { $this->options['chargeAmount'] = $chargeAmount; return $this; } /** * The currency of the `charge_amount`, formatted as [ISO 4127](http://www.iso.org/iso/home/standards/currency_codes.htm) format. The default value is `USD` and all values allowed from the Connector are accepted. * * @param string $currency The currency of the `charge_amount`. * @return $this Fluent Builder */ public function setCurrency(string $currency): self { $this->options['currency'] = $currency; return $this; } /** * The description can be used to provide more details regarding the transaction. This information is submitted along with the payment details to the Payment Connector which are then posted on the transactions. * * @param string $description The description can be used to provide more * details regarding the transaction. * @return $this Fluent Builder */ public function setDescription(string $description): self { $this->options['description'] = $description; return $this; } /** * A list of inputs that should be accepted. Currently only `dtmf` is supported. All digits captured during a pay session are redacted from the logs. * * @param string $input A list of inputs that should be accepted. Currently * only `dtmf` is supported. * @return $this Fluent Builder */ public function setInput(string $input): self { $this->options['input'] = $input; return $this; } /** * A positive integer that is used to validate the length of the `PostalCode` inputted by the user. User must enter this many digits. * * @param int $minPostalCodeLength A positive integer that is used to validate * the length of the `PostalCode` inputted by * the user. * @return $this Fluent Builder */ public function setMinPostalCodeLength(int $minPostalCodeLength): self { $this->options['minPostalCodeLength'] = $minPostalCodeLength; return $this; } /** * A single level JSON string that is required when accepting certain information specific only to ACH payments. The information that has to be included here depends on the Connector. [Read more](https://www.twilio.com/console/voice/pay-connectors). * * @param array $parameter A single level JSON string that is required when * accepting certain information specific only to ACH * payments. * @return $this Fluent Builder */ public function setParameter(array $parameter): self { $this->options['parameter'] = $parameter; return $this; } /** * This is the unique name corresponding to the Payment Gateway Connector installed in the Twilio Add-ons. Learn more about [ Connectors](https://www.twilio.com/console/voice/pay-connectors). The default value is `Default`. * * @param string $paymentConnector This is the unique name corresponding to the * Payment Gateway Connector installed in the * Twilio Add-ons. * @return $this Fluent Builder */ public function setPaymentConnector(string $paymentConnector): self { $this->options['paymentConnector'] = $paymentConnector; return $this; } /** * Type of payment being captured. One of `credit-card` or `ach-debit`. The default value is `credit-card`. * * @param string $paymentMethod Type of payment being captured. * @return $this Fluent Builder */ public function setPaymentMethod(string $paymentMethod): self { $this->options['paymentMethod'] = $paymentMethod; return $this; } /** * Indicates whether the credit card postal code (zip code) is a required piece of payment information that must be provided by the caller. The default is `true`. * * @param bool $postalCode Indicates whether the credit card PostalCode (zip * code) is a required piece of payment information * that must be provided by the caller. * @return $this Fluent Builder */ public function setPostalCode(bool $postalCode): self { $this->options['postalCode'] = $postalCode; return $this; } /** * Indicates whether the credit card security code is a required piece of payment information that must be provided by the caller. The default is `true`. * * @param bool $securityCode Indicates whether the credit card security code is * a required piece of payment information that must * be provided by the caller. * @return $this Fluent Builder */ public function setSecurityCode(bool $securityCode): self { $this->options['securityCode'] = $securityCode; return $this; } /** * The number of seconds that should wait for the caller to press a digit between each subsequent digit, after the first one, before moving on to validate the digits captured. The default is `5`, maximum is `600`. * * @param int $timeout The number of seconds that should wait for the * caller to press a digit between each subsequent digit, * after the first one, before moving on to validate the * digits captured. * @return $this Fluent Builder */ public function setTimeout(int $timeout): self { $this->options['timeout'] = $timeout; return $this; } /** * Indicates whether the payment method should be tokenized as a `one-time` or `reusable` token. The default value is `reusable`. Do not enter a charge amount when tokenizing. If a charge amount is entered, the payment method will be charged and not tokenized. * * @param string $tokenType Indicates whether the payment method should be * tokenized as a `one-time` or `reusable` token. * @return $this Fluent Builder */ public function setTokenType(string $tokenType): self { $this->options['tokenType'] = $tokenType; return $this; } /** * Credit card types separated by space that Pay should accept. The default value is `visa mastercard amex` * * @param string $validCardTypes Credit card types separated by space that Pay * should accept. * @return $this Fluent Builder */ public function setValidCardTypes(string $validCardTypes): self { $this->options['validCardTypes'] = $validCardTypes; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.CreatePaymentOptions ' . $options . ']'; } } class UpdatePaymentOptions extends Options { /** * @param string $capture The piece of payment information that you wish the * caller to enter. * @param string $status Indicates whether the current payment session should * be cancelled or completed. */ public function __construct(string $capture = Values::NONE, string $status = Values::NONE) { $this->options['capture'] = $capture; $this->options['status'] = $status; } /** * The piece of payment information that you wish the caller to enter. Must be one of `payment-card-number`, `expiration-date`, `security-code`, `postal-code`, `bank-routing-number`, or `bank-account-number`. * * @param string $capture The piece of payment information that you wish the * caller to enter. * @return $this Fluent Builder */ public function setCapture(string $capture): self { $this->options['capture'] = $capture; return $this; } /** * Indicates whether the current payment session should be cancelled or completed. When `cancel` the payment session is cancelled. When `complete`, Twilio sends the payment information to the selected connector for processing. * * @param string $status Indicates whether the current payment session should * be cancelled or completed. * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.UpdatePaymentOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/Call/NotificationList.php000064400000013317150515725670017224 0ustar00solution = ['accountSid' => $accountSid, 'callSid' => $callSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Calls/' . \rawurlencode($callSid) . '/Notifications.json'; } /** * Streams NotificationInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads NotificationInstance 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 NotificationInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of NotificationInstance 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 NotificationPage Page of NotificationInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): NotificationPage { $options = new Values($options); $params = Values::of([ 'Log' => $options['log'], 'MessageDate<' => Serialize::iso8601Date($options['messageDateBefore']), 'MessageDate' => Serialize::iso8601Date($options['messageDate']), 'MessageDate>' => Serialize::iso8601Date($options['messageDateAfter']), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new NotificationPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of NotificationInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return NotificationPage Page of NotificationInstance */ public function getPage(string $targetUrl): NotificationPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new NotificationPage($this->version, $response, $this->solution); } /** * Constructs a NotificationContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): NotificationContext { return new NotificationContext( $this->version, $this->solution['accountSid'], $this->solution['callSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.NotificationList]'; } }src/Twilio/Rest/Api/V2010/Account/Call/SiprecPage.php000064400000002402150515725670015755 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SiprecInstance \Twilio\Rest\Api\V2010\Account\Call\SiprecInstance */ public function buildInstance(array $payload): SiprecInstance { return new SiprecInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['callSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.SiprecPage]'; } }src/Twilio/Rest/Api/V2010/Account/Call/PaymentContext.php000064400000005757150515725670016735 0ustar00solution = ['accountSid' => $accountSid, 'callSid' => $callSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Calls/' . \rawurlencode($callSid) . '/Payments/' . \rawurlencode($sid) . '.json'; } /** * Update the PaymentInstance * * @param string $idempotencyKey A unique token that will be used to ensure * that multiple API calls with the same * information do not result in multiple * transactions. * @param string $statusCallback Provide an absolute or relative URL to receive * status updates regarding your Pay session. * @param array|Options $options Optional Arguments * @return PaymentInstance Updated PaymentInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $idempotencyKey, string $statusCallback, array $options = []): PaymentInstance { $options = new Values($options); $data = Values::of([ 'IdempotencyKey' => $idempotencyKey, 'StatusCallback' => $statusCallback, 'Capture' => $options['capture'], 'Status' => $options['status'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new PaymentInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['callSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.PaymentContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Call/FeedbackSummaryPage.php000064400000002342150515725670017575 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return FeedbackSummaryInstance \Twilio\Rest\Api\V2010\Account\Call\FeedbackSummaryInstance */ public function buildInstance(array $payload): FeedbackSummaryInstance { return new FeedbackSummaryInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.FeedbackSummaryPage]'; } }src/Twilio/Rest/Api/V2010/Account/Call/RecordingContext.php000064400000006070150515725670017221 0ustar00solution = ['accountSid' => $accountSid, 'callSid' => $callSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Calls/' . \rawurlencode($callSid) . '/Recordings/' . \rawurlencode($sid) . '.json'; } /** * Update the RecordingInstance * * @param string $status The new status of the recording * @param array|Options $options Optional Arguments * @return RecordingInstance Updated RecordingInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $status, array $options = []): RecordingInstance { $options = new Values($options); $data = Values::of(['Status' => $status, 'PauseBehavior' => $options['pauseBehavior'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new RecordingInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['callSid'], $this->solution['sid'] ); } /** * Fetch the RecordingInstance * * @return RecordingInstance Fetched RecordingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RecordingInstance { $payload = $this->version->fetch('GET', $this->uri); return new RecordingInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['callSid'], $this->solution['sid'] ); } /** * Delete the RecordingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.RecordingContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Call/PaymentList.php000064400000007472150515725670016220 0ustar00solution = ['accountSid' => $accountSid, 'callSid' => $callSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Calls/' . \rawurlencode($callSid) . '/Payments.json'; } /** * Create the PaymentInstance * * @param string $idempotencyKey A unique token that will be used to ensure * that multiple API calls with the same * information do not result in multiple * transactions. * @param string $statusCallback Provide an absolute or relative URL to receive * status updates regarding your Pay session.. * @param array|Options $options Optional Arguments * @return PaymentInstance Created PaymentInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $idempotencyKey, string $statusCallback, array $options = []): PaymentInstance { $options = new Values($options); $data = Values::of([ 'IdempotencyKey' => $idempotencyKey, 'StatusCallback' => $statusCallback, 'BankAccountType' => $options['bankAccountType'], 'ChargeAmount' => $options['chargeAmount'], 'Currency' => $options['currency'], 'Description' => $options['description'], 'Input' => $options['input'], 'MinPostalCodeLength' => $options['minPostalCodeLength'], 'Parameter' => Serialize::jsonObject($options['parameter']), 'PaymentConnector' => $options['paymentConnector'], 'PaymentMethod' => $options['paymentMethod'], 'PostalCode' => Serialize::booleanToString($options['postalCode']), 'SecurityCode' => Serialize::booleanToString($options['securityCode']), 'Timeout' => $options['timeout'], 'TokenType' => $options['tokenType'], 'ValidCardTypes' => $options['validCardTypes'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new PaymentInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['callSid'] ); } /** * Constructs a PaymentContext * * @param string $sid The SID of Payments session */ public function getContext(string $sid): PaymentContext { return new PaymentContext( $this->version, $this->solution['accountSid'], $this->solution['callSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.PaymentList]'; } }src/Twilio/Rest/Api/V2010/Account/Call/EventPage.php000064400000002374150515725670015621 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return EventInstance \Twilio\Rest\Api\V2010\Account\Call\EventInstance */ public function buildInstance(array $payload): EventInstance { return new EventInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['callSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.EventPage]'; } }src/Twilio/Rest/Api/V2010/Account/Call/PaymentPage.php000064400000002723150515725670016153 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return PaymentInstance \Twilio\Rest\Api\V2010\Account\Call\PaymentInstance */ public function buildInstance(array $payload): PaymentInstance { return new PaymentInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['callSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.PaymentPage]'; } }src/Twilio/Rest/Api/V2010/Account/Call/RecordingInstance.php000064400000012752150515725670017345 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'apiVersion' => Values::array_get($payload, 'api_version'), 'callSid' => Values::array_get($payload, 'call_sid'), 'conferenceSid' => Values::array_get($payload, 'conference_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'startTime' => Deserialize::dateTime(Values::array_get($payload, 'start_time')), 'duration' => Values::array_get($payload, 'duration'), 'sid' => Values::array_get($payload, 'sid'), 'price' => Values::array_get($payload, 'price'), 'uri' => Values::array_get($payload, 'uri'), 'encryptionDetails' => Values::array_get($payload, 'encryption_details'), 'priceUnit' => Values::array_get($payload, 'price_unit'), 'status' => Values::array_get($payload, 'status'), 'channels' => Values::array_get($payload, 'channels'), 'source' => Values::array_get($payload, 'source'), 'errorCode' => Values::array_get($payload, 'error_code'), 'track' => Values::array_get($payload, 'track'), ]; $this->solution = [ 'accountSid' => $accountSid, 'callSid' => $callSid, '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 RecordingContext Context for this RecordingInstance */ protected function proxy(): RecordingContext { if (!$this->context) { $this->context = new RecordingContext( $this->version, $this->solution['accountSid'], $this->solution['callSid'], $this->solution['sid'] ); } return $this->context; } /** * Update the RecordingInstance * * @param string $status The new status of the recording * @param array|Options $options Optional Arguments * @return RecordingInstance Updated RecordingInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $status, array $options = []): RecordingInstance { return $this->proxy()->update($status, $options); } /** * Fetch the RecordingInstance * * @return RecordingInstance Fetched RecordingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RecordingInstance { return $this->proxy()->fetch(); } /** * Delete the RecordingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.RecordingInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Call/SiprecInstance.php000064400000007153150515725670016655 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'callSid' => Values::array_get($payload, 'call_sid'), 'name' => Values::array_get($payload, 'name'), 'status' => Values::array_get($payload, 'status'), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), ]; $this->solution = [ 'accountSid' => $accountSid, 'callSid' => $callSid, '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 SiprecContext Context for this SiprecInstance */ protected function proxy(): SiprecContext { if (!$this->context) { $this->context = new SiprecContext( $this->version, $this->solution['accountSid'], $this->solution['callSid'], $this->solution['sid'] ); } return $this->context; } /** * Update the SiprecInstance * * @param string $status The status. Must have the value `stopped` * @return SiprecInstance Updated SiprecInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $status): SiprecInstance { return $this->proxy()->update($status); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.SiprecInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Call/RecordingPage.php000064400000002424150515725670016450 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return RecordingInstance \Twilio\Rest\Api\V2010\Account\Call\RecordingInstance */ public function buildInstance(array $payload): RecordingInstance { return new RecordingInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['callSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.RecordingPage]'; } }src/Twilio/Rest/Api/V2010/Account/Call/PaymentInstance.php000064400000010626150515725670017044 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'callSid' => Values::array_get($payload, 'call_sid'), 'sid' => Values::array_get($payload, 'sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'uri' => Values::array_get($payload, 'uri'), ]; $this->solution = [ 'accountSid' => $accountSid, 'callSid' => $callSid, '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 PaymentContext Context for this PaymentInstance */ protected function proxy(): PaymentContext { if (!$this->context) { $this->context = new PaymentContext( $this->version, $this->solution['accountSid'], $this->solution['callSid'], $this->solution['sid'] ); } return $this->context; } /** * Update the PaymentInstance * * @param string $idempotencyKey A unique token that will be used to ensure * that multiple API calls with the same * information do not result in multiple * transactions. * @param string $statusCallback Provide an absolute or relative URL to receive * status updates regarding your Pay session. * @param array|Options $options Optional Arguments * @return PaymentInstance Updated PaymentInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $idempotencyKey, string $statusCallback, array $options = []): PaymentInstance { return $this->proxy()->update($idempotencyKey, $statusCallback, $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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.PaymentInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/NewSigningKeyOptions.php000064400000002773150515725670017170 0ustar00options['friendlyName'] = $friendlyName; } /** * A descriptive string that you create to describe the resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.CreateNewSigningKeyOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/AddressOptions.php000064400000027726150515725670016041 0ustar00options['friendlyName'] = $friendlyName; $this->options['emergencyEnabled'] = $emergencyEnabled; $this->options['autoCorrectAddress'] = $autoCorrectAddress; } /** * A descriptive string that you create to describe the new address. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the new resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Whether to enable emergency calling on the new address. Can be: `true` or `false`. * * @param bool $emergencyEnabled Whether to enable emergency calling on the new * address * @return $this Fluent Builder */ public function setEmergencyEnabled(bool $emergencyEnabled): self { $this->options['emergencyEnabled'] = $emergencyEnabled; return $this; } /** * Whether we should automatically correct the address. Can be: `true` or `false` and the default is `true`. If empty or `true`, we will correct the address you provide if necessary. If `false`, we won't alter the address you provide. * * @param bool $autoCorrectAddress Whether we should automatically correct the * address * @return $this Fluent Builder */ public function setAutoCorrectAddress(bool $autoCorrectAddress): self { $this->options['autoCorrectAddress'] = $autoCorrectAddress; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.CreateAddressOptions ' . $options . ']'; } } class UpdateAddressOptions extends Options { /** * @param string $friendlyName A string to describe the resource * @param string $customerName The name to associate with the address * @param string $street The number and street address of the address * @param string $city The city of the address * @param string $region The state or region of the address * @param string $postalCode The postal code of the address * @param bool $emergencyEnabled Whether to enable emergency calling on the * address * @param bool $autoCorrectAddress Whether we should automatically correct the * address */ public function __construct(string $friendlyName = Values::NONE, string $customerName = Values::NONE, string $street = Values::NONE, string $city = Values::NONE, string $region = Values::NONE, string $postalCode = Values::NONE, bool $emergencyEnabled = Values::NONE, bool $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; } /** * A descriptive string that you create to describe the address. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The name to associate with the address. * * @param string $customerName The name to associate with the address * @return $this Fluent Builder */ public function setCustomerName(string $customerName): self { $this->options['customerName'] = $customerName; return $this; } /** * The number and street address of the address. * * @param string $street The number and street address of the address * @return $this Fluent Builder */ public function setStreet(string $street): self { $this->options['street'] = $street; return $this; } /** * The city of the address. * * @param string $city The city of the address * @return $this Fluent Builder */ public function setCity(string $city): self { $this->options['city'] = $city; return $this; } /** * The state or region of the address. * * @param string $region The state or region of the address * @return $this Fluent Builder */ public function setRegion(string $region): self { $this->options['region'] = $region; return $this; } /** * The postal code of the address. * * @param string $postalCode The postal code of the address * @return $this Fluent Builder */ public function setPostalCode(string $postalCode): self { $this->options['postalCode'] = $postalCode; return $this; } /** * Whether to enable emergency calling on the address. Can be: `true` or `false`. * * @param bool $emergencyEnabled Whether to enable emergency calling on the * address * @return $this Fluent Builder */ public function setEmergencyEnabled(bool $emergencyEnabled): self { $this->options['emergencyEnabled'] = $emergencyEnabled; return $this; } /** * Whether we should automatically correct the address. Can be: `true` or `false` and the default is `true`. If empty or `true`, we will correct the address you provide if necessary. If `false`, we won't alter the address you provide. * * @param bool $autoCorrectAddress Whether we should automatically correct the * address * @return $this Fluent Builder */ public function setAutoCorrectAddress(bool $autoCorrectAddress): self { $this->options['autoCorrectAddress'] = $autoCorrectAddress; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.UpdateAddressOptions ' . $options . ']'; } } class ReadAddressOptions extends Options { /** * @param string $customerName The `customer_name` of the Address resources to * read * @param string $friendlyName The string that identifies the Address resources * to read * @param string $isoCountry The ISO country code of the Address resources to * read */ public function __construct(string $customerName = Values::NONE, string $friendlyName = Values::NONE, string $isoCountry = Values::NONE) { $this->options['customerName'] = $customerName; $this->options['friendlyName'] = $friendlyName; $this->options['isoCountry'] = $isoCountry; } /** * The `customer_name` of the Address resources to read. * * @param string $customerName The `customer_name` of the Address resources to * read * @return $this Fluent Builder */ public function setCustomerName(string $customerName): self { $this->options['customerName'] = $customerName; return $this; } /** * The string that identifies the Address resources to read. * * @param string $friendlyName The string that identifies the Address resources * to read * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The ISO country code of the Address resources to read. * * @param string $isoCountry The ISO country code of the Address resources to * read * @return $this Fluent Builder */ public function setIsoCountry(string $isoCountry): self { $this->options['isoCountry'] = $isoCountry; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadAddressOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/AddressPage.php000064400000002250150515725670015243 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return AddressInstance \Twilio\Rest\Api\V2010\Account\AddressInstance */ public function buildInstance(array $payload): AddressInstance { return new AddressInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.AddressPage]'; } }src/Twilio/Rest/Api/V2010/Account/MessageContext.php000064400000011476150515725670016024 0ustar00solution = ['accountSid' => $accountSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Messages/' . \rawurlencode($sid) . '.json'; } /** * Delete the MessageInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Fetch the MessageInstance * * @return MessageInstance Fetched MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MessageInstance { $payload = $this->version->fetch('GET', $this->uri); return new MessageInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Update the MessageInstance * * @param array|Options $options Optional Arguments * @return MessageInstance Updated MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): MessageInstance { $options = new Values($options); $data = Values::of(['Body' => $options['body'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new MessageInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Access the media */ protected function getMedia(): MediaList { if (!$this->_media) { $this->_media = new MediaList( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->_media; } /** * Access the feedback */ protected function getFeedback(): FeedbackList { if (!$this->_feedback) { $this->_feedback = new FeedbackList( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->_feedback; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.MessageContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/NewKeyOptions.php000064400000002721150515725670015642 0ustar00options['friendlyName'] = $friendlyName; } /** * A descriptive string that you create to describe the resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.CreateNewKeyOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/NewSigningKeyList.php000064400000003264150515725670016444 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/SigningKeys.json'; } /** * Create the NewSigningKeyInstance * * @param array|Options $options Optional Arguments * @return NewSigningKeyInstance Created NewSigningKeyInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): NewSigningKeyInstance { $options = new Values($options); $data = Values::of(['FriendlyName' => $options['friendlyName'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new NewSigningKeyInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.NewSigningKeyList]'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/NationalInstance.php000064400000006044150515725670023727 0ustar00properties = [ '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 = ['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(string $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(): string { return '[Twilio.Api.V2010.NationalInstance]'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/MobileInstance.php000064400000006036150515725670023372 0ustar00properties = [ '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 = ['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(string $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(): string { return '[Twilio.Api.V2010.MobileInstance]'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/MobilePage.php000064400000002464150515725670022503 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return MobileInstance \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\MobileInstance */ public function buildInstance(array $payload): MobileInstance { return new MobileInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['countryCode'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.MobilePage]'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/NationalPage.php000064400000002500150515725670023030 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return NationalInstance \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\NationalInstance */ public function buildInstance(array $payload): NationalInstance { return new NationalInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['countryCode'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.NationalPage]'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/TollFreeList.php000064400000014322150515725670023043 0ustar00solution = ['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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $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(array $options = [], int $limit = null, $pageSize = null): array { 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 TollFreePage Page of TollFreeInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): TollFreePage { $options = new Values($options); $params = Values::of([ '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 TollFreePage Page of TollFreeInstance */ public function getPage(string $targetUrl): TollFreePage { $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(): string { return '[Twilio.Api.V2010.TollFreeList]'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/NationalList.php000064400000014322150515725670023074 0ustar00solution = ['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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $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(array $options = [], int $limit = null, $pageSize = null): array { 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 NationalPage Page of NationalInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): NationalPage { $options = new Values($options); $params = Values::of([ '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 NationalPage Page of NationalInstance */ public function getPage(string $targetUrl): NationalPage { $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(): string { return '[Twilio.Api.V2010.NationalList]'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/SharedCostOptions.php000064400000041003150515725670024102 0ustar00options['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 of the phone numbers to read. Applies to only phone numbers in the US and Canada. * * @param int $areaCode The area code of the phone numbers to read * @return $this Fluent Builder */ public function setAreaCode(int $areaCode): self { $this->options['areaCode'] = $areaCode; return $this; } /** * The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. * * @param string $contains The pattern on which to match phone numbers * @return $this Fluent Builder */ public function setContains(string $contains): self { $this->options['contains'] = $contains; return $this; } /** * Whether the phone numbers can receive text messages. Can be: `true` or `false`. * * @param bool $smsEnabled Whether the phone numbers can receive text messages * @return $this Fluent Builder */ public function setSmsEnabled(bool $smsEnabled): self { $this->options['smsEnabled'] = $smsEnabled; return $this; } /** * Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. * * @param bool $mmsEnabled Whether the phone numbers can receive MMS messages * @return $this Fluent Builder */ public function setMmsEnabled(bool $mmsEnabled): self { $this->options['mmsEnabled'] = $mmsEnabled; return $this; } /** * Whether the phone numbers can receive calls. Can be: `true` or `false`. * * @param bool $voiceEnabled Whether the phone numbers can receive calls. * @return $this Fluent Builder */ public function setVoiceEnabled(bool $voiceEnabled): self { $this->options['voiceEnabled'] = $voiceEnabled; return $this; } /** * Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. * * @param bool $excludeAllAddressRequired Whether to exclude phone numbers that * require an Address * @return $this Fluent Builder */ public function setExcludeAllAddressRequired(bool $excludeAllAddressRequired): self { $this->options['excludeAllAddressRequired'] = $excludeAllAddressRequired; return $this; } /** * Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. * * @param bool $excludeLocalAddressRequired Whether to exclude phone numbers * that require a local address * @return $this Fluent Builder */ public function setExcludeLocalAddressRequired(bool $excludeLocalAddressRequired): self { $this->options['excludeLocalAddressRequired'] = $excludeLocalAddressRequired; return $this; } /** * Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. * * @param bool $excludeForeignAddressRequired Whether to exclude phone numbers * that require a foreign address * @return $this Fluent Builder */ public function setExcludeForeignAddressRequired(bool $excludeForeignAddressRequired): self { $this->options['excludeForeignAddressRequired'] = $excludeForeignAddressRequired; return $this; } /** * Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. * * @param bool $beta Whether to read phone numbers new to the Twilio platform * @return $this Fluent Builder */ public function setBeta(bool $beta): self { $this->options['beta'] = $beta; return $this; } /** * Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. * * @param string $nearNumber Given a phone number, find a geographically close * number within distance miles. (US/Canada only) * @return $this Fluent Builder */ public function setNearNumber(string $nearNumber): self { $this->options['nearNumber'] = $nearNumber; return $this; } /** * Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. * * @param string $nearLatLong Given a latitude/longitude pair lat,long find * geographically close numbers within distance * miles. (US/Canada only) * @return $this Fluent Builder */ public function setNearLatLong(string $nearLatLong): self { $this->options['nearLatLong'] = $nearLatLong; return $this; } /** * The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. * * @param int $distance The search radius, in miles, for a near_ query. * (US/Canada only) * @return $this Fluent Builder */ public function setDistance(int $distance): self { $this->options['distance'] = $distance; return $this; } /** * Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. * * @param string $inPostalCode Limit results to a particular postal code. * (US/Canada only) * @return $this Fluent Builder */ public function setInPostalCode(string $inPostalCode): self { $this->options['inPostalCode'] = $inPostalCode; return $this; } /** * Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. * * @param string $inRegion Limit results to a particular region. (US/Canada * only) * @return $this Fluent Builder */ public function setInRegion(string $inRegion): self { $this->options['inRegion'] = $inRegion; return $this; } /** * Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. * * @param string $inRateCenter Limit results to a specific rate center, or * given a phone number search within the same rate * center as that number. (US/Canada only) * @return $this Fluent Builder */ public function setInRateCenter(string $inRateCenter): self { $this->options['inRateCenter'] = $inRateCenter; return $this; } /** * Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. * * @param string $inLata Limit results to a specific local access and transport * area. (US/Canada only) * @return $this Fluent Builder */ public function setInLata(string $inLata): self { $this->options['inLata'] = $inLata; return $this; } /** * Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. * * @param string $inLocality Limit results to a particular locality * @return $this Fluent Builder */ public function setInLocality(string $inLocality): self { $this->options['inLocality'] = $inLocality; return $this; } /** * Whether the phone numbers can receive faxes. Can be: `true` or `false`. * * @param bool $faxEnabled Whether the phone numbers can receive faxes * @return $this Fluent Builder */ public function setFaxEnabled(bool $faxEnabled): self { $this->options['faxEnabled'] = $faxEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadSharedCostOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/TollFreePage.php000064400000002500150515725670022777 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return TollFreeInstance \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\TollFreeInstance */ public function buildInstance(array $payload): TollFreeInstance { return new TollFreeInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['countryCode'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.TollFreePage]'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/MachineToMachineList.php000064400000014532150515725670024466 0ustar00solution = ['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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $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(array $options = [], int $limit = null, $pageSize = null): array { 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 MachineToMachinePage Page of MachineToMachineInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): MachineToMachinePage { $options = new Values($options); $params = Values::of([ '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 MachineToMachinePage Page of MachineToMachineInstance */ public function getPage(string $targetUrl): MachineToMachinePage { $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(): string { return '[Twilio.Api.V2010.MachineToMachineList]'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/TollFreeOptions.php000064400000040767150515725670023577 0ustar00options['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 of the phone numbers to read. Applies to only phone numbers in the US and Canada. * * @param int $areaCode The area code of the phone numbers to read * @return $this Fluent Builder */ public function setAreaCode(int $areaCode): self { $this->options['areaCode'] = $areaCode; return $this; } /** * The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. * * @param string $contains The pattern on which to match phone numbers * @return $this Fluent Builder */ public function setContains(string $contains): self { $this->options['contains'] = $contains; return $this; } /** * Whether the phone numbers can receive text messages. Can be: `true` or `false`. * * @param bool $smsEnabled Whether the phone numbers can receive text messages * @return $this Fluent Builder */ public function setSmsEnabled(bool $smsEnabled): self { $this->options['smsEnabled'] = $smsEnabled; return $this; } /** * Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. * * @param bool $mmsEnabled Whether the phone numbers can receive MMS messages * @return $this Fluent Builder */ public function setMmsEnabled(bool $mmsEnabled): self { $this->options['mmsEnabled'] = $mmsEnabled; return $this; } /** * Whether the phone numbers can receive calls. Can be: `true` or `false`. * * @param bool $voiceEnabled Whether the phone numbers can receive calls. * @return $this Fluent Builder */ public function setVoiceEnabled(bool $voiceEnabled): self { $this->options['voiceEnabled'] = $voiceEnabled; return $this; } /** * Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. * * @param bool $excludeAllAddressRequired Whether to exclude phone numbers that * require an Address * @return $this Fluent Builder */ public function setExcludeAllAddressRequired(bool $excludeAllAddressRequired): self { $this->options['excludeAllAddressRequired'] = $excludeAllAddressRequired; return $this; } /** * Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. * * @param bool $excludeLocalAddressRequired Whether to exclude phone numbers * that require a local address * @return $this Fluent Builder */ public function setExcludeLocalAddressRequired(bool $excludeLocalAddressRequired): self { $this->options['excludeLocalAddressRequired'] = $excludeLocalAddressRequired; return $this; } /** * Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. * * @param bool $excludeForeignAddressRequired Whether to exclude phone numbers * that require a foreign address * @return $this Fluent Builder */ public function setExcludeForeignAddressRequired(bool $excludeForeignAddressRequired): self { $this->options['excludeForeignAddressRequired'] = $excludeForeignAddressRequired; return $this; } /** * Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. * * @param bool $beta Whether to read phone numbers new to the Twilio platform * @return $this Fluent Builder */ public function setBeta(bool $beta): self { $this->options['beta'] = $beta; return $this; } /** * Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. * * @param string $nearNumber Given a phone number, find a geographically close * number within distance miles. (US/Canada only) * @return $this Fluent Builder */ public function setNearNumber(string $nearNumber): self { $this->options['nearNumber'] = $nearNumber; return $this; } /** * Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. * * @param string $nearLatLong Given a latitude/longitude pair lat,long find * geographically close numbers within distance * miles. (US/Canada only) * @return $this Fluent Builder */ public function setNearLatLong(string $nearLatLong): self { $this->options['nearLatLong'] = $nearLatLong; return $this; } /** * The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. * * @param int $distance The search radius, in miles, for a near_ query. * (US/Canada only) * @return $this Fluent Builder */ public function setDistance(int $distance): self { $this->options['distance'] = $distance; return $this; } /** * Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. * * @param string $inPostalCode Limit results to a particular postal code. * (US/Canada only) * @return $this Fluent Builder */ public function setInPostalCode(string $inPostalCode): self { $this->options['inPostalCode'] = $inPostalCode; return $this; } /** * Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. * * @param string $inRegion Limit results to a particular region. (US/Canada * only) * @return $this Fluent Builder */ public function setInRegion(string $inRegion): self { $this->options['inRegion'] = $inRegion; return $this; } /** * Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. * * @param string $inRateCenter Limit results to a specific rate center, or * given a phone number search within the same rate * center as that number. (US/Canada only) * @return $this Fluent Builder */ public function setInRateCenter(string $inRateCenter): self { $this->options['inRateCenter'] = $inRateCenter; return $this; } /** * Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. * * @param string $inLata Limit results to a specific local access and transport * area. (US/Canada only) * @return $this Fluent Builder */ public function setInLata(string $inLata): self { $this->options['inLata'] = $inLata; return $this; } /** * Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. * * @param string $inLocality Limit results to a particular locality * @return $this Fluent Builder */ public function setInLocality(string $inLocality): self { $this->options['inLocality'] = $inLocality; return $this; } /** * Whether the phone numbers can receive faxes. Can be: `true` or `false`. * * @param bool $faxEnabled Whether the phone numbers can receive faxes * @return $this Fluent Builder */ public function setFaxEnabled(bool $faxEnabled): self { $this->options['faxEnabled'] = $faxEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadTollFreeOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/MachineToMachinePage.php000064400000002560150515725670024425 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return MachineToMachineInstance \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\MachineToMachineInstance */ public function buildInstance(array $payload): MachineToMachineInstance { return new MachineToMachineInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['countryCode'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.MachineToMachinePage]'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/MachineToMachineInstance.php000064400000006074150515725670025321 0ustar00properties = [ '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 = ['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(string $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(): string { return '[Twilio.Api.V2010.MachineToMachineInstance]'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/LocalList.php000064400000014237150515725670022366 0ustar00solution = ['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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $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(array $options = [], int $limit = null, $pageSize = null): array { 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 LocalPage Page of LocalInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): LocalPage { $options = new Values($options); $params = Values::of([ '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 LocalPage Page of LocalInstance */ public function getPage(string $targetUrl): LocalPage { $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(): string { return '[Twilio.Api.V2010.LocalList]'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/LocalInstance.php000064400000006033150515725670023212 0ustar00properties = [ '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 = ['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(string $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(): string { return '[Twilio.Api.V2010.LocalInstance]'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/SharedCostInstance.php000064400000006052150515725670024220 0ustar00properties = [ '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 = ['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(string $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(): string { return '[Twilio.Api.V2010.SharedCostInstance]'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/VoipOptions.php000064400000040737150515725670022775 0ustar00options['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 of the phone numbers to read. Applies to only phone numbers in the US and Canada. * * @param int $areaCode The area code of the phone numbers to read * @return $this Fluent Builder */ public function setAreaCode(int $areaCode): self { $this->options['areaCode'] = $areaCode; return $this; } /** * The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. * * @param string $contains The pattern on which to match phone numbers * @return $this Fluent Builder */ public function setContains(string $contains): self { $this->options['contains'] = $contains; return $this; } /** * Whether the phone numbers can receive text messages. Can be: `true` or `false`. * * @param bool $smsEnabled Whether the phone numbers can receive text messages * @return $this Fluent Builder */ public function setSmsEnabled(bool $smsEnabled): self { $this->options['smsEnabled'] = $smsEnabled; return $this; } /** * Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. * * @param bool $mmsEnabled Whether the phone numbers can receive MMS messages * @return $this Fluent Builder */ public function setMmsEnabled(bool $mmsEnabled): self { $this->options['mmsEnabled'] = $mmsEnabled; return $this; } /** * Whether the phone numbers can receive calls. Can be: `true` or `false`. * * @param bool $voiceEnabled Whether the phone numbers can receive calls. * @return $this Fluent Builder */ public function setVoiceEnabled(bool $voiceEnabled): self { $this->options['voiceEnabled'] = $voiceEnabled; return $this; } /** * Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. * * @param bool $excludeAllAddressRequired Whether to exclude phone numbers that * require an Address * @return $this Fluent Builder */ public function setExcludeAllAddressRequired(bool $excludeAllAddressRequired): self { $this->options['excludeAllAddressRequired'] = $excludeAllAddressRequired; return $this; } /** * Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. * * @param bool $excludeLocalAddressRequired Whether to exclude phone numbers * that require a local address * @return $this Fluent Builder */ public function setExcludeLocalAddressRequired(bool $excludeLocalAddressRequired): self { $this->options['excludeLocalAddressRequired'] = $excludeLocalAddressRequired; return $this; } /** * Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. * * @param bool $excludeForeignAddressRequired Whether to exclude phone numbers * that require a foreign address * @return $this Fluent Builder */ public function setExcludeForeignAddressRequired(bool $excludeForeignAddressRequired): self { $this->options['excludeForeignAddressRequired'] = $excludeForeignAddressRequired; return $this; } /** * Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. * * @param bool $beta Whether to read phone numbers new to the Twilio platform * @return $this Fluent Builder */ public function setBeta(bool $beta): self { $this->options['beta'] = $beta; return $this; } /** * Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. * * @param string $nearNumber Given a phone number, find a geographically close * number within distance miles. (US/Canada only) * @return $this Fluent Builder */ public function setNearNumber(string $nearNumber): self { $this->options['nearNumber'] = $nearNumber; return $this; } /** * Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. * * @param string $nearLatLong Given a latitude/longitude pair lat,long find * geographically close numbers within distance * miles. (US/Canada only) * @return $this Fluent Builder */ public function setNearLatLong(string $nearLatLong): self { $this->options['nearLatLong'] = $nearLatLong; return $this; } /** * The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. * * @param int $distance The search radius, in miles, for a near_ query. * (US/Canada only) * @return $this Fluent Builder */ public function setDistance(int $distance): self { $this->options['distance'] = $distance; return $this; } /** * Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. * * @param string $inPostalCode Limit results to a particular postal code. * (US/Canada only) * @return $this Fluent Builder */ public function setInPostalCode(string $inPostalCode): self { $this->options['inPostalCode'] = $inPostalCode; return $this; } /** * Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. * * @param string $inRegion Limit results to a particular region. (US/Canada * only) * @return $this Fluent Builder */ public function setInRegion(string $inRegion): self { $this->options['inRegion'] = $inRegion; return $this; } /** * Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. * * @param string $inRateCenter Limit results to a specific rate center, or * given a phone number search within the same rate * center as that number. (US/Canada only) * @return $this Fluent Builder */ public function setInRateCenter(string $inRateCenter): self { $this->options['inRateCenter'] = $inRateCenter; return $this; } /** * Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. * * @param string $inLata Limit results to a specific local access and transport * area. (US/Canada only) * @return $this Fluent Builder */ public function setInLata(string $inLata): self { $this->options['inLata'] = $inLata; return $this; } /** * Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. * * @param string $inLocality Limit results to a particular locality * @return $this Fluent Builder */ public function setInLocality(string $inLocality): self { $this->options['inLocality'] = $inLocality; return $this; } /** * Whether the phone numbers can receive faxes. Can be: `true` or `false`. * * @param bool $faxEnabled Whether the phone numbers can receive faxes * @return $this Fluent Builder */ public function setFaxEnabled(bool $faxEnabled): self { $this->options['faxEnabled'] = $faxEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadVoipOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/VoipPage.php000064400000002450150515725670022204 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return VoipInstance \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\VoipInstance */ public function buildInstance(array $payload): VoipInstance { return new VoipInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['countryCode'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.VoipPage]'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/SharedCostPage.php000064400000002514150515725670023327 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SharedCostInstance \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\SharedCostInstance */ public function buildInstance(array $payload): SharedCostInstance { return new SharedCostInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['countryCode'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.SharedCostPage]'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/MobileOptions.php000064400000040753150515725670023265 0ustar00options['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 of the phone numbers to read. Applies to only phone numbers in the US and Canada. * * @param int $areaCode The area code of the phone numbers to read * @return $this Fluent Builder */ public function setAreaCode(int $areaCode): self { $this->options['areaCode'] = $areaCode; return $this; } /** * The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. * * @param string $contains The pattern on which to match phone numbers * @return $this Fluent Builder */ public function setContains(string $contains): self { $this->options['contains'] = $contains; return $this; } /** * Whether the phone numbers can receive text messages. Can be: `true` or `false`. * * @param bool $smsEnabled Whether the phone numbers can receive text messages * @return $this Fluent Builder */ public function setSmsEnabled(bool $smsEnabled): self { $this->options['smsEnabled'] = $smsEnabled; return $this; } /** * Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. * * @param bool $mmsEnabled Whether the phone numbers can receive MMS messages * @return $this Fluent Builder */ public function setMmsEnabled(bool $mmsEnabled): self { $this->options['mmsEnabled'] = $mmsEnabled; return $this; } /** * Whether the phone numbers can receive calls. Can be: `true` or `false`. * * @param bool $voiceEnabled Whether the phone numbers can receive calls. * @return $this Fluent Builder */ public function setVoiceEnabled(bool $voiceEnabled): self { $this->options['voiceEnabled'] = $voiceEnabled; return $this; } /** * Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. * * @param bool $excludeAllAddressRequired Whether to exclude phone numbers that * require an Address * @return $this Fluent Builder */ public function setExcludeAllAddressRequired(bool $excludeAllAddressRequired): self { $this->options['excludeAllAddressRequired'] = $excludeAllAddressRequired; return $this; } /** * Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. * * @param bool $excludeLocalAddressRequired Whether to exclude phone numbers * that require a local address * @return $this Fluent Builder */ public function setExcludeLocalAddressRequired(bool $excludeLocalAddressRequired): self { $this->options['excludeLocalAddressRequired'] = $excludeLocalAddressRequired; return $this; } /** * Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. * * @param bool $excludeForeignAddressRequired Whether to exclude phone numbers * that require a foreign address * @return $this Fluent Builder */ public function setExcludeForeignAddressRequired(bool $excludeForeignAddressRequired): self { $this->options['excludeForeignAddressRequired'] = $excludeForeignAddressRequired; return $this; } /** * Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. * * @param bool $beta Whether to read phone numbers new to the Twilio platform * @return $this Fluent Builder */ public function setBeta(bool $beta): self { $this->options['beta'] = $beta; return $this; } /** * Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. * * @param string $nearNumber Given a phone number, find a geographically close * number within distance miles. (US/Canada only) * @return $this Fluent Builder */ public function setNearNumber(string $nearNumber): self { $this->options['nearNumber'] = $nearNumber; return $this; } /** * Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. * * @param string $nearLatLong Given a latitude/longitude pair lat,long find * geographically close numbers within distance * miles. (US/Canada only) * @return $this Fluent Builder */ public function setNearLatLong(string $nearLatLong): self { $this->options['nearLatLong'] = $nearLatLong; return $this; } /** * The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. * * @param int $distance The search radius, in miles, for a near_ query. * (US/Canada only) * @return $this Fluent Builder */ public function setDistance(int $distance): self { $this->options['distance'] = $distance; return $this; } /** * Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. * * @param string $inPostalCode Limit results to a particular postal code. * (US/Canada only) * @return $this Fluent Builder */ public function setInPostalCode(string $inPostalCode): self { $this->options['inPostalCode'] = $inPostalCode; return $this; } /** * Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. * * @param string $inRegion Limit results to a particular region. (US/Canada * only) * @return $this Fluent Builder */ public function setInRegion(string $inRegion): self { $this->options['inRegion'] = $inRegion; return $this; } /** * Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. * * @param string $inRateCenter Limit results to a specific rate center, or * given a phone number search within the same rate * center as that number. (US/Canada only) * @return $this Fluent Builder */ public function setInRateCenter(string $inRateCenter): self { $this->options['inRateCenter'] = $inRateCenter; return $this; } /** * Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. * * @param string $inLata Limit results to a specific local access and transport * area. (US/Canada only) * @return $this Fluent Builder */ public function setInLata(string $inLata): self { $this->options['inLata'] = $inLata; return $this; } /** * Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. * * @param string $inLocality Limit results to a particular locality * @return $this Fluent Builder */ public function setInLocality(string $inLocality): self { $this->options['inLocality'] = $inLocality; return $this; } /** * Whether the phone numbers can receive faxes. Can be: `true` or `false`. * * @param bool $faxEnabled Whether the phone numbers can receive faxes * @return $this Fluent Builder */ public function setFaxEnabled(bool $faxEnabled): self { $this->options['faxEnabled'] = $faxEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadMobileOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/MobileList.php000064400000014260150515725670022537 0ustar00solution = ['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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $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(array $options = [], int $limit = null, $pageSize = null): array { 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 MobilePage Page of MobileInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): MobilePage { $options = new Values($options); $params = Values::of([ '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 MobilePage Page of MobileInstance */ public function getPage(string $targetUrl): MobilePage { $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(): string { return '[Twilio.Api.V2010.MobileList]'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/VoipList.php000064400000014216150515725670022246 0ustar00solution = ['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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $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(array $options = [], int $limit = null, $pageSize = null): array { 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 VoipPage Page of VoipInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): VoipPage { $options = new Values($options); $params = Values::of([ '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 VoipPage Page of VoipInstance */ public function getPage(string $targetUrl): VoipPage { $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(): string { return '[Twilio.Api.V2010.VoipList]'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/VoipInstance.php000064400000006030150515725670023072 0ustar00properties = [ '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 = ['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(string $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(): string { return '[Twilio.Api.V2010.VoipInstance]'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/MachineToMachineOptions.php000064400000041047150515725670025207 0ustar00options['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 of the phone numbers to read. Applies to only phone numbers in the US and Canada. * * @param int $areaCode The area code of the phone numbers to read * @return $this Fluent Builder */ public function setAreaCode(int $areaCode): self { $this->options['areaCode'] = $areaCode; return $this; } /** * The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. * * @param string $contains The pattern on which to match phone numbers * @return $this Fluent Builder */ public function setContains(string $contains): self { $this->options['contains'] = $contains; return $this; } /** * Whether the phone numbers can receive text messages. Can be: `true` or `false`. * * @param bool $smsEnabled Whether the phone numbers can receive text messages * @return $this Fluent Builder */ public function setSmsEnabled(bool $smsEnabled): self { $this->options['smsEnabled'] = $smsEnabled; return $this; } /** * Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. * * @param bool $mmsEnabled Whether the phone numbers can receive MMS messages * @return $this Fluent Builder */ public function setMmsEnabled(bool $mmsEnabled): self { $this->options['mmsEnabled'] = $mmsEnabled; return $this; } /** * Whether the phone numbers can receive calls. Can be: `true` or `false`. * * @param bool $voiceEnabled Whether the phone numbers can receive calls. * @return $this Fluent Builder */ public function setVoiceEnabled(bool $voiceEnabled): self { $this->options['voiceEnabled'] = $voiceEnabled; return $this; } /** * Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. * * @param bool $excludeAllAddressRequired Whether to exclude phone numbers that * require an Address * @return $this Fluent Builder */ public function setExcludeAllAddressRequired(bool $excludeAllAddressRequired): self { $this->options['excludeAllAddressRequired'] = $excludeAllAddressRequired; return $this; } /** * Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. * * @param bool $excludeLocalAddressRequired Whether to exclude phone numbers * that require a local address * @return $this Fluent Builder */ public function setExcludeLocalAddressRequired(bool $excludeLocalAddressRequired): self { $this->options['excludeLocalAddressRequired'] = $excludeLocalAddressRequired; return $this; } /** * Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. * * @param bool $excludeForeignAddressRequired Whether to exclude phone numbers * that require a foreign address * @return $this Fluent Builder */ public function setExcludeForeignAddressRequired(bool $excludeForeignAddressRequired): self { $this->options['excludeForeignAddressRequired'] = $excludeForeignAddressRequired; return $this; } /** * Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. * * @param bool $beta Whether to read phone numbers new to the Twilio platform * @return $this Fluent Builder */ public function setBeta(bool $beta): self { $this->options['beta'] = $beta; return $this; } /** * Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. * * @param string $nearNumber Given a phone number, find a geographically close * number within distance miles. (US/Canada only) * @return $this Fluent Builder */ public function setNearNumber(string $nearNumber): self { $this->options['nearNumber'] = $nearNumber; return $this; } /** * Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. * * @param string $nearLatLong Given a latitude/longitude pair lat,long find * geographically close numbers within distance * miles. (US/Canada only) * @return $this Fluent Builder */ public function setNearLatLong(string $nearLatLong): self { $this->options['nearLatLong'] = $nearLatLong; return $this; } /** * The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. * * @param int $distance The search radius, in miles, for a near_ query. * (US/Canada only) * @return $this Fluent Builder */ public function setDistance(int $distance): self { $this->options['distance'] = $distance; return $this; } /** * Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. * * @param string $inPostalCode Limit results to a particular postal code. * (US/Canada only) * @return $this Fluent Builder */ public function setInPostalCode(string $inPostalCode): self { $this->options['inPostalCode'] = $inPostalCode; return $this; } /** * Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. * * @param string $inRegion Limit results to a particular region. (US/Canada * only) * @return $this Fluent Builder */ public function setInRegion(string $inRegion): self { $this->options['inRegion'] = $inRegion; return $this; } /** * Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. * * @param string $inRateCenter Limit results to a specific rate center, or * given a phone number search within the same rate * center as that number. (US/Canada only) * @return $this Fluent Builder */ public function setInRateCenter(string $inRateCenter): self { $this->options['inRateCenter'] = $inRateCenter; return $this; } /** * Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. * * @param string $inLata Limit results to a specific local access and transport * area. (US/Canada only) * @return $this Fluent Builder */ public function setInLata(string $inLata): self { $this->options['inLata'] = $inLata; return $this; } /** * Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. * * @param string $inLocality Limit results to a particular locality * @return $this Fluent Builder */ public function setInLocality(string $inLocality): self { $this->options['inLocality'] = $inLocality; return $this; } /** * Whether the phone numbers can receive faxes. Can be: `true` or `false`. * * @param bool $faxEnabled Whether the phone numbers can receive faxes * @return $this Fluent Builder */ public function setFaxEnabled(bool $faxEnabled): self { $this->options['faxEnabled'] = $faxEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadMachineToMachineOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/SharedCostList.php000064400000014364150515725670023374 0ustar00solution = ['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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $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(array $options = [], int $limit = null, $pageSize = null): array { 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 SharedCostPage Page of SharedCostInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SharedCostPage { $options = new Values($options); $params = Values::of([ '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 SharedCostPage Page of SharedCostInstance */ public function getPage(string $targetUrl): SharedCostPage { $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(): string { return '[Twilio.Api.V2010.SharedCostList]'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/LocalPage.php000064400000002456150515725670022327 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return LocalInstance \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountry\LocalInstance */ public function buildInstance(array $payload): LocalInstance { return new LocalInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['countryCode'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.LocalPage]'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/LocalOptions.php000064400000041052150515725670023101 0ustar00options['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 of the phone numbers to read. Applies to only phone numbers in the US and Canada. * * @param int $areaCode The area code of the phone numbers to read * @return $this Fluent Builder */ public function setAreaCode(int $areaCode): self { $this->options['areaCode'] = $areaCode; return $this; } /** * The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumberlocal-resource?code-sample=code-find-phone-numbers-by-number-pattern) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumberlocal-resource?code-sample=code-find-phone-numbers-by-character-pattern). If specified, this value must have at least two characters. * * @param string $contains The pattern on which to match phone numbers * @return $this Fluent Builder */ public function setContains(string $contains): self { $this->options['contains'] = $contains; return $this; } /** * Whether the phone numbers can receive text messages. Can be: `true` or `false`. * * @param bool $smsEnabled Whether the phone numbers can receive text messages * @return $this Fluent Builder */ public function setSmsEnabled(bool $smsEnabled): self { $this->options['smsEnabled'] = $smsEnabled; return $this; } /** * Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. * * @param bool $mmsEnabled Whether the phone numbers can receive MMS messages * @return $this Fluent Builder */ public function setMmsEnabled(bool $mmsEnabled): self { $this->options['mmsEnabled'] = $mmsEnabled; return $this; } /** * Whether the phone numbers can receive calls. Can be: `true` or `false`. * * @param bool $voiceEnabled Whether the phone numbers can receive calls. * @return $this Fluent Builder */ public function setVoiceEnabled(bool $voiceEnabled): self { $this->options['voiceEnabled'] = $voiceEnabled; return $this; } /** * Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. * * @param bool $excludeAllAddressRequired Whether to exclude phone numbers that * require an Address * @return $this Fluent Builder */ public function setExcludeAllAddressRequired(bool $excludeAllAddressRequired): self { $this->options['excludeAllAddressRequired'] = $excludeAllAddressRequired; return $this; } /** * Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. * * @param bool $excludeLocalAddressRequired Whether to exclude phone numbers * that require a local address * @return $this Fluent Builder */ public function setExcludeLocalAddressRequired(bool $excludeLocalAddressRequired): self { $this->options['excludeLocalAddressRequired'] = $excludeLocalAddressRequired; return $this; } /** * Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. * * @param bool $excludeForeignAddressRequired Whether to exclude phone numbers * that require a foreign address * @return $this Fluent Builder */ public function setExcludeForeignAddressRequired(bool $excludeForeignAddressRequired): self { $this->options['excludeForeignAddressRequired'] = $excludeForeignAddressRequired; return $this; } /** * Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. * * @param bool $beta Whether to read phone numbers new to the Twilio platform * @return $this Fluent Builder */ public function setBeta(bool $beta): self { $this->options['beta'] = $beta; return $this; } /** * Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. * * @param string $nearNumber Given a phone number, find a geographically close * number within distance miles. (US/Canada only) * @return $this Fluent Builder */ public function setNearNumber(string $nearNumber): self { $this->options['nearNumber'] = $nearNumber; return $this; } /** * Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. * * @param string $nearLatLong Given a latitude/longitude pair lat,long find * geographically close numbers within distance * miles. (US/Canada only) * @return $this Fluent Builder */ public function setNearLatLong(string $nearLatLong): self { $this->options['nearLatLong'] = $nearLatLong; return $this; } /** * The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. * * @param int $distance The search radius, in miles, for a near_ query. * (US/Canada only) * @return $this Fluent Builder */ public function setDistance(int $distance): self { $this->options['distance'] = $distance; return $this; } /** * Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. * * @param string $inPostalCode Limit results to a particular postal code. * (US/Canada only) * @return $this Fluent Builder */ public function setInPostalCode(string $inPostalCode): self { $this->options['inPostalCode'] = $inPostalCode; return $this; } /** * Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. * * @param string $inRegion Limit results to a particular region. (US/Canada * only) * @return $this Fluent Builder */ public function setInRegion(string $inRegion): self { $this->options['inRegion'] = $inRegion; return $this; } /** * Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. * * @param string $inRateCenter Limit results to a specific rate center, or * given a phone number search within the same rate * center as that number. (US/Canada only) * @return $this Fluent Builder */ public function setInRateCenter(string $inRateCenter): self { $this->options['inRateCenter'] = $inRateCenter; return $this; } /** * Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. * * @param string $inLata Limit results to a specific local access and transport * area. (US/Canada only) * @return $this Fluent Builder */ public function setInLata(string $inLata): self { $this->options['inLata'] = $inLata; return $this; } /** * Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. * * @param string $inLocality Limit results to a particular locality * @return $this Fluent Builder */ public function setInLocality(string $inLocality): self { $this->options['inLocality'] = $inLocality; return $this; } /** * Whether the phone numbers can receive faxes. Can be: `true` or `false`. * * @param bool $faxEnabled Whether the phone numbers can receive faxes * @return $this Fluent Builder */ public function setFaxEnabled(bool $faxEnabled): self { $this->options['faxEnabled'] = $faxEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadLocalOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/TollFreeInstance.php000064400000006044150515725670023676 0ustar00properties = [ '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 = ['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(string $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(): string { return '[Twilio.Api.V2010.TollFreeInstance]'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountry/NationalOptions.php000064400000040767150515725670023630 0ustar00options['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 of the phone numbers to read. Applies to only phone numbers in the US and Canada. * * @param int $areaCode The area code of the phone numbers to read * @return $this Fluent Builder */ public function setAreaCode(int $areaCode): self { $this->options['areaCode'] = $areaCode; return $this; } /** * The pattern on which to match phone numbers. Valid characters are `*`, `0-9`, `a-z`, and `A-Z`. The `*` character matches any single digit. For examples, see [Example 2](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-2) and [Example 3](https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#local-get-basic-example-3). If specified, this value must have at least two characters. * * @param string $contains The pattern on which to match phone numbers * @return $this Fluent Builder */ public function setContains(string $contains): self { $this->options['contains'] = $contains; return $this; } /** * Whether the phone numbers can receive text messages. Can be: `true` or `false`. * * @param bool $smsEnabled Whether the phone numbers can receive text messages * @return $this Fluent Builder */ public function setSmsEnabled(bool $smsEnabled): self { $this->options['smsEnabled'] = $smsEnabled; return $this; } /** * Whether the phone numbers can receive MMS messages. Can be: `true` or `false`. * * @param bool $mmsEnabled Whether the phone numbers can receive MMS messages * @return $this Fluent Builder */ public function setMmsEnabled(bool $mmsEnabled): self { $this->options['mmsEnabled'] = $mmsEnabled; return $this; } /** * Whether the phone numbers can receive calls. Can be: `true` or `false`. * * @param bool $voiceEnabled Whether the phone numbers can receive calls. * @return $this Fluent Builder */ public function setVoiceEnabled(bool $voiceEnabled): self { $this->options['voiceEnabled'] = $voiceEnabled; return $this; } /** * Whether to exclude phone numbers that require an [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. * * @param bool $excludeAllAddressRequired Whether to exclude phone numbers that * require an Address * @return $this Fluent Builder */ public function setExcludeAllAddressRequired(bool $excludeAllAddressRequired): self { $this->options['excludeAllAddressRequired'] = $excludeAllAddressRequired; return $this; } /** * Whether to exclude phone numbers that require a local [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. * * @param bool $excludeLocalAddressRequired Whether to exclude phone numbers * that require a local address * @return $this Fluent Builder */ public function setExcludeLocalAddressRequired(bool $excludeLocalAddressRequired): self { $this->options['excludeLocalAddressRequired'] = $excludeLocalAddressRequired; return $this; } /** * Whether to exclude phone numbers that require a foreign [Address](https://www.twilio.com/docs/usage/api/address). Can be: `true` or `false` and the default is `false`. * * @param bool $excludeForeignAddressRequired Whether to exclude phone numbers * that require a foreign address * @return $this Fluent Builder */ public function setExcludeForeignAddressRequired(bool $excludeForeignAddressRequired): self { $this->options['excludeForeignAddressRequired'] = $excludeForeignAddressRequired; return $this; } /** * Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`. * * @param bool $beta Whether to read phone numbers new to the Twilio platform * @return $this Fluent Builder */ public function setBeta(bool $beta): self { $this->options['beta'] = $beta; return $this; } /** * Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada. * * @param string $nearNumber Given a phone number, find a geographically close * number within distance miles. (US/Canada only) * @return $this Fluent Builder */ public function setNearNumber(string $nearNumber): self { $this->options['nearNumber'] = $nearNumber; return $this; } /** * Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada. * * @param string $nearLatLong Given a latitude/longitude pair lat,long find * geographically close numbers within distance * miles. (US/Canada only) * @return $this Fluent Builder */ public function setNearLatLong(string $nearLatLong): self { $this->options['nearLatLong'] = $nearLatLong; return $this; } /** * The search radius, in miles, for a `near_` query. Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada. * * @param int $distance The search radius, in miles, for a near_ query. * (US/Canada only) * @return $this Fluent Builder */ public function setDistance(int $distance): self { $this->options['distance'] = $distance; return $this; } /** * Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada. * * @param string $inPostalCode Limit results to a particular postal code. * (US/Canada only) * @return $this Fluent Builder */ public function setInPostalCode(string $inPostalCode): self { $this->options['inPostalCode'] = $inPostalCode; return $this; } /** * Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada. * * @param string $inRegion Limit results to a particular region. (US/Canada * only) * @return $this Fluent Builder */ public function setInRegion(string $inRegion): self { $this->options['inRegion'] = $inRegion; return $this; } /** * Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada. * * @param string $inRateCenter Limit results to a specific rate center, or * given a phone number search within the same rate * center as that number. (US/Canada only) * @return $this Fluent Builder */ public function setInRateCenter(string $inRateCenter): self { $this->options['inRateCenter'] = $inRateCenter; return $this; } /** * Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada. * * @param string $inLata Limit results to a specific local access and transport * area. (US/Canada only) * @return $this Fluent Builder */ public function setInLata(string $inLata): self { $this->options['inLata'] = $inLata; return $this; } /** * Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number. * * @param string $inLocality Limit results to a particular locality * @return $this Fluent Builder */ public function setInLocality(string $inLocality): self { $this->options['inLocality'] = $inLocality; return $this; } /** * Whether the phone numbers can receive faxes. Can be: `true` or `false`. * * @param bool $faxEnabled Whether the phone numbers can receive faxes * @return $this Fluent Builder */ public function setFaxEnabled(bool $faxEnabled): self { $this->options['faxEnabled'] = $faxEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadNationalOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/SigningKeyPage.php000064400000002272150515725670015731 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SigningKeyInstance \Twilio\Rest\Api\V2010\Account\SigningKeyInstance */ public function buildInstance(array $payload): SigningKeyInstance { return new SigningKeyInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.SigningKeyPage]'; } }src/Twilio/Rest/Api/V2010/Account/RecordingContext.php000064400000010660150515725670016346 0ustar00solution = ['accountSid' => $accountSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Recordings/' . \rawurlencode($sid) . '.json'; } /** * Fetch the RecordingInstance * * @return RecordingInstance Fetched RecordingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RecordingInstance { $payload = $this->version->fetch('GET', $this->uri); return new RecordingInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Delete the RecordingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the transcriptions */ protected function getTranscriptions(): TranscriptionList { if (!$this->_transcriptions) { $this->_transcriptions = new TranscriptionList( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->_transcriptions; } /** * Access the addOnResults */ protected function getAddOnResults(): AddOnResultList { if (!$this->_addOnResults) { $this->_addOnResults = new AddOnResultList( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->_addOnResults; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.RecordingContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/ShortCodeContext.php000064400000005406150515725670016326 0ustar00solution = ['accountSid' => $accountSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/SMS/ShortCodes/' . \rawurlencode($sid) . '.json'; } /** * Fetch the ShortCodeInstance * * @return ShortCodeInstance Fetched ShortCodeInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ShortCodeInstance { $payload = $this->version->fetch('GET', $this->uri); return new ShortCodeInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Update the ShortCodeInstance * * @param array|Options $options Optional Arguments * @return ShortCodeInstance Updated ShortCodeInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ShortCodeInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'ApiVersion' => $options['apiVersion'], 'SmsUrl' => $options['smsUrl'], 'SmsMethod' => $options['smsMethod'], 'SmsFallbackUrl' => $options['smsFallbackUrl'], 'SmsFallbackMethod' => $options['smsFallbackMethod'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ShortCodeInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.ShortCodeContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/ShortCodePage.php000064400000002264150515725670015555 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ShortCodeInstance \Twilio\Rest\Api\V2010\Account\ShortCodeInstance */ public function buildInstance(array $payload): ShortCodeInstance { return new ShortCodeInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.ShortCodePage]'; } }src/Twilio/Rest/Api/V2010/Account/ValidationRequestPage.php000064400000002344150515725670017325 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ValidationRequestInstance \Twilio\Rest\Api\V2010\Account\ValidationRequestInstance */ public function buildInstance(array $payload): ValidationRequestInstance { return new ValidationRequestInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.ValidationRequestPage]'; } }src/Twilio/Rest/Api/V2010/Account/CallContext.php000064400000016673150515725670015317 0ustar00solution = ['accountSid' => $accountSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Calls/' . \rawurlencode($sid) . '.json'; } /** * Delete the CallInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Fetch the CallInstance * * @return CallInstance Fetched CallInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CallInstance { $payload = $this->version->fetch('GET', $this->uri); return new CallInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Update the CallInstance * * @param array|Options $options Optional Arguments * @return CallInstance Updated CallInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): CallInstance { $options = new Values($options); $data = Values::of([ 'Url' => $options['url'], 'Method' => $options['method'], 'Status' => $options['status'], 'FallbackUrl' => $options['fallbackUrl'], 'FallbackMethod' => $options['fallbackMethod'], 'StatusCallback' => $options['statusCallback'], 'StatusCallbackMethod' => $options['statusCallbackMethod'], 'Twiml' => $options['twiml'], 'TimeLimit' => $options['timeLimit'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new CallInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Access the recordings */ protected function getRecordings(): RecordingList { if (!$this->_recordings) { $this->_recordings = new RecordingList( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->_recordings; } /** * Access the notifications */ protected function getNotifications(): NotificationList { if (!$this->_notifications) { $this->_notifications = new NotificationList( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->_notifications; } /** * Access the feedback */ protected function getFeedback(): FeedbackList { if (!$this->_feedback) { $this->_feedback = new FeedbackList( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->_feedback; } /** * Access the events */ protected function getEvents(): EventList { if (!$this->_events) { $this->_events = new EventList( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->_events; } /** * Access the payments */ protected function getPayments(): PaymentList { if (!$this->_payments) { $this->_payments = new PaymentList( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->_payments; } /** * Access the siprec */ protected function getSiprec(): SiprecList { if (!$this->_siprec) { $this->_siprec = new SiprecList( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->_siprec; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.CallContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/MessageOptions.php000064400000053515150515725670016033 0ustar00options['from'] = $from; $this->options['messagingServiceSid'] = $messagingServiceSid; $this->options['body'] = $body; $this->options['mediaUrl'] = $mediaUrl; $this->options['statusCallback'] = $statusCallback; $this->options['applicationSid'] = $applicationSid; $this->options['maxPrice'] = $maxPrice; $this->options['provideFeedback'] = $provideFeedback; $this->options['attempt'] = $attempt; $this->options['validityPeriod'] = $validityPeriod; $this->options['forceDelivery'] = $forceDelivery; $this->options['contentRetention'] = $contentRetention; $this->options['addressRetention'] = $addressRetention; $this->options['smartEncoded'] = $smartEncoded; $this->options['persistentAction'] = $persistentAction; $this->options['sendAsMms'] = $sendAsMms; } /** * A Twilio phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, an [alphanumeric sender ID](https://www.twilio.com/docs/sms/send-messages#use-an-alphanumeric-sender-id), or a [Channel Endpoint address](https://www.twilio.com/docs/sms/channels#channel-addresses) that is enabled for the type of message you want to send. Phone numbers or [short codes](https://www.twilio.com/docs/sms/api/short-code) purchased from Twilio also work here. You cannot, for example, spoof messages from a private cell phone number. If you are using `messaging_service_sid`, this parameter must be empty. * * @param string $from The phone number that initiated the message * @return $this Fluent Builder */ public function setFrom(string $from): self { $this->options['from'] = $from; return $this; } /** * The SID of the [Messaging Service](https://www.twilio.com/docs/sms/services#send-a-message-with-copilot) you want to associate with the Message. Set this parameter to use the [Messaging Service Settings and Copilot Features](https://www.twilio.com/console/sms/services) you have configured and leave the `from` parameter empty. When only this parameter is set, Twilio will use your enabled Copilot Features to select the `from` phone number for delivery. * * @param string $messagingServiceSid The SID of the Messaging Service you want * to associate with the message. * @return $this Fluent Builder */ public function setMessagingServiceSid(string $messagingServiceSid): self { $this->options['messagingServiceSid'] = $messagingServiceSid; return $this; } /** * The text of the message you want to send. Can be up to 1,600 characters in length. * * @param string $body The text of the message you want to send. Can be up to * 1,600 characters in length. * @return $this Fluent Builder */ public function setBody(string $body): self { $this->options['body'] = $body; return $this; } /** * The URL of the media to send with the message. The media can be of type `gif`, `png`, and `jpeg` and will be formatted correctly on the recipient's device. The media size limit is 5MB for supported file types (JPEG, PNG, GIF) and 500KB for [other types](https://www.twilio.com/docs/sms/accepted-mime-types) of accepted media. To send more than one image in the message body, provide multiple `media_url` parameters in the POST request. You can include up to 10 `media_url` parameters per message. You can send images in an SMS message in only the US and Canada. * * @param string[] $mediaUrl The URL of the media to send with the message * @return $this Fluent Builder */ public function setMediaUrl(array $mediaUrl): self { $this->options['mediaUrl'] = $mediaUrl; return $this; } /** * The URL we should call using the `status_callback_method` to send status information to your application. If specified, we POST these message status changes to the URL: `queued`, `failed`, `sent`, `delivered`, or `undelivered`. Twilio will POST its [standard request parameters](https://www.twilio.com/docs/sms/twiml#request-parameters) as well as some additional parameters including `MessageSid`, `MessageStatus`, and `ErrorCode`. If you include this parameter with the `messaging_service_sid`, we use this URL instead of the Status Callback URL of the [Messaging Service](https://www.twilio.com/docs/sms/services/api). URLs must contain a valid hostname and underscores are not allowed. * * @param string $statusCallback The URL we should call to send status * information to your application * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * The SID of the application that should receive message status. We POST a `message_sid` parameter and a `message_status` parameter with a value of `sent` or `failed` to the [application](https://www.twilio.com/docs/usage/api/applications)'s `message_status_callback`. If a `status_callback` parameter is also passed, it will be ignored and the application's `message_status_callback` parameter will be used. * * @param string $applicationSid The application to use for callbacks * @return $this Fluent Builder */ public function setApplicationSid(string $applicationSid): self { $this->options['applicationSid'] = $applicationSid; return $this; } /** * The maximum total price in US dollars that you will pay for the message to be delivered. Can be a decimal value that has up to 4 decimal places. All messages are queued for delivery and the message cost is checked before the message is sent. If the cost exceeds `max_price`, the message will fail and a status of `Failed` is sent to the status callback. If `MaxPrice` is not set, the message cost is not checked. * * @param string $maxPrice The total maximum price up to 4 decimal places in US * dollars acceptable for the message to be delivered. * @return $this Fluent Builder */ public function setMaxPrice(string $maxPrice): self { $this->options['maxPrice'] = $maxPrice; return $this; } /** * Whether to confirm delivery of the message. Set this value to `true` if you are sending messages that have a trackable user action and you intend to confirm delivery of the message using the [Message Feedback API](https://www.twilio.com/docs/sms/api/message-feedback-resource). This parameter is `false` by default. * * @param bool $provideFeedback Whether to confirm delivery of the message * @return $this Fluent Builder */ public function setProvideFeedback(bool $provideFeedback): self { $this->options['provideFeedback'] = $provideFeedback; return $this; } /** * Total number of attempts made ( including this ) to send out the message regardless of the provider used * * @param int $attempt Total numer of attempts made , this inclusive to send * out the message * @return $this Fluent Builder */ public function setAttempt(int $attempt): self { $this->options['attempt'] = $attempt; return $this; } /** * How long in seconds the message can remain in our outgoing message queue. After this period elapses, the message fails and we call your status callback. Can be between 1 and the default value of 14,400 seconds. After a message has been accepted by a carrier, however, we cannot guarantee that the message will not be queued after this period. We recommend that this value be at least 5 seconds. * * @param int $validityPeriod The number of seconds that the message can remain * in our outgoing queue. * @return $this Fluent Builder */ public function setValidityPeriod(int $validityPeriod): self { $this->options['validityPeriod'] = $validityPeriod; return $this; } /** * Reserved * * @param bool $forceDelivery Reserved * @return $this Fluent Builder */ public function setForceDelivery(bool $forceDelivery): self { $this->options['forceDelivery'] = $forceDelivery; return $this; } /** * Determines if the message content can be stored or redacted based on privacy settings * * @param string $contentRetention Determines if the message content can be * stored or redacted based on privacy settings * @return $this Fluent Builder */ public function setContentRetention(string $contentRetention): self { $this->options['contentRetention'] = $contentRetention; return $this; } /** * Determines if the address can be stored or obfuscated based on privacy settings * * @param string $addressRetention Determines if the address can be stored or * obfuscated based on privacy settings * @return $this Fluent Builder */ public function setAddressRetention(string $addressRetention): self { $this->options['addressRetention'] = $addressRetention; return $this; } /** * Whether to detect Unicode characters that have a similar GSM-7 character and replace them. Can be: `true` or `false`. * * @param bool $smartEncoded Whether to detect Unicode characters that have a * similar GSM-7 character and replace them * @return $this Fluent Builder */ public function setSmartEncoded(bool $smartEncoded): self { $this->options['smartEncoded'] = $smartEncoded; return $this; } /** * Rich actions for Channels Messages. * * @param string[] $persistentAction Rich actions for Channels Messages. * @return $this Fluent Builder */ public function setPersistentAction(array $persistentAction): self { $this->options['persistentAction'] = $persistentAction; return $this; } /** * If set to True, Twilio will deliver the message as a single MMS message, regardless of the presence of media. This is a Beta Feature. * * @param bool $sendAsMms If set to True, Twilio will deliver the message as a * single MMS message, regardless of the presence of * media * @return $this Fluent Builder */ public function setSendAsMms(bool $sendAsMms): self { $this->options['sendAsMms'] = $sendAsMms; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.CreateMessageOptions ' . $options . ']'; } } class ReadMessageOptions extends Options { /** * @param string $to Filter by messages sent to this number * @param string $from Filter by from number * @param string $dateSentBefore Filter by date sent * @param string $dateSent Filter by date sent * @param string $dateSentAfter Filter by date sent */ public function __construct(string $to = Values::NONE, string $from = Values::NONE, string $dateSentBefore = Values::NONE, string $dateSent = Values::NONE, string $dateSentAfter = Values::NONE) { $this->options['to'] = $to; $this->options['from'] = $from; $this->options['dateSentBefore'] = $dateSentBefore; $this->options['dateSent'] = $dateSent; $this->options['dateSentAfter'] = $dateSentAfter; } /** * Read messages sent to only this phone number. * * @param string $to Filter by messages sent to this number * @return $this Fluent Builder */ public function setTo(string $to): self { $this->options['to'] = $to; return $this; } /** * Read messages sent from only this phone number or alphanumeric sender ID. * * @param string $from Filter by from number * @return $this Fluent Builder */ public function setFrom(string $from): self { $this->options['from'] = $from; return $this; } /** * The date of the messages to show. Specify a date as `YYYY-MM-DD` in GMT to read only messages sent on this date. For example: `2009-07-06`. You can also specify an inequality, such as `DateSent<=YYYY-MM-DD`, to read messages sent on or before midnight on a date, and `DateSent>=YYYY-MM-DD` to read messages sent on or after midnight on a date. * * @param string $dateSentBefore Filter by date sent * @return $this Fluent Builder */ public function setDateSentBefore(string $dateSentBefore): self { $this->options['dateSentBefore'] = $dateSentBefore; return $this; } /** * The date of the messages to show. Specify a date as `YYYY-MM-DD` in GMT to read only messages sent on this date. For example: `2009-07-06`. You can also specify an inequality, such as `DateSent<=YYYY-MM-DD`, to read messages sent on or before midnight on a date, and `DateSent>=YYYY-MM-DD` to read messages sent on or after midnight on a date. * * @param string $dateSent Filter by date sent * @return $this Fluent Builder */ public function setDateSent(string $dateSent): self { $this->options['dateSent'] = $dateSent; return $this; } /** * The date of the messages to show. Specify a date as `YYYY-MM-DD` in GMT to read only messages sent on this date. For example: `2009-07-06`. You can also specify an inequality, such as `DateSent<=YYYY-MM-DD`, to read messages sent on or before midnight on a date, and `DateSent>=YYYY-MM-DD` to read messages sent on or after midnight on a date. * * @param string $dateSentAfter Filter by date sent * @return $this Fluent Builder */ public function setDateSentAfter(string $dateSentAfter): self { $this->options['dateSentAfter'] = $dateSentAfter; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadMessageOptions ' . $options . ']'; } } class UpdateMessageOptions extends Options { /** * @param string $body The text of the message you want to send */ public function __construct(string $body = Values::NONE) { $this->options['body'] = $body; } /** * The text of the message you want to send. Can be up to 1,600 characters long. * * @param string $body The text of the message you want to send * @return $this Fluent Builder */ public function setBody(string $body): self { $this->options['body'] = $body; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.UpdateMessageOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/BalanceInstance.php000064400000003575150515725670016106 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'balance' => Values::array_get($payload, 'balance'), 'currency' => Values::array_get($payload, 'currency'), ]; $this->solution = ['accountSid' => $accountSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Api.V2010.BalanceInstance]'; } }src/Twilio/Rest/Api/V2010/Account/CallInstance.php000064400000016565150515725670015437 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'parentCallSid' => Values::array_get($payload, 'parent_call_sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'to' => Values::array_get($payload, 'to'), 'toFormatted' => Values::array_get($payload, 'to_formatted'), 'from' => Values::array_get($payload, 'from'), 'fromFormatted' => Values::array_get($payload, 'from_formatted'), 'phoneNumberSid' => Values::array_get($payload, 'phone_number_sid'), 'status' => Values::array_get($payload, 'status'), 'startTime' => Deserialize::dateTime(Values::array_get($payload, 'start_time')), 'endTime' => Deserialize::dateTime(Values::array_get($payload, 'end_time')), 'duration' => Values::array_get($payload, 'duration'), 'price' => Values::array_get($payload, 'price'), 'priceUnit' => Values::array_get($payload, 'price_unit'), 'direction' => Values::array_get($payload, 'direction'), 'answeredBy' => Values::array_get($payload, 'answered_by'), 'annotation' => Values::array_get($payload, 'annotation'), 'apiVersion' => Values::array_get($payload, 'api_version'), 'forwardedFrom' => Values::array_get($payload, 'forwarded_from'), 'groupSid' => Values::array_get($payload, 'group_sid'), 'callerName' => Values::array_get($payload, 'caller_name'), 'queueTime' => Values::array_get($payload, 'queue_time'), 'trunkSid' => Values::array_get($payload, 'trunk_sid'), 'uri' => Values::array_get($payload, 'uri'), 'subresourceUris' => Values::array_get($payload, 'subresource_uris'), ]; $this->solution = ['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 CallContext Context for this CallInstance */ protected function proxy(): CallContext { if (!$this->context) { $this->context = new CallContext( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->context; } /** * Delete the CallInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Fetch the CallInstance * * @return CallInstance Fetched CallInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CallInstance { return $this->proxy()->fetch(); } /** * Update the CallInstance * * @param array|Options $options Optional Arguments * @return CallInstance Updated CallInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): CallInstance { return $this->proxy()->update($options); } /** * Access the recordings */ protected function getRecordings(): RecordingList { return $this->proxy()->recordings; } /** * Access the notifications */ protected function getNotifications(): NotificationList { return $this->proxy()->notifications; } /** * Access the feedback */ protected function getFeedback(): FeedbackList { return $this->proxy()->feedback; } /** * Access the events */ protected function getEvents(): EventList { return $this->proxy()->events; } /** * Access the payments */ protected function getPayments(): PaymentList { return $this->proxy()->payments; } /** * Access the siprec */ protected function getSiprec(): SiprecList { return $this->proxy()->siprec; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.CallInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/AvailablePhoneNumberCountryPage.php000064400000002516150515725670021272 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return AvailablePhoneNumberCountryInstance \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountryInstance */ public function buildInstance(array $payload): AvailablePhoneNumberCountryInstance { return new AvailablePhoneNumberCountryInstance( $this->version, $payload, $this->solution['accountSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.AvailablePhoneNumberCountryPage]'; } }src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumberPage.php000064400000002360150515725670017566 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return IncomingPhoneNumberInstance \Twilio\Rest\Api\V2010\Account\IncomingPhoneNumberInstance */ public function buildInstance(array $payload): IncomingPhoneNumberInstance { return new IncomingPhoneNumberInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.IncomingPhoneNumberPage]'; } }src/Twilio/Rest/Api/V2010/Account/Usage/RecordOptions.php000064400000011134150515725670016720 0ustar00options['category'] = $category; $this->options['startDate'] = $startDate; $this->options['endDate'] = $endDate; $this->options['includeSubaccounts'] = $includeSubaccounts; } /** * The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. * * @param string $category The usage category of the UsageRecord resources to * read * @return $this Fluent Builder */ public function setCategory(string $category): self { $this->options['category'] = $category; return $this; } /** * Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. * * @param \DateTime $startDate Only include usage that has occurred on or after * this date * @return $this Fluent Builder */ public function setStartDate(\DateTime $startDate): self { $this->options['startDate'] = $startDate; return $this; } /** * Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. * * @param \DateTime $endDate Only include usage that occurred on or before this * date * @return $this Fluent Builder */ public function setEndDate(\DateTime $endDate): self { $this->options['endDate'] = $endDate; return $this; } /** * Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. * * @param bool $includeSubaccounts Whether to include usage from the master * account and all its subaccounts * @return $this Fluent Builder */ public function setIncludeSubaccounts(bool $includeSubaccounts): self { $this->options['includeSubaccounts'] = $includeSubaccounts; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadRecordOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/Usage/TriggerContext.php000064400000005551150515725670017104 0ustar00solution = ['accountSid' => $accountSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Usage/Triggers/' . \rawurlencode($sid) . '.json'; } /** * Fetch the TriggerInstance * * @return TriggerInstance Fetched TriggerInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TriggerInstance { $payload = $this->version->fetch('GET', $this->uri); return new TriggerInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Update the TriggerInstance * * @param array|Options $options Optional Arguments * @return TriggerInstance Updated TriggerInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): TriggerInstance { $options = new Values($options); $data = Values::of([ 'CallbackMethod' => $options['callbackMethod'], 'CallbackUrl' => $options['callbackUrl'], 'FriendlyName' => $options['friendlyName'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new TriggerInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Delete the TriggerInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.TriggerContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/LastMonthOptions.php000064400000011165150515725670020635 0ustar00options['category'] = $category; $this->options['startDate'] = $startDate; $this->options['endDate'] = $endDate; $this->options['includeSubaccounts'] = $includeSubaccounts; } /** * The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. * * @param string $category The usage category of the UsageRecord resources to * read * @return $this Fluent Builder */ public function setCategory(string $category): self { $this->options['category'] = $category; return $this; } /** * Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. * * @param \DateTime $startDate Only include usage that has occurred on or after * this date * @return $this Fluent Builder */ public function setStartDate(\DateTime $startDate): self { $this->options['startDate'] = $startDate; return $this; } /** * Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. * * @param \DateTime $endDate Only include usage that occurred on or before this * date * @return $this Fluent Builder */ public function setEndDate(\DateTime $endDate): self { $this->options['endDate'] = $endDate; return $this; } /** * Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. * * @param bool $includeSubaccounts Whether to include usage from the master * account and all its subaccounts * @return $this Fluent Builder */ public function setIncludeSubaccounts(bool $includeSubaccounts): self { $this->options['includeSubaccounts'] = $includeSubaccounts; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadLastMonthOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/DailyOptions.php000064400000011135150515725670017763 0ustar00options['category'] = $category; $this->options['startDate'] = $startDate; $this->options['endDate'] = $endDate; $this->options['includeSubaccounts'] = $includeSubaccounts; } /** * The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. * * @param string $category The usage category of the UsageRecord resources to * read * @return $this Fluent Builder */ public function setCategory(string $category): self { $this->options['category'] = $category; return $this; } /** * Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. * * @param \DateTime $startDate Only include usage that has occurred on or after * this date * @return $this Fluent Builder */ public function setStartDate(\DateTime $startDate): self { $this->options['startDate'] = $startDate; return $this; } /** * Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. * * @param \DateTime $endDate Only include usage that occurred on or before this * date * @return $this Fluent Builder */ public function setEndDate(\DateTime $endDate): self { $this->options['endDate'] = $endDate; return $this; } /** * Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. * * @param bool $includeSubaccounts Whether to include usage from the master * account and all its subaccounts * @return $this Fluent Builder */ public function setIncludeSubaccounts(bool $includeSubaccounts): self { $this->options['includeSubaccounts'] = $includeSubaccounts; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadDailyOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/AllTimeOptions.php000064400000011151150515725670020246 0ustar00options['category'] = $category; $this->options['startDate'] = $startDate; $this->options['endDate'] = $endDate; $this->options['includeSubaccounts'] = $includeSubaccounts; } /** * The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. * * @param string $category The usage category of the UsageRecord resources to * read * @return $this Fluent Builder */ public function setCategory(string $category): self { $this->options['category'] = $category; return $this; } /** * Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. * * @param \DateTime $startDate Only include usage that has occurred on or after * this date * @return $this Fluent Builder */ public function setStartDate(\DateTime $startDate): self { $this->options['startDate'] = $startDate; return $this; } /** * Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. * * @param \DateTime $endDate Only include usage that occurred on or before this * date * @return $this Fluent Builder */ public function setEndDate(\DateTime $endDate): self { $this->options['endDate'] = $endDate; return $this; } /** * Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. * * @param bool $includeSubaccounts Whether to include usage from the master * account and all its subaccounts * @return $this Fluent Builder */ public function setIncludeSubaccounts(bool $includeSubaccounts): self { $this->options['includeSubaccounts'] = $includeSubaccounts; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadAllTimeOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/ThisMonthInstance.php000064400000006273150515725670020756 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'apiVersion' => Values::array_get($payload, 'api_version'), 'asOf' => Values::array_get($payload, 'as_of'), 'category' => Values::array_get($payload, 'category'), 'count' => Values::array_get($payload, 'count'), 'countUnit' => Values::array_get($payload, 'count_unit'), 'description' => Values::array_get($payload, 'description'), 'endDate' => Deserialize::dateTime(Values::array_get($payload, 'end_date')), 'price' => Values::array_get($payload, 'price'), 'priceUnit' => Values::array_get($payload, 'price_unit'), 'startDate' => Deserialize::dateTime(Values::array_get($payload, 'start_date')), 'subresourceUris' => Values::array_get($payload, 'subresource_uris'), 'uri' => Values::array_get($payload, 'uri'), 'usage' => Values::array_get($payload, 'usage'), 'usageUnit' => Values::array_get($payload, 'usage_unit'), ]; $this->solution = ['accountSid' => $accountSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Api.V2010.ThisMonthInstance]'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/TodayOptions.php000064400000011135150515725670020001 0ustar00options['category'] = $category; $this->options['startDate'] = $startDate; $this->options['endDate'] = $endDate; $this->options['includeSubaccounts'] = $includeSubaccounts; } /** * The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. * * @param string $category The usage category of the UsageRecord resources to * read * @return $this Fluent Builder */ public function setCategory(string $category): self { $this->options['category'] = $category; return $this; } /** * Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. * * @param \DateTime $startDate Only include usage that has occurred on or after * this date * @return $this Fluent Builder */ public function setStartDate(\DateTime $startDate): self { $this->options['startDate'] = $startDate; return $this; } /** * Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. * * @param \DateTime $endDate Only include usage that occurred on or before this * date * @return $this Fluent Builder */ public function setEndDate(\DateTime $endDate): self { $this->options['endDate'] = $endDate; return $this; } /** * Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. * * @param bool $includeSubaccounts Whether to include usage from the master * account and all its subaccounts * @return $this Fluent Builder */ public function setIncludeSubaccounts(bool $includeSubaccounts): self { $this->options['includeSubaccounts'] = $includeSubaccounts; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadTodayOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/LastMonthInstance.php000064400000006273150515725670020752 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'apiVersion' => Values::array_get($payload, 'api_version'), 'asOf' => Values::array_get($payload, 'as_of'), 'category' => Values::array_get($payload, 'category'), 'count' => Values::array_get($payload, 'count'), 'countUnit' => Values::array_get($payload, 'count_unit'), 'description' => Values::array_get($payload, 'description'), 'endDate' => Deserialize::dateTime(Values::array_get($payload, 'end_date')), 'price' => Values::array_get($payload, 'price'), 'priceUnit' => Values::array_get($payload, 'price_unit'), 'startDate' => Deserialize::dateTime(Values::array_get($payload, 'start_date')), 'subresourceUris' => Values::array_get($payload, 'subresource_uris'), 'uri' => Values::array_get($payload, 'uri'), 'usage' => Values::array_get($payload, 'usage'), 'usageUnit' => Values::array_get($payload, 'usage_unit'), ]; $this->solution = ['accountSid' => $accountSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Api.V2010.LastMonthInstance]'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/MonthlyList.php000064400000012233150515725670017633 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Usage/Records/Monthly.json'; } /** * Streams MonthlyInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads MonthlyInstance 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 MonthlyInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of MonthlyInstance 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 MonthlyPage Page of MonthlyInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): MonthlyPage { $options = new Values($options); $params = Values::of([ 'Category' => $options['category'], 'StartDate' => Serialize::iso8601Date($options['startDate']), 'EndDate' => Serialize::iso8601Date($options['endDate']), 'IncludeSubaccounts' => Serialize::booleanToString($options['includeSubaccounts']), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new MonthlyPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of MonthlyInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return MonthlyPage Page of MonthlyInstance */ public function getPage(string $targetUrl): MonthlyPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new MonthlyPage($this->version, $response, $this->solution); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.MonthlyList]'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/AllTimeInstance.php000064400000006265150515725670020371 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'apiVersion' => Values::array_get($payload, 'api_version'), 'asOf' => Values::array_get($payload, 'as_of'), 'category' => Values::array_get($payload, 'category'), 'count' => Values::array_get($payload, 'count'), 'countUnit' => Values::array_get($payload, 'count_unit'), 'description' => Values::array_get($payload, 'description'), 'endDate' => Deserialize::dateTime(Values::array_get($payload, 'end_date')), 'price' => Values::array_get($payload, 'price'), 'priceUnit' => Values::array_get($payload, 'price_unit'), 'startDate' => Deserialize::dateTime(Values::array_get($payload, 'start_date')), 'subresourceUris' => Values::array_get($payload, 'subresource_uris'), 'uri' => Values::array_get($payload, 'uri'), 'usage' => Values::array_get($payload, 'usage'), 'usageUnit' => Values::array_get($payload, 'usage_unit'), ]; $this->solution = ['accountSid' => $accountSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Api.V2010.AllTimeInstance]'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/LastMonthPage.php000064400000002316150515725670020054 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return LastMonthInstance \Twilio\Rest\Api\V2010\Account\Usage\Record\LastMonthInstance */ public function buildInstance(array $payload): LastMonthInstance { return new LastMonthInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.LastMonthPage]'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/TodayPage.php000064400000002266150515725670017227 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return TodayInstance \Twilio\Rest\Api\V2010\Account\Usage\Record\TodayInstance */ public function buildInstance(array $payload): TodayInstance { return new TodayInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.TodayPage]'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/YearlyList.php000064400000012212150515725670017443 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Usage/Records/Yearly.json'; } /** * Streams YearlyInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads YearlyInstance 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 YearlyInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of YearlyInstance 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 YearlyPage Page of YearlyInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): YearlyPage { $options = new Values($options); $params = Values::of([ 'Category' => $options['category'], 'StartDate' => Serialize::iso8601Date($options['startDate']), 'EndDate' => Serialize::iso8601Date($options['endDate']), 'IncludeSubaccounts' => Serialize::booleanToString($options['includeSubaccounts']), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new YearlyPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of YearlyInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return YearlyPage Page of YearlyInstance */ public function getPage(string $targetUrl): YearlyPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new YearlyPage($this->version, $response, $this->solution); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.YearlyList]'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/AllTimePage.php000064400000002302150515725670017465 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return AllTimeInstance \Twilio\Rest\Api\V2010\Account\Usage\Record\AllTimeInstance */ public function buildInstance(array $payload): AllTimeInstance { return new AllTimeInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.AllTimePage]'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/YearlyPage.php000064400000002274150515725670017413 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return YearlyInstance \Twilio\Rest\Api\V2010\Account\Usage\Record\YearlyInstance */ public function buildInstance(array $payload): YearlyInstance { return new YearlyInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.YearlyPage]'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/YesterdayOptions.php000064400000011165150515725670020675 0ustar00options['category'] = $category; $this->options['startDate'] = $startDate; $this->options['endDate'] = $endDate; $this->options['includeSubaccounts'] = $includeSubaccounts; } /** * The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. * * @param string $category The usage category of the UsageRecord resources to * read * @return $this Fluent Builder */ public function setCategory(string $category): self { $this->options['category'] = $category; return $this; } /** * Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. * * @param \DateTime $startDate Only include usage that has occurred on or after * this date * @return $this Fluent Builder */ public function setStartDate(\DateTime $startDate): self { $this->options['startDate'] = $startDate; return $this; } /** * Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. * * @param \DateTime $endDate Only include usage that occurred on or before this * date * @return $this Fluent Builder */ public function setEndDate(\DateTime $endDate): self { $this->options['endDate'] = $endDate; return $this; } /** * Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. * * @param bool $includeSubaccounts Whether to include usage from the master * account and all its subaccounts * @return $this Fluent Builder */ public function setIncludeSubaccounts(bool $includeSubaccounts): self { $this->options['includeSubaccounts'] = $includeSubaccounts; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadYesterdayOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/YesterdayInstance.php000064400000006273150515725670021012 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'apiVersion' => Values::array_get($payload, 'api_version'), 'asOf' => Values::array_get($payload, 'as_of'), 'category' => Values::array_get($payload, 'category'), 'count' => Values::array_get($payload, 'count'), 'countUnit' => Values::array_get($payload, 'count_unit'), 'description' => Values::array_get($payload, 'description'), 'endDate' => Deserialize::dateTime(Values::array_get($payload, 'end_date')), 'price' => Values::array_get($payload, 'price'), 'priceUnit' => Values::array_get($payload, 'price_unit'), 'startDate' => Deserialize::dateTime(Values::array_get($payload, 'start_date')), 'subresourceUris' => Values::array_get($payload, 'subresource_uris'), 'uri' => Values::array_get($payload, 'uri'), 'usage' => Values::array_get($payload, 'usage'), 'usageUnit' => Values::array_get($payload, 'usage_unit'), ]; $this->solution = ['accountSid' => $accountSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Api.V2010.YesterdayInstance]'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/ThisMonthList.php000064400000012275150515725670020124 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Usage/Records/ThisMonth.json'; } /** * Streams ThisMonthInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ThisMonthInstance 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 ThisMonthInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of ThisMonthInstance 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 ThisMonthPage Page of ThisMonthInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ThisMonthPage { $options = new Values($options); $params = Values::of([ 'Category' => $options['category'], 'StartDate' => Serialize::iso8601Date($options['startDate']), 'EndDate' => Serialize::iso8601Date($options['endDate']), 'IncludeSubaccounts' => Serialize::booleanToString($options['includeSubaccounts']), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ThisMonthPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ThisMonthInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ThisMonthPage Page of ThisMonthInstance */ public function getPage(string $targetUrl): ThisMonthPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ThisMonthPage($this->version, $response, $this->solution); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.ThisMonthList]'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/TodayInstance.php000064400000006257150515725670020123 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'apiVersion' => Values::array_get($payload, 'api_version'), 'asOf' => Values::array_get($payload, 'as_of'), 'category' => Values::array_get($payload, 'category'), 'count' => Values::array_get($payload, 'count'), 'countUnit' => Values::array_get($payload, 'count_unit'), 'description' => Values::array_get($payload, 'description'), 'endDate' => Deserialize::dateTime(Values::array_get($payload, 'end_date')), 'price' => Values::array_get($payload, 'price'), 'priceUnit' => Values::array_get($payload, 'price_unit'), 'startDate' => Deserialize::dateTime(Values::array_get($payload, 'start_date')), 'subresourceUris' => Values::array_get($payload, 'subresource_uris'), 'uri' => Values::array_get($payload, 'uri'), 'usage' => Values::array_get($payload, 'usage'), 'usageUnit' => Values::array_get($payload, 'usage_unit'), ]; $this->solution = ['accountSid' => $accountSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Api.V2010.TodayInstance]'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/TodayList.php000064400000012171150515725670017262 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Usage/Records/Today.json'; } /** * Streams TodayInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads TodayInstance 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 TodayInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of TodayInstance 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 TodayPage Page of TodayInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): TodayPage { $options = new Values($options); $params = Values::of([ 'Category' => $options['category'], 'StartDate' => Serialize::iso8601Date($options['startDate']), 'EndDate' => Serialize::iso8601Date($options['endDate']), 'IncludeSubaccounts' => Serialize::booleanToString($options['includeSubaccounts']), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new TodayPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of TodayInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return TodayPage Page of TodayInstance */ public function getPage(string $targetUrl): TodayPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new TodayPage($this->version, $response, $this->solution); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.TodayList]'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/MonthlyPage.php000064400000002302150515725670017570 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return MonthlyInstance \Twilio\Rest\Api\V2010\Account\Usage\Record\MonthlyInstance */ public function buildInstance(array $payload): MonthlyInstance { return new MonthlyInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.MonthlyPage]'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/DailyInstance.php000064400000006257150515725670020105 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'apiVersion' => Values::array_get($payload, 'api_version'), 'asOf' => Values::array_get($payload, 'as_of'), 'category' => Values::array_get($payload, 'category'), 'count' => Values::array_get($payload, 'count'), 'countUnit' => Values::array_get($payload, 'count_unit'), 'description' => Values::array_get($payload, 'description'), 'endDate' => Deserialize::dateTime(Values::array_get($payload, 'end_date')), 'price' => Values::array_get($payload, 'price'), 'priceUnit' => Values::array_get($payload, 'price_unit'), 'startDate' => Deserialize::dateTime(Values::array_get($payload, 'start_date')), 'subresourceUris' => Values::array_get($payload, 'subresource_uris'), 'uri' => Values::array_get($payload, 'uri'), 'usage' => Values::array_get($payload, 'usage'), 'usageUnit' => Values::array_get($payload, 'usage_unit'), ]; $this->solution = ['accountSid' => $accountSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Api.V2010.DailyInstance]'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/LastMonthList.php000064400000012275150515725670020120 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Usage/Records/LastMonth.json'; } /** * Streams LastMonthInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads LastMonthInstance 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 LastMonthInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of LastMonthInstance 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 LastMonthPage Page of LastMonthInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): LastMonthPage { $options = new Values($options); $params = Values::of([ 'Category' => $options['category'], 'StartDate' => Serialize::iso8601Date($options['startDate']), 'EndDate' => Serialize::iso8601Date($options['endDate']), 'IncludeSubaccounts' => Serialize::booleanToString($options['includeSubaccounts']), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new LastMonthPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of LastMonthInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return LastMonthPage Page of LastMonthInstance */ public function getPage(string $targetUrl): LastMonthPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new LastMonthPage($this->version, $response, $this->solution); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.LastMonthList]'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/ThisMonthPage.php000064400000002316150515725670020060 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ThisMonthInstance \Twilio\Rest\Api\V2010\Account\Usage\Record\ThisMonthInstance */ public function buildInstance(array $payload): ThisMonthInstance { return new ThisMonthInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.ThisMonthPage]'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/MonthlyInstance.php000064400000006265150515725670020474 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'apiVersion' => Values::array_get($payload, 'api_version'), 'asOf' => Values::array_get($payload, 'as_of'), 'category' => Values::array_get($payload, 'category'), 'count' => Values::array_get($payload, 'count'), 'countUnit' => Values::array_get($payload, 'count_unit'), 'description' => Values::array_get($payload, 'description'), 'endDate' => Deserialize::dateTime(Values::array_get($payload, 'end_date')), 'price' => Values::array_get($payload, 'price'), 'priceUnit' => Values::array_get($payload, 'price_unit'), 'startDate' => Deserialize::dateTime(Values::array_get($payload, 'start_date')), 'subresourceUris' => Values::array_get($payload, 'subresource_uris'), 'uri' => Values::array_get($payload, 'uri'), 'usage' => Values::array_get($payload, 'usage'), 'usageUnit' => Values::array_get($payload, 'usage_unit'), ]; $this->solution = ['accountSid' => $accountSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Api.V2010.MonthlyInstance]'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/YearlyOptions.php000064400000011143150515725670020165 0ustar00options['category'] = $category; $this->options['startDate'] = $startDate; $this->options['endDate'] = $endDate; $this->options['includeSubaccounts'] = $includeSubaccounts; } /** * The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. * * @param string $category The usage category of the UsageRecord resources to * read * @return $this Fluent Builder */ public function setCategory(string $category): self { $this->options['category'] = $category; return $this; } /** * Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. * * @param \DateTime $startDate Only include usage that has occurred on or after * this date * @return $this Fluent Builder */ public function setStartDate(\DateTime $startDate): self { $this->options['startDate'] = $startDate; return $this; } /** * Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. * * @param \DateTime $endDate Only include usage that occurred on or before this * date * @return $this Fluent Builder */ public function setEndDate(\DateTime $endDate): self { $this->options['endDate'] = $endDate; return $this; } /** * Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. * * @param bool $includeSubaccounts Whether to include usage from the master * account and all its subaccounts * @return $this Fluent Builder */ public function setIncludeSubaccounts(bool $includeSubaccounts): self { $this->options['includeSubaccounts'] = $includeSubaccounts; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadYearlyOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/AllTimeList.php000064400000012233150515725670017530 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Usage/Records/AllTime.json'; } /** * Streams AllTimeInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads AllTimeInstance 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 AllTimeInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of AllTimeInstance 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 AllTimePage Page of AllTimeInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): AllTimePage { $options = new Values($options); $params = Values::of([ 'Category' => $options['category'], 'StartDate' => Serialize::iso8601Date($options['startDate']), 'EndDate' => Serialize::iso8601Date($options['endDate']), 'IncludeSubaccounts' => Serialize::booleanToString($options['includeSubaccounts']), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new AllTimePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of AllTimeInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return AllTimePage Page of AllTimeInstance */ public function getPage(string $targetUrl): AllTimePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new AllTimePage($this->version, $response, $this->solution); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.AllTimeList]'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/DailyList.php000064400000012171150515725670017244 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Usage/Records/Daily.json'; } /** * Streams DailyInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads DailyInstance 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 DailyInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of DailyInstance 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 DailyPage Page of DailyInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): DailyPage { $options = new Values($options); $params = Values::of([ 'Category' => $options['category'], 'StartDate' => Serialize::iso8601Date($options['startDate']), 'EndDate' => Serialize::iso8601Date($options['endDate']), 'IncludeSubaccounts' => Serialize::booleanToString($options['includeSubaccounts']), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new DailyPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of DailyInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return DailyPage Page of DailyInstance */ public function getPage(string $targetUrl): DailyPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new DailyPage($this->version, $response, $this->solution); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.DailyList]'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/YesterdayList.php000064400000012275150515725670020160 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Usage/Records/Yesterday.json'; } /** * Streams YesterdayInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads YesterdayInstance 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 YesterdayInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of YesterdayInstance 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 YesterdayPage Page of YesterdayInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): YesterdayPage { $options = new Values($options); $params = Values::of([ 'Category' => $options['category'], 'StartDate' => Serialize::iso8601Date($options['startDate']), 'EndDate' => Serialize::iso8601Date($options['endDate']), 'IncludeSubaccounts' => Serialize::booleanToString($options['includeSubaccounts']), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new YesterdayPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of YesterdayInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return YesterdayPage Page of YesterdayInstance */ public function getPage(string $targetUrl): YesterdayPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new YesterdayPage($this->version, $response, $this->solution); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.YesterdayList]'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/YearlyInstance.php000064400000006262150515725670020304 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'apiVersion' => Values::array_get($payload, 'api_version'), 'asOf' => Values::array_get($payload, 'as_of'), 'category' => Values::array_get($payload, 'category'), 'count' => Values::array_get($payload, 'count'), 'countUnit' => Values::array_get($payload, 'count_unit'), 'description' => Values::array_get($payload, 'description'), 'endDate' => Deserialize::dateTime(Values::array_get($payload, 'end_date')), 'price' => Values::array_get($payload, 'price'), 'priceUnit' => Values::array_get($payload, 'price_unit'), 'startDate' => Deserialize::dateTime(Values::array_get($payload, 'start_date')), 'subresourceUris' => Values::array_get($payload, 'subresource_uris'), 'uri' => Values::array_get($payload, 'uri'), 'usage' => Values::array_get($payload, 'usage'), 'usageUnit' => Values::array_get($payload, 'usage_unit'), ]; $this->solution = ['accountSid' => $accountSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Api.V2010.YearlyInstance]'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/MonthlyOptions.php000064400000011151150515725670020351 0ustar00options['category'] = $category; $this->options['startDate'] = $startDate; $this->options['endDate'] = $endDate; $this->options['includeSubaccounts'] = $includeSubaccounts; } /** * The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. * * @param string $category The usage category of the UsageRecord resources to * read * @return $this Fluent Builder */ public function setCategory(string $category): self { $this->options['category'] = $category; return $this; } /** * Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. * * @param \DateTime $startDate Only include usage that has occurred on or after * this date * @return $this Fluent Builder */ public function setStartDate(\DateTime $startDate): self { $this->options['startDate'] = $startDate; return $this; } /** * Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. * * @param \DateTime $endDate Only include usage that occurred on or before this * date * @return $this Fluent Builder */ public function setEndDate(\DateTime $endDate): self { $this->options['endDate'] = $endDate; return $this; } /** * Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. * * @param bool $includeSubaccounts Whether to include usage from the master * account and all its subaccounts * @return $this Fluent Builder */ public function setIncludeSubaccounts(bool $includeSubaccounts): self { $this->options['includeSubaccounts'] = $includeSubaccounts; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadMonthlyOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/DailyPage.php000064400000002266150515725670017211 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return DailyInstance \Twilio\Rest\Api\V2010\Account\Usage\Record\DailyInstance */ public function buildInstance(array $payload): DailyInstance { return new DailyInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.DailyPage]'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/YesterdayPage.php000064400000002316150515725670020114 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return YesterdayInstance \Twilio\Rest\Api\V2010\Account\Usage\Record\YesterdayInstance */ public function buildInstance(array $payload): YesterdayInstance { return new YesterdayInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.YesterdayPage]'; } }src/Twilio/Rest/Api/V2010/Account/Usage/Record/ThisMonthOptions.php000064400000011165150515725670020641 0ustar00options['category'] = $category; $this->options['startDate'] = $startDate; $this->options['endDate'] = $endDate; $this->options['includeSubaccounts'] = $includeSubaccounts; } /** * The [usage category](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) of the UsageRecord resources to read. Only UsageRecord resources in the specified category are retrieved. * * @param string $category The usage category of the UsageRecord resources to * read * @return $this Fluent Builder */ public function setCategory(string $category): self { $this->options['category'] = $category; return $this; } /** * Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `-30days`, which will set the start date to be 30 days before the current date. * * @param \DateTime $startDate Only include usage that has occurred on or after * this date * @return $this Fluent Builder */ public function setStartDate(\DateTime $startDate): self { $this->options['startDate'] = $startDate; return $this; } /** * Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. You can also specify offsets from the current date, such as: `+30days`, which will set the end date to 30 days from the current date. * * @param \DateTime $endDate Only include usage that occurred on or before this * date * @return $this Fluent Builder */ public function setEndDate(\DateTime $endDate): self { $this->options['endDate'] = $endDate; return $this; } /** * Whether to include usage from the master account and all its subaccounts. Can be: `true` (the default) to include usage from the master account and all subaccounts or `false` to retrieve usage from only the specified account. * * @param bool $includeSubaccounts Whether to include usage from the master * account and all its subaccounts * @return $this Fluent Builder */ public function setIncludeSubaccounts(bool $includeSubaccounts): self { $this->options['includeSubaccounts'] = $includeSubaccounts; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadThisMonthOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/Usage/TriggerOptions.php000064400000022550150515725670017111 0ustar00options['callbackMethod'] = $callbackMethod; $this->options['callbackUrl'] = $callbackUrl; $this->options['friendlyName'] = $friendlyName; } /** * The HTTP method we should use to call `callback_url`. Can be: `GET` or `POST` and the default is `POST`. * * @param string $callbackMethod The HTTP method to use to call callback_url * @return $this Fluent Builder */ public function setCallbackMethod(string $callbackMethod): self { $this->options['callbackMethod'] = $callbackMethod; return $this; } /** * The URL we should call using `callback_method` when the trigger fires. * * @param string $callbackUrl The URL we call when the trigger fires * @return $this Fluent Builder */ public function setCallbackUrl(string $callbackUrl): self { $this->options['callbackUrl'] = $callbackUrl; return $this; } /** * A descriptive string that you create to describe the resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.UpdateTriggerOptions ' . $options . ']'; } } class CreateTriggerOptions extends Options { /** * @param string $callbackMethod The HTTP method to use to call callback_url * @param string $friendlyName A string to describe the resource * @param string $recurring The frequency of a recurring UsageTrigger * @param string $triggerBy The field in the UsageRecord resource that fires * the trigger */ public function __construct(string $callbackMethod = Values::NONE, string $friendlyName = Values::NONE, string $recurring = Values::NONE, string $triggerBy = Values::NONE) { $this->options['callbackMethod'] = $callbackMethod; $this->options['friendlyName'] = $friendlyName; $this->options['recurring'] = $recurring; $this->options['triggerBy'] = $triggerBy; } /** * The HTTP method we should use to call `callback_url`. Can be: `GET` or `POST` and the default is `POST`. * * @param string $callbackMethod The HTTP method to use to call callback_url * @return $this Fluent Builder */ public function setCallbackMethod(string $callbackMethod): self { $this->options['callbackMethod'] = $callbackMethod; return $this; } /** * A descriptive string that you create to describe the resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The frequency of a recurring UsageTrigger. Can be: `daily`, `monthly`, or `yearly` for recurring triggers or empty for non-recurring triggers. A trigger will only fire once during each period. Recurring times are in GMT. * * @param string $recurring The frequency of a recurring UsageTrigger * @return $this Fluent Builder */ public function setRecurring(string $recurring): self { $this->options['recurring'] = $recurring; return $this; } /** * The field in the [UsageRecord](https://www.twilio.com/docs/usage/api/usage-record) resource that should fire the trigger. Can be: `count`, `usage`, or `price` as described in the [UsageRecords documentation](https://www.twilio.com/docs/usage/api/usage-record#usage-count-price). The default is `usage`. * * @param string $triggerBy The field in the UsageRecord resource that fires * the trigger * @return $this Fluent Builder */ public function setTriggerBy(string $triggerBy): self { $this->options['triggerBy'] = $triggerBy; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.CreateTriggerOptions ' . $options . ']'; } } class ReadTriggerOptions extends Options { /** * @param string $recurring The frequency of recurring UsageTriggers to read * @param string $triggerBy The trigger field of the UsageTriggers to read * @param string $usageCategory The usage category of the UsageTriggers to read */ public function __construct(string $recurring = Values::NONE, string $triggerBy = Values::NONE, string $usageCategory = Values::NONE) { $this->options['recurring'] = $recurring; $this->options['triggerBy'] = $triggerBy; $this->options['usageCategory'] = $usageCategory; } /** * The frequency of recurring UsageTriggers to read. Can be: `daily`, `monthly`, or `yearly` to read recurring UsageTriggers. An empty value or a value of `alltime` reads non-recurring UsageTriggers. * * @param string $recurring The frequency of recurring UsageTriggers to read * @return $this Fluent Builder */ public function setRecurring(string $recurring): self { $this->options['recurring'] = $recurring; return $this; } /** * The trigger field of the UsageTriggers to read. Can be: `count`, `usage`, or `price` as described in the [UsageRecords documentation](https://www.twilio.com/docs/usage/api/usage-record#usage-count-price). * * @param string $triggerBy The trigger field of the UsageTriggers to read * @return $this Fluent Builder */ public function setTriggerBy(string $triggerBy): self { $this->options['triggerBy'] = $triggerBy; return $this; } /** * The usage category of the UsageTriggers to read. Must be a supported [usage categories](https://www.twilio.com/docs/usage/api/usage-record#usage-categories). * * @param string $usageCategory The usage category of the UsageTriggers to read * @return $this Fluent Builder */ public function setUsageCategory(string $usageCategory): self { $this->options['usageCategory'] = $usageCategory; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadTriggerOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/Usage/RecordList.php000064400000022612150515725670016203 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Usage/Records.json'; } /** * Streams RecordInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads RecordInstance 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 RecordInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of RecordInstance 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 RecordPage Page of RecordInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): RecordPage { $options = new Values($options); $params = Values::of([ 'Category' => $options['category'], 'StartDate' => Serialize::iso8601Date($options['startDate']), 'EndDate' => Serialize::iso8601Date($options['endDate']), 'IncludeSubaccounts' => Serialize::booleanToString($options['includeSubaccounts']), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new RecordPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of RecordInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return RecordPage Page of RecordInstance */ public function getPage(string $targetUrl): RecordPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new RecordPage($this->version, $response, $this->solution); } /** * Access the allTime */ protected function getAllTime(): AllTimeList { if (!$this->_allTime) { $this->_allTime = new AllTimeList($this->version, $this->solution['accountSid']); } return $this->_allTime; } /** * Access the daily */ protected function getDaily(): DailyList { if (!$this->_daily) { $this->_daily = new DailyList($this->version, $this->solution['accountSid']); } return $this->_daily; } /** * Access the lastMonth */ protected function getLastMonth(): LastMonthList { if (!$this->_lastMonth) { $this->_lastMonth = new LastMonthList($this->version, $this->solution['accountSid']); } return $this->_lastMonth; } /** * Access the monthly */ protected function getMonthly(): MonthlyList { if (!$this->_monthly) { $this->_monthly = new MonthlyList($this->version, $this->solution['accountSid']); } return $this->_monthly; } /** * Access the thisMonth */ protected function getThisMonth(): ThisMonthList { if (!$this->_thisMonth) { $this->_thisMonth = new ThisMonthList($this->version, $this->solution['accountSid']); } return $this->_thisMonth; } /** * Access the today */ protected function getToday(): TodayList { if (!$this->_today) { $this->_today = new TodayList($this->version, $this->solution['accountSid']); } return $this->_today; } /** * Access the yearly */ protected function getYearly(): YearlyList { if (!$this->_yearly) { $this->_yearly = new YearlyList($this->version, $this->solution['accountSid']); } return $this->_yearly; } /** * Access the yesterday */ protected function getYesterday(): YesterdayList { if (!$this->_yesterday) { $this->_yesterday = new YesterdayList($this->version, $this->solution['accountSid']); } return $this->_yesterday; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return \Twilio\ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Api.V2010.RecordList]'; } }src/Twilio/Rest/Api/V2010/Account/Usage/TriggerList.php000064400000014755150515725670016401 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Usage/Triggers.json'; } /** * Create the TriggerInstance * * @param string $callbackUrl The URL we call when the trigger fires * @param string $triggerValue The usage value at which the trigger should fire * @param string $usageCategory The usage category the trigger watches * @param array|Options $options Optional Arguments * @return TriggerInstance Created TriggerInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $callbackUrl, string $triggerValue, string $usageCategory, array $options = []): TriggerInstance { $options = new Values($options); $data = Values::of([ 'CallbackUrl' => $callbackUrl, 'TriggerValue' => $triggerValue, 'UsageCategory' => $usageCategory, 'CallbackMethod' => $options['callbackMethod'], 'FriendlyName' => $options['friendlyName'], 'Recurring' => $options['recurring'], 'TriggerBy' => $options['triggerBy'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new TriggerInstance($this->version, $payload, $this->solution['accountSid']); } /** * Streams TriggerInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads TriggerInstance 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 TriggerInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of TriggerInstance 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 TriggerPage Page of TriggerInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): TriggerPage { $options = new Values($options); $params = Values::of([ 'Recurring' => $options['recurring'], 'TriggerBy' => $options['triggerBy'], 'UsageCategory' => $options['usageCategory'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new TriggerPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of TriggerInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return TriggerPage Page of TriggerInstance */ public function getPage(string $targetUrl): TriggerPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new TriggerPage($this->version, $response, $this->solution); } /** * Constructs a TriggerContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): TriggerContext { return new TriggerContext($this->version, $this->solution['accountSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.TriggerList]'; } }src/Twilio/Rest/Api/V2010/Account/Usage/TriggerInstance.php000064400000012160150515725670017216 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'apiVersion' => Values::array_get($payload, 'api_version'), 'callbackMethod' => Values::array_get($payload, 'callback_method'), 'callbackUrl' => Values::array_get($payload, 'callback_url'), 'currentValue' => Values::array_get($payload, 'current_value'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateFired' => Deserialize::dateTime(Values::array_get($payload, 'date_fired')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'recurring' => Values::array_get($payload, 'recurring'), 'sid' => Values::array_get($payload, 'sid'), 'triggerBy' => Values::array_get($payload, 'trigger_by'), 'triggerValue' => Values::array_get($payload, 'trigger_value'), 'uri' => Values::array_get($payload, 'uri'), 'usageCategory' => Values::array_get($payload, 'usage_category'), 'usageRecordUri' => Values::array_get($payload, 'usage_record_uri'), ]; $this->solution = ['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 TriggerContext Context for this TriggerInstance */ protected function proxy(): TriggerContext { if (!$this->context) { $this->context = new TriggerContext( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the TriggerInstance * * @return TriggerInstance Fetched TriggerInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TriggerInstance { return $this->proxy()->fetch(); } /** * Update the TriggerInstance * * @param array|Options $options Optional Arguments * @return TriggerInstance Updated TriggerInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): TriggerInstance { return $this->proxy()->update($options); } /** * Delete the TriggerInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.TriggerInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Usage/TriggerPage.php000064400000002264150515725670016332 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return TriggerInstance \Twilio\Rest\Api\V2010\Account\Usage\TriggerInstance */ public function buildInstance(array $payload): TriggerInstance { return new TriggerInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.TriggerPage]'; } }src/Twilio/Rest/Api/V2010/Account/Usage/RecordPage.php000064400000002256150515725670016146 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return RecordInstance \Twilio\Rest\Api\V2010\Account\Usage\RecordInstance */ public function buildInstance(array $payload): RecordInstance { return new RecordInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.RecordPage]'; } }src/Twilio/Rest/Api/V2010/Account/Usage/RecordInstance.php000064400000006253150515725670017037 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'apiVersion' => Values::array_get($payload, 'api_version'), 'asOf' => Values::array_get($payload, 'as_of'), 'category' => Values::array_get($payload, 'category'), 'count' => Values::array_get($payload, 'count'), 'countUnit' => Values::array_get($payload, 'count_unit'), 'description' => Values::array_get($payload, 'description'), 'endDate' => Deserialize::dateTime(Values::array_get($payload, 'end_date')), 'price' => Values::array_get($payload, 'price'), 'priceUnit' => Values::array_get($payload, 'price_unit'), 'startDate' => Deserialize::dateTime(Values::array_get($payload, 'start_date')), 'subresourceUris' => Values::array_get($payload, 'subresource_uris'), 'uri' => Values::array_get($payload, 'uri'), 'usage' => Values::array_get($payload, 'usage'), 'usageUnit' => Values::array_get($payload, 'usage_unit'), ]; $this->solution = ['accountSid' => $accountSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Api.V2010.RecordInstance]'; } }src/Twilio/Rest/Api/V2010/Account/Conference/RecordingOptions.php000064400000012425150515725670020425 0ustar00options['pauseBehavior'] = $pauseBehavior; } /** * Whether to record during a pause. Can be: `skip` or `silence` and the default is `silence`. `skip` does not record during the pause period, while `silence` will replace the actual audio of the call with silence during the pause period. This parameter only applies when setting `status` is set to `paused`. * * @param string $pauseBehavior Whether to record during a pause * @return $this Fluent Builder */ public function setPauseBehavior(string $pauseBehavior): self { $this->options['pauseBehavior'] = $pauseBehavior; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.UpdateRecordingOptions ' . $options . ']'; } } class ReadRecordingOptions extends Options { /** * @param string $dateCreatedBefore The `YYYY-MM-DD` value of the resources to * read * @param string $dateCreated The `YYYY-MM-DD` value of the resources to read * @param string $dateCreatedAfter The `YYYY-MM-DD` value of the resources to * read */ public function __construct(string $dateCreatedBefore = Values::NONE, string $dateCreated = Values::NONE, string $dateCreatedAfter = Values::NONE) { $this->options['dateCreatedBefore'] = $dateCreatedBefore; $this->options['dateCreated'] = $dateCreated; $this->options['dateCreatedAfter'] = $dateCreatedAfter; } /** * The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. * * @param string $dateCreatedBefore The `YYYY-MM-DD` value of the resources to * read * @return $this Fluent Builder */ public function setDateCreatedBefore(string $dateCreatedBefore): self { $this->options['dateCreatedBefore'] = $dateCreatedBefore; return $this; } /** * The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. * * @param string $dateCreated The `YYYY-MM-DD` value of the resources to read * @return $this Fluent Builder */ public function setDateCreated(string $dateCreated): self { $this->options['dateCreated'] = $dateCreated; return $this; } /** * The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. You can also specify inequality: `DateCreated<=YYYY-MM-DD` will return recordings generated at or before midnight on a given date, and `DateCreated>=YYYY-MM-DD` returns recordings generated at or after midnight on a date. * * @param string $dateCreatedAfter The `YYYY-MM-DD` value of the resources to * read * @return $this Fluent Builder */ public function setDateCreatedAfter(string $dateCreatedAfter): self { $this->options['dateCreatedAfter'] = $dateCreatedAfter; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadRecordingOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/Conference/ParticipantContext.php000064400000007701150515725670020761 0ustar00solution = [ 'accountSid' => $accountSid, 'conferenceSid' => $conferenceSid, 'callSid' => $callSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Conferences/' . \rawurlencode($conferenceSid) . '/Participants/' . \rawurlencode($callSid) . '.json'; } /** * Fetch the ParticipantInstance * * @return ParticipantInstance Fetched ParticipantInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ParticipantInstance { $payload = $this->version->fetch('GET', $this->uri); return new ParticipantInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['conferenceSid'], $this->solution['callSid'] ); } /** * Update the ParticipantInstance * * @param array|Options $options Optional Arguments * @return ParticipantInstance Updated ParticipantInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ParticipantInstance { $options = new Values($options); $data = Values::of([ 'Muted' => Serialize::booleanToString($options['muted']), 'Hold' => Serialize::booleanToString($options['hold']), 'HoldUrl' => $options['holdUrl'], 'HoldMethod' => $options['holdMethod'], 'AnnounceUrl' => $options['announceUrl'], 'AnnounceMethod' => $options['announceMethod'], 'WaitUrl' => $options['waitUrl'], 'WaitMethod' => $options['waitMethod'], 'BeepOnExit' => Serialize::booleanToString($options['beepOnExit']), 'EndConferenceOnExit' => Serialize::booleanToString($options['endConferenceOnExit']), 'Coaching' => Serialize::booleanToString($options['coaching']), 'CallSidToCoach' => $options['callSidToCoach'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ParticipantInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['conferenceSid'], $this->solution['callSid'] ); } /** * Delete the ParticipantInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.ParticipantContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Conference/ParticipantPage.php000064400000002462150515725670020210 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ParticipantInstance \Twilio\Rest\Api\V2010\Account\Conference\ParticipantInstance */ public function buildInstance(array $payload): ParticipantInstance { return new ParticipantInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['conferenceSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.ParticipantPage]'; } }src/Twilio/Rest/Api/V2010/Account/Conference/ParticipantList.php000064400000022651150515725670020251 0ustar00solution = ['accountSid' => $accountSid, 'conferenceSid' => $conferenceSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Conferences/' . \rawurlencode($conferenceSid) . '/Participants.json'; } /** * Create the ParticipantInstance * * @param string $from The phone number, Client identifier, or username portion * of SIP address that made this call. * @param string $to The phone number, SIP address or Client identifier that * received this call. * @param array|Options $options Optional Arguments * @return ParticipantInstance Created ParticipantInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $from, string $to, array $options = []): ParticipantInstance { $options = new Values($options); $data = Values::of([ 'From' => $from, 'To' => $to, 'StatusCallback' => $options['statusCallback'], 'StatusCallbackMethod' => $options['statusCallbackMethod'], 'StatusCallbackEvent' => Serialize::map($options['statusCallbackEvent'], function($e) { return $e; }), 'Label' => $options['label'], 'Timeout' => $options['timeout'], 'Record' => Serialize::booleanToString($options['record']), 'Muted' => Serialize::booleanToString($options['muted']), 'Beep' => $options['beep'], 'StartConferenceOnEnter' => Serialize::booleanToString($options['startConferenceOnEnter']), 'EndConferenceOnExit' => Serialize::booleanToString($options['endConferenceOnExit']), 'WaitUrl' => $options['waitUrl'], 'WaitMethod' => $options['waitMethod'], 'EarlyMedia' => Serialize::booleanToString($options['earlyMedia']), 'MaxParticipants' => $options['maxParticipants'], 'ConferenceRecord' => $options['conferenceRecord'], 'ConferenceTrim' => $options['conferenceTrim'], 'ConferenceStatusCallback' => $options['conferenceStatusCallback'], 'ConferenceStatusCallbackMethod' => $options['conferenceStatusCallbackMethod'], 'ConferenceStatusCallbackEvent' => Serialize::map($options['conferenceStatusCallbackEvent'], function($e) { return $e; }), 'RecordingChannels' => $options['recordingChannels'], 'RecordingStatusCallback' => $options['recordingStatusCallback'], 'RecordingStatusCallbackMethod' => $options['recordingStatusCallbackMethod'], 'SipAuthUsername' => $options['sipAuthUsername'], 'SipAuthPassword' => $options['sipAuthPassword'], 'Region' => $options['region'], 'ConferenceRecordingStatusCallback' => $options['conferenceRecordingStatusCallback'], 'ConferenceRecordingStatusCallbackMethod' => $options['conferenceRecordingStatusCallbackMethod'], 'RecordingStatusCallbackEvent' => Serialize::map($options['recordingStatusCallbackEvent'], function($e) { return $e; }), 'ConferenceRecordingStatusCallbackEvent' => Serialize::map($options['conferenceRecordingStatusCallbackEvent'], function($e) { return $e; }), 'Coaching' => Serialize::booleanToString($options['coaching']), 'CallSidToCoach' => $options['callSidToCoach'], 'JitterBufferSize' => $options['jitterBufferSize'], 'Byoc' => $options['byoc'], 'CallerId' => $options['callerId'], 'CallReason' => $options['callReason'], 'RecordingTrack' => $options['recordingTrack'], 'TimeLimit' => $options['timeLimit'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ParticipantInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['conferenceSid'] ); } /** * Streams ParticipantInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ParticipantInstance 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 ParticipantInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of ParticipantInstance 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 ParticipantPage Page of ParticipantInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ParticipantPage { $options = new Values($options); $params = Values::of([ 'Muted' => Serialize::booleanToString($options['muted']), 'Hold' => Serialize::booleanToString($options['hold']), 'Coaching' => Serialize::booleanToString($options['coaching']), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ParticipantPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ParticipantInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ParticipantPage Page of ParticipantInstance */ public function getPage(string $targetUrl): ParticipantPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ParticipantPage($this->version, $response, $this->solution); } /** * Constructs a ParticipantContext * * @param string $callSid The Call SID or URL encoded label of the participant * to fetch */ public function getContext(string $callSid): ParticipantContext { return new ParticipantContext( $this->version, $this->solution['accountSid'], $this->solution['conferenceSid'], $callSid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.ParticipantList]'; } }src/Twilio/Rest/Api/V2010/Account/Conference/RecordingList.php000064400000013335150515725670017706 0ustar00solution = ['accountSid' => $accountSid, 'conferenceSid' => $conferenceSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Conferences/' . \rawurlencode($conferenceSid) . '/Recordings.json'; } /** * Streams RecordingInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads RecordingInstance 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 RecordingInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of RecordingInstance 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 RecordingPage Page of RecordingInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): RecordingPage { $options = new Values($options); $params = Values::of([ 'DateCreated<' => Serialize::iso8601Date($options['dateCreatedBefore']), 'DateCreated' => Serialize::iso8601Date($options['dateCreated']), 'DateCreated>' => Serialize::iso8601Date($options['dateCreatedAfter']), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new RecordingPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of RecordingInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return RecordingPage Page of RecordingInstance */ public function getPage(string $targetUrl): RecordingPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new RecordingPage($this->version, $response, $this->solution); } /** * Constructs a RecordingContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): RecordingContext { return new RecordingContext( $this->version, $this->solution['accountSid'], $this->solution['conferenceSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.RecordingList]'; } }src/Twilio/Rest/Api/V2010/Account/Conference/RecordingContext.php000064400000006171150515725670020417 0ustar00solution = ['accountSid' => $accountSid, 'conferenceSid' => $conferenceSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Conferences/' . \rawurlencode($conferenceSid) . '/Recordings/' . \rawurlencode($sid) . '.json'; } /** * Update the RecordingInstance * * @param string $status The new status of the recording * @param array|Options $options Optional Arguments * @return RecordingInstance Updated RecordingInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $status, array $options = []): RecordingInstance { $options = new Values($options); $data = Values::of(['Status' => $status, 'PauseBehavior' => $options['pauseBehavior'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new RecordingInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['conferenceSid'], $this->solution['sid'] ); } /** * Fetch the RecordingInstance * * @return RecordingInstance Fetched RecordingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RecordingInstance { $payload = $this->version->fetch('GET', $this->uri); return new RecordingInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['conferenceSid'], $this->solution['sid'] ); } /** * Delete the RecordingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.RecordingContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Conference/ParticipantOptions.php000064400000143744150515725670021000 0ustar00options['muted'] = $muted; $this->options['hold'] = $hold; $this->options['holdUrl'] = $holdUrl; $this->options['holdMethod'] = $holdMethod; $this->options['announceUrl'] = $announceUrl; $this->options['announceMethod'] = $announceMethod; $this->options['waitUrl'] = $waitUrl; $this->options['waitMethod'] = $waitMethod; $this->options['beepOnExit'] = $beepOnExit; $this->options['endConferenceOnExit'] = $endConferenceOnExit; $this->options['coaching'] = $coaching; $this->options['callSidToCoach'] = $callSidToCoach; } /** * Whether the participant should be muted. Can be `true` or `false`. `true` will mute the participant, and `false` will un-mute them. Anything value other than `true` or `false` is interpreted as `false`. * * @param bool $muted Whether the participant should be muted * @return $this Fluent Builder */ public function setMuted(bool $muted): self { $this->options['muted'] = $muted; return $this; } /** * Whether the participant should be on hold. Can be: `true` or `false`. `true` puts the participant on hold, and `false` lets them rejoin the conference. * * @param bool $hold Whether the participant should be on hold * @return $this Fluent Builder */ public function setHold(bool $hold): self { $this->options['hold'] = $hold; return $this; } /** * The URL we call using the `hold_method` for music that plays when the participant is on hold. The URL may return an MP3 file, a WAV file, or a TwiML document that contains the ``, `` or `` commands. * * @param string $holdUrl The URL we call using the `hold_method` for music * that plays when the participant is on hold * @return $this Fluent Builder */ public function setHoldUrl(string $holdUrl): self { $this->options['holdUrl'] = $holdUrl; return $this; } /** * The HTTP method we should use to call `hold_url`. Can be: `GET` or `POST` and the default is `GET`. * * @param string $holdMethod The HTTP method we should use to call hold_url * @return $this Fluent Builder */ public function setHoldMethod(string $holdMethod): self { $this->options['holdMethod'] = $holdMethod; return $this; } /** * The URL we call using the `announce_method` for an announcement to the participant. The URL must return an MP3 file, a WAV file, or a TwiML document that contains `` or `` commands. * * @param string $announceUrl The URL we call using the `announce_method` for * an announcement to the participant * @return $this Fluent Builder */ public function setAnnounceUrl(string $announceUrl): self { $this->options['announceUrl'] = $announceUrl; return $this; } /** * The HTTP method we should use to call `announce_url`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $announceMethod The HTTP method we should use to call * announce_url * @return $this Fluent Builder */ public function setAnnounceMethod(string $announceMethod): self { $this->options['announceMethod'] = $announceMethod; return $this; } /** * The URL we should call using the `wait_method` for the music to play while participants are waiting for the conference to start. The default value is the URL of our standard hold music. [Learn more about hold music](https://www.twilio.com/labs/twimlets/holdmusic). * * @param string $waitUrl URL that hosts pre-conference hold music * @return $this Fluent Builder */ public function setWaitUrl(string $waitUrl): self { $this->options['waitUrl'] = $waitUrl; return $this; } /** * The HTTP method we should use to call `wait_url`. Can be `GET` or `POST` and the default is `POST`. When using a static audio file, this should be `GET` so that we can cache the file. * * @param string $waitMethod The HTTP method we should use to call `wait_url` * @return $this Fluent Builder */ public function setWaitMethod(string $waitMethod): self { $this->options['waitMethod'] = $waitMethod; return $this; } /** * Whether to play a notification beep to the conference when the participant exits. Can be: `true` or `false`. * * @param bool $beepOnExit Whether to play a notification beep to the * conference when the participant exit * @return $this Fluent Builder */ public function setBeepOnExit(bool $beepOnExit): self { $this->options['beepOnExit'] = $beepOnExit; return $this; } /** * Whether to end the conference when the participant leaves. Can be: `true` or `false` and defaults to `false`. * * @param bool $endConferenceOnExit Whether to end the conference when the * participant leaves * @return $this Fluent Builder */ public function setEndConferenceOnExit(bool $endConferenceOnExit): self { $this->options['endConferenceOnExit'] = $endConferenceOnExit; return $this; } /** * Whether the participant is coaching another call. Can be: `true` or `false`. If not present, defaults to `false` unless `call_sid_to_coach` is defined. If `true`, `call_sid_to_coach` must be defined. * * @param bool $coaching Indicates if the participant changed to coach * @return $this Fluent Builder */ public function setCoaching(bool $coaching): self { $this->options['coaching'] = $coaching; return $this; } /** * The SID of the participant who is being `coached`. The participant being coached is the only participant who can hear the participant who is `coaching`. * * @param string $callSidToCoach The SID of the participant who is being * `coached` * @return $this Fluent Builder */ public function setCallSidToCoach(string $callSidToCoach): self { $this->options['callSidToCoach'] = $callSidToCoach; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.UpdateParticipantOptions ' . $options . ']'; } } class CreateParticipantOptions extends Options { /** * @param string $statusCallback The URL we should call to send status * information to your application * @param string $statusCallbackMethod The HTTP method we should use to call * `status_callback` * @param string[] $statusCallbackEvent Set state change events that will * trigger a callback * @param string $label The label of this participant * @param int $timeout he number of seconds that we should wait for an answer * @param bool $record Whether to record the participant and their conferences * @param bool $muted Whether to mute the agent * @param string $beep Whether to play a notification beep to the conference * when the participant joins * @param bool $startConferenceOnEnter Whether the conference starts when the * participant joins the conference * @param bool $endConferenceOnExit Whether to end the conference when the * participant leaves * @param string $waitUrl URL that hosts pre-conference hold music * @param string $waitMethod The HTTP method we should use to call `wait_url` * @param bool $earlyMedia Whether agents can hear the state of the outbound * call * @param int $maxParticipants The maximum number of agent conference * participants * @param string $conferenceRecord Whether to record the conference the * participant is joining * @param string $conferenceTrim Whether to trim leading and trailing silence * from your recorded conference audio files * @param string $conferenceStatusCallback The callback URL for conference * events * @param string $conferenceStatusCallbackMethod HTTP method for requesting * `conference_status_callback` * URL * @param string[] $conferenceStatusCallbackEvent The conference state changes * that should generate a call * to * `conference_status_callback` * @param string $recordingChannels Specify `mono` or `dual` recording channels * @param string $recordingStatusCallback The URL that we should call using the * `recording_status_callback_method` * when the recording status changes * @param string $recordingStatusCallbackMethod The HTTP method we should use * when we call * `recording_status_callback` * @param string $sipAuthUsername The SIP username used for authentication * @param string $sipAuthPassword The SIP password for authentication * @param string $region The region where we should mix the conference audio * @param string $conferenceRecordingStatusCallback The URL we should call * using the * `conference_recording_status_callback_method` when the conference recording is available * @param string $conferenceRecordingStatusCallbackMethod The HTTP method we * should use to call * `conference_recording_status_callback` * @param string[] $recordingStatusCallbackEvent The recording state changes * that should generate a call to * `recording_status_callback` * @param string[] $conferenceRecordingStatusCallbackEvent The conference * recording state * changes that should * generate a call to * `conference_recording_status_callback` * @param bool $coaching Indicates if the participant changed to coach * @param string $callSidToCoach The SID of the participant who is being * `coached` * @param string $jitterBufferSize Jitter Buffer size for the connecting * participant * @param string $byoc BYOC trunk SID (Beta) * @param string $callerId The phone number, Client identifier, or username * portion of SIP address that made this call. * @param string $callReason Reason for the call (Branded Calls Beta) * @param string $recordingTrack The track(s) to record * @param int $timeLimit The maximum duration of the call in seconds. */ public function __construct(string $statusCallback = Values::NONE, string $statusCallbackMethod = Values::NONE, array $statusCallbackEvent = Values::ARRAY_NONE, string $label = Values::NONE, int $timeout = Values::NONE, bool $record = Values::NONE, bool $muted = Values::NONE, string $beep = Values::NONE, bool $startConferenceOnEnter = Values::NONE, bool $endConferenceOnExit = Values::NONE, string $waitUrl = Values::NONE, string $waitMethod = Values::NONE, bool $earlyMedia = Values::NONE, int $maxParticipants = Values::NONE, string $conferenceRecord = Values::NONE, string $conferenceTrim = Values::NONE, string $conferenceStatusCallback = Values::NONE, string $conferenceStatusCallbackMethod = Values::NONE, array $conferenceStatusCallbackEvent = Values::ARRAY_NONE, string $recordingChannels = Values::NONE, string $recordingStatusCallback = Values::NONE, string $recordingStatusCallbackMethod = Values::NONE, string $sipAuthUsername = Values::NONE, string $sipAuthPassword = Values::NONE, string $region = Values::NONE, string $conferenceRecordingStatusCallback = Values::NONE, string $conferenceRecordingStatusCallbackMethod = Values::NONE, array $recordingStatusCallbackEvent = Values::ARRAY_NONE, array $conferenceRecordingStatusCallbackEvent = Values::ARRAY_NONE, bool $coaching = Values::NONE, string $callSidToCoach = Values::NONE, string $jitterBufferSize = Values::NONE, string $byoc = Values::NONE, string $callerId = Values::NONE, string $callReason = Values::NONE, string $recordingTrack = Values::NONE, int $timeLimit = Values::NONE) { $this->options['statusCallback'] = $statusCallback; $this->options['statusCallbackMethod'] = $statusCallbackMethod; $this->options['statusCallbackEvent'] = $statusCallbackEvent; $this->options['label'] = $label; $this->options['timeout'] = $timeout; $this->options['record'] = $record; $this->options['muted'] = $muted; $this->options['beep'] = $beep; $this->options['startConferenceOnEnter'] = $startConferenceOnEnter; $this->options['endConferenceOnExit'] = $endConferenceOnExit; $this->options['waitUrl'] = $waitUrl; $this->options['waitMethod'] = $waitMethod; $this->options['earlyMedia'] = $earlyMedia; $this->options['maxParticipants'] = $maxParticipants; $this->options['conferenceRecord'] = $conferenceRecord; $this->options['conferenceTrim'] = $conferenceTrim; $this->options['conferenceStatusCallback'] = $conferenceStatusCallback; $this->options['conferenceStatusCallbackMethod'] = $conferenceStatusCallbackMethod; $this->options['conferenceStatusCallbackEvent'] = $conferenceStatusCallbackEvent; $this->options['recordingChannels'] = $recordingChannels; $this->options['recordingStatusCallback'] = $recordingStatusCallback; $this->options['recordingStatusCallbackMethod'] = $recordingStatusCallbackMethod; $this->options['sipAuthUsername'] = $sipAuthUsername; $this->options['sipAuthPassword'] = $sipAuthPassword; $this->options['region'] = $region; $this->options['conferenceRecordingStatusCallback'] = $conferenceRecordingStatusCallback; $this->options['conferenceRecordingStatusCallbackMethod'] = $conferenceRecordingStatusCallbackMethod; $this->options['recordingStatusCallbackEvent'] = $recordingStatusCallbackEvent; $this->options['conferenceRecordingStatusCallbackEvent'] = $conferenceRecordingStatusCallbackEvent; $this->options['coaching'] = $coaching; $this->options['callSidToCoach'] = $callSidToCoach; $this->options['jitterBufferSize'] = $jitterBufferSize; $this->options['byoc'] = $byoc; $this->options['callerId'] = $callerId; $this->options['callReason'] = $callReason; $this->options['recordingTrack'] = $recordingTrack; $this->options['timeLimit'] = $timeLimit; } /** * The URL we should call using the `status_callback_method` to send status information to your application. * * @param string $statusCallback The URL we should call to send status * information to your application * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * The HTTP method we should use to call `status_callback`. Can be: `GET` and `POST` and defaults to `POST`. * * @param string $statusCallbackMethod The HTTP method we should use to call * `status_callback` * @return $this Fluent Builder */ public function setStatusCallbackMethod(string $statusCallbackMethod): self { $this->options['statusCallbackMethod'] = $statusCallbackMethod; return $this; } /** * The conference state changes that should generate a call to `status_callback`. Can be: `initiated`, `ringing`, `answered`, and `completed`. Separate multiple values with a space. The default value is `completed`. * * @param string[] $statusCallbackEvent Set state change events that will * trigger a callback * @return $this Fluent Builder */ public function setStatusCallbackEvent(array $statusCallbackEvent): self { $this->options['statusCallbackEvent'] = $statusCallbackEvent; return $this; } /** * A label for this participant. If one is supplied, it may subsequently be used to fetch, update or delete the participant. * * @param string $label The label of this participant * @return $this Fluent Builder */ public function setLabel(string $label): self { $this->options['label'] = $label; return $this; } /** * The number of seconds that we should allow the phone to ring before assuming there is no answer. Can be an integer between `5` and `600`, inclusive. The default value is `60`. We always add a 5-second timeout buffer to outgoing calls, so value of 10 would result in an actual timeout that was closer to 15 seconds. * * @param int $timeout he number of seconds that we should wait for an answer * @return $this Fluent Builder */ public function setTimeout(int $timeout): self { $this->options['timeout'] = $timeout; return $this; } /** * Whether to record the participant and their conferences, including the time between conferences. Can be `true` or `false` and the default is `false`. * * @param bool $record Whether to record the participant and their conferences * @return $this Fluent Builder */ public function setRecord(bool $record): self { $this->options['record'] = $record; return $this; } /** * Whether the agent is muted in the conference. Can be `true` or `false` and the default is `false`. * * @param bool $muted Whether to mute the agent * @return $this Fluent Builder */ public function setMuted(bool $muted): self { $this->options['muted'] = $muted; return $this; } /** * Whether to play a notification beep to the conference when the participant joins. Can be: `true`, `false`, `onEnter`, or `onExit`. The default value is `true`. * * @param string $beep Whether to play a notification beep to the conference * when the participant joins * @return $this Fluent Builder */ public function setBeep(string $beep): self { $this->options['beep'] = $beep; return $this; } /** * Whether to start the conference when the participant joins, if it has not already started. Can be: `true` or `false` and the default is `true`. If `false` and the conference has not started, the participant is muted and hears background music until another participant starts the conference. * * @param bool $startConferenceOnEnter Whether the conference starts when the * participant joins the conference * @return $this Fluent Builder */ public function setStartConferenceOnEnter(bool $startConferenceOnEnter): self { $this->options['startConferenceOnEnter'] = $startConferenceOnEnter; return $this; } /** * Whether to end the conference when the participant leaves. Can be: `true` or `false` and defaults to `false`. * * @param bool $endConferenceOnExit Whether to end the conference when the * participant leaves * @return $this Fluent Builder */ public function setEndConferenceOnExit(bool $endConferenceOnExit): self { $this->options['endConferenceOnExit'] = $endConferenceOnExit; return $this; } /** * The URL we should call using the `wait_method` for the music to play while participants are waiting for the conference to start. The default value is the URL of our standard hold music. [Learn more about hold music](https://www.twilio.com/labs/twimlets/holdmusic). * * @param string $waitUrl URL that hosts pre-conference hold music * @return $this Fluent Builder */ public function setWaitUrl(string $waitUrl): self { $this->options['waitUrl'] = $waitUrl; return $this; } /** * The HTTP method we should use to call `wait_url`. Can be `GET` or `POST` and the default is `POST`. When using a static audio file, this should be `GET` so that we can cache the file. * * @param string $waitMethod The HTTP method we should use to call `wait_url` * @return $this Fluent Builder */ public function setWaitMethod(string $waitMethod): self { $this->options['waitMethod'] = $waitMethod; return $this; } /** * Whether to allow an agent to hear the state of the outbound call, including ringing or disconnect messages. Can be: `true` or `false` and defaults to `true`. * * @param bool $earlyMedia Whether agents can hear the state of the outbound * call * @return $this Fluent Builder */ public function setEarlyMedia(bool $earlyMedia): self { $this->options['earlyMedia'] = $earlyMedia; return $this; } /** * The maximum number of participants in the conference. Can be a positive integer from `2` to `250`. The default value is `250`. * * @param int $maxParticipants The maximum number of agent conference * participants * @return $this Fluent Builder */ public function setMaxParticipants(int $maxParticipants): self { $this->options['maxParticipants'] = $maxParticipants; return $this; } /** * Whether to record the conference the participant is joining. Can be: `true`, `false`, `record-from-start`, and `do-not-record`. The default value is `false`. * * @param string $conferenceRecord Whether to record the conference the * participant is joining * @return $this Fluent Builder */ public function setConferenceRecord(string $conferenceRecord): self { $this->options['conferenceRecord'] = $conferenceRecord; return $this; } /** * Whether to trim leading and trailing silence from your recorded conference audio files. Can be: `trim-silence` or `do-not-trim` and defaults to `trim-silence`. * * @param string $conferenceTrim Whether to trim leading and trailing silence * from your recorded conference audio files * @return $this Fluent Builder */ public function setConferenceTrim(string $conferenceTrim): self { $this->options['conferenceTrim'] = $conferenceTrim; return $this; } /** * The URL we should call using the `conference_status_callback_method` when the conference events in `conference_status_callback_event` occur. Only the value set by the first participant to join the conference is used. Subsequent `conference_status_callback` values are ignored. * * @param string $conferenceStatusCallback The callback URL for conference * events * @return $this Fluent Builder */ public function setConferenceStatusCallback(string $conferenceStatusCallback): self { $this->options['conferenceStatusCallback'] = $conferenceStatusCallback; return $this; } /** * The HTTP method we should use to call `conference_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $conferenceStatusCallbackMethod HTTP method for requesting * `conference_status_callback` * URL * @return $this Fluent Builder */ public function setConferenceStatusCallbackMethod(string $conferenceStatusCallbackMethod): self { $this->options['conferenceStatusCallbackMethod'] = $conferenceStatusCallbackMethod; return $this; } /** * The conference state changes that should generate a call to `conference_status_callback`. Can be: `start`, `end`, `join`, `leave`, `mute`, `hold`, `modify`, `speaker`, and `announcement`. Separate multiple values with a space. Defaults to `start end`. * * @param string[] $conferenceStatusCallbackEvent The conference state changes * that should generate a call * to * `conference_status_callback` * @return $this Fluent Builder */ public function setConferenceStatusCallbackEvent(array $conferenceStatusCallbackEvent): self { $this->options['conferenceStatusCallbackEvent'] = $conferenceStatusCallbackEvent; return $this; } /** * The recording channels for the final recording. Can be: `mono` or `dual` and the default is `mono`. * * @param string $recordingChannels Specify `mono` or `dual` recording channels * @return $this Fluent Builder */ public function setRecordingChannels(string $recordingChannels): self { $this->options['recordingChannels'] = $recordingChannels; return $this; } /** * The URL that we should call using the `recording_status_callback_method` when the recording status changes. * * @param string $recordingStatusCallback The URL that we should call using the * `recording_status_callback_method` * when the recording status changes * @return $this Fluent Builder */ public function setRecordingStatusCallback(string $recordingStatusCallback): self { $this->options['recordingStatusCallback'] = $recordingStatusCallback; return $this; } /** * The HTTP method we should use when we call `recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $recordingStatusCallbackMethod The HTTP method we should use * when we call * `recording_status_callback` * @return $this Fluent Builder */ public function setRecordingStatusCallbackMethod(string $recordingStatusCallbackMethod): self { $this->options['recordingStatusCallbackMethod'] = $recordingStatusCallbackMethod; return $this; } /** * The SIP username used for authentication. * * @param string $sipAuthUsername The SIP username used for authentication * @return $this Fluent Builder */ public function setSipAuthUsername(string $sipAuthUsername): self { $this->options['sipAuthUsername'] = $sipAuthUsername; return $this; } /** * The SIP password for authentication. * * @param string $sipAuthPassword The SIP password for authentication * @return $this Fluent Builder */ public function setSipAuthPassword(string $sipAuthPassword): self { $this->options['sipAuthPassword'] = $sipAuthPassword; return $this; } /** * The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. * * @param string $region The region where we should mix the conference audio * @return $this Fluent Builder */ public function setRegion(string $region): self { $this->options['region'] = $region; return $this; } /** * The URL we should call using the `conference_recording_status_callback_method` when the conference recording is available. * * @param string $conferenceRecordingStatusCallback The URL we should call * using the * `conference_recording_status_callback_method` when the conference recording is available * @return $this Fluent Builder */ public function setConferenceRecordingStatusCallback(string $conferenceRecordingStatusCallback): self { $this->options['conferenceRecordingStatusCallback'] = $conferenceRecordingStatusCallback; return $this; } /** * The HTTP method we should use to call `conference_recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $conferenceRecordingStatusCallbackMethod The HTTP method we * should use to call * `conference_recording_status_callback` * @return $this Fluent Builder */ public function setConferenceRecordingStatusCallbackMethod(string $conferenceRecordingStatusCallbackMethod): self { $this->options['conferenceRecordingStatusCallbackMethod'] = $conferenceRecordingStatusCallbackMethod; return $this; } /** * The recording state changes that should generate a call to `recording_status_callback`. Can be: `started`, `in-progress`, `paused`, `resumed`, `stopped`, `completed`, `failed`, and `absent`. Separate multiple values with a space, ex: `'in-progress completed failed'`. * * @param string[] $recordingStatusCallbackEvent The recording state changes * that should generate a call to * `recording_status_callback` * @return $this Fluent Builder */ public function setRecordingStatusCallbackEvent(array $recordingStatusCallbackEvent): self { $this->options['recordingStatusCallbackEvent'] = $recordingStatusCallbackEvent; return $this; } /** * The conference recording state changes that generate a call to `conference_recording_status_callback`. Can be: `in-progress`, `completed`, `failed`, and `absent`. Separate multiple values with a space, ex: `'in-progress completed failed'` * * @param string[] $conferenceRecordingStatusCallbackEvent The conference * recording state * changes that should * generate a call to * `conference_recording_status_callback` * @return $this Fluent Builder */ public function setConferenceRecordingStatusCallbackEvent(array $conferenceRecordingStatusCallbackEvent): self { $this->options['conferenceRecordingStatusCallbackEvent'] = $conferenceRecordingStatusCallbackEvent; return $this; } /** * Whether the participant is coaching another call. Can be: `true` or `false`. If not present, defaults to `false` unless `call_sid_to_coach` is defined. If `true`, `call_sid_to_coach` must be defined. * * @param bool $coaching Indicates if the participant changed to coach * @return $this Fluent Builder */ public function setCoaching(bool $coaching): self { $this->options['coaching'] = $coaching; return $this; } /** * The SID of the participant who is being `coached`. The participant being coached is the only participant who can hear the participant who is `coaching`. * * @param string $callSidToCoach The SID of the participant who is being * `coached` * @return $this Fluent Builder */ public function setCallSidToCoach(string $callSidToCoach): self { $this->options['callSidToCoach'] = $callSidToCoach; return $this; } /** * Jitter buffer size for the connecting participant. Twilio will use this setting to apply Jitter Buffer before participant's audio is mixed into the conference. Can be: `off`, `small`, `medium`, and `large`. Default to `large`. * * @param string $jitterBufferSize Jitter Buffer size for the connecting * participant * @return $this Fluent Builder */ public function setJitterBufferSize(string $jitterBufferSize): self { $this->options['jitterBufferSize'] = $jitterBufferSize; return $this; } /** * The SID of a BYOC (Bring Your Own Carrier) trunk to route this call with. Note that `byoc` is only meaningful when `to` is a phone number; it will otherwise be ignored. (Beta) * * @param string $byoc BYOC trunk SID (Beta) * @return $this Fluent Builder */ public function setByoc(string $byoc): self { $this->options['byoc'] = $byoc; return $this; } /** * The phone number, Client identifier, or username portion of SIP address that made this call. Phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +16175551212). Client identifiers are formatted `client:name`. If using a phone number, it must be a Twilio number or a Verified [outgoing caller id](https://www.twilio.com/docs/voice/api/outgoing-caller-ids) for your account. If the `to` parameter is a phone number, `callerId` must also be a phone number. If `to` is sip address, this value of `callerId` should be a username portion to be used to populate the From header that is passed to the SIP endpoint. * * @param string $callerId The phone number, Client identifier, or username * portion of SIP address that made this call. * @return $this Fluent Builder */ public function setCallerId(string $callerId): self { $this->options['callerId'] = $callerId; return $this; } /** * The Reason for the outgoing call. Use it to specify the purpose of the call that is presented on the called party's phone. (Branded Calls Beta) * * @param string $callReason Reason for the call (Branded Calls Beta) * @return $this Fluent Builder */ public function setCallReason(string $callReason): self { $this->options['callReason'] = $callReason; return $this; } /** * The audio track to record for the call. Can be: `inbound`, `outbound` or `both`. The default is `both`. `inbound` records the audio that is received by Twilio. `outbound` records the audio that is sent from Twilio. `both` records the audio that is received and sent by Twilio. * * @param string $recordingTrack The track(s) to record * @return $this Fluent Builder */ public function setRecordingTrack(string $recordingTrack): self { $this->options['recordingTrack'] = $recordingTrack; return $this; } /** * The maximum duration of the call in seconds. Constraints depend on account and configuration. * * @param int $timeLimit The maximum duration of the call in seconds. * @return $this Fluent Builder */ public function setTimeLimit(int $timeLimit): self { $this->options['timeLimit'] = $timeLimit; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.CreateParticipantOptions ' . $options . ']'; } } class ReadParticipantOptions extends Options { /** * @param bool $muted Whether to return only participants that are muted * @param bool $hold Whether to return only participants that are on hold * @param bool $coaching Whether to return only participants who are coaching * another call */ public function __construct(bool $muted = Values::NONE, bool $hold = Values::NONE, bool $coaching = Values::NONE) { $this->options['muted'] = $muted; $this->options['hold'] = $hold; $this->options['coaching'] = $coaching; } /** * Whether to return only participants that are muted. Can be: `true` or `false`. * * @param bool $muted Whether to return only participants that are muted * @return $this Fluent Builder */ public function setMuted(bool $muted): self { $this->options['muted'] = $muted; return $this; } /** * Whether to return only participants that are on hold. Can be: `true` or `false`. * * @param bool $hold Whether to return only participants that are on hold * @return $this Fluent Builder */ public function setHold(bool $hold): self { $this->options['hold'] = $hold; return $this; } /** * Whether to return only participants who are coaching another call. Can be: `true` or `false`. * * @param bool $coaching Whether to return only participants who are coaching * another call * @return $this Fluent Builder */ public function setCoaching(bool $coaching): self { $this->options['coaching'] = $coaching; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadParticipantOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/Conference/RecordingInstance.php000064400000012766150515725670020546 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'apiVersion' => Values::array_get($payload, 'api_version'), 'callSid' => Values::array_get($payload, 'call_sid'), 'conferenceSid' => Values::array_get($payload, 'conference_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'startTime' => Deserialize::dateTime(Values::array_get($payload, 'start_time')), 'duration' => Values::array_get($payload, 'duration'), 'sid' => Values::array_get($payload, 'sid'), 'price' => Values::array_get($payload, 'price'), 'priceUnit' => Values::array_get($payload, 'price_unit'), 'status' => Values::array_get($payload, 'status'), 'channels' => Values::array_get($payload, 'channels'), 'source' => Values::array_get($payload, 'source'), 'errorCode' => Values::array_get($payload, 'error_code'), 'encryptionDetails' => Values::array_get($payload, 'encryption_details'), 'uri' => Values::array_get($payload, 'uri'), ]; $this->solution = [ 'accountSid' => $accountSid, 'conferenceSid' => $conferenceSid, '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 RecordingContext Context for this RecordingInstance */ protected function proxy(): RecordingContext { if (!$this->context) { $this->context = new RecordingContext( $this->version, $this->solution['accountSid'], $this->solution['conferenceSid'], $this->solution['sid'] ); } return $this->context; } /** * Update the RecordingInstance * * @param string $status The new status of the recording * @param array|Options $options Optional Arguments * @return RecordingInstance Updated RecordingInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $status, array $options = []): RecordingInstance { return $this->proxy()->update($status, $options); } /** * Fetch the RecordingInstance * * @return RecordingInstance Fetched RecordingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RecordingInstance { return $this->proxy()->fetch(); } /** * Delete the RecordingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.RecordingInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Conference/RecordingPage.php000064400000002446150515725670017650 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return RecordingInstance \Twilio\Rest\Api\V2010\Account\Conference\RecordingInstance */ public function buildInstance(array $payload): RecordingInstance { return new RecordingInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['conferenceSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.RecordingPage]'; } }src/Twilio/Rest/Api/V2010/Account/Conference/ParticipantInstance.php000064400000012270150515725670021076 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'callSid' => Values::array_get($payload, 'call_sid'), 'label' => Values::array_get($payload, 'label'), 'callSidToCoach' => Values::array_get($payload, 'call_sid_to_coach'), 'coaching' => Values::array_get($payload, 'coaching'), 'conferenceSid' => Values::array_get($payload, 'conference_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'endConferenceOnExit' => Values::array_get($payload, 'end_conference_on_exit'), 'muted' => Values::array_get($payload, 'muted'), 'hold' => Values::array_get($payload, 'hold'), 'startConferenceOnEnter' => Values::array_get($payload, 'start_conference_on_enter'), 'status' => Values::array_get($payload, 'status'), 'uri' => Values::array_get($payload, 'uri'), ]; $this->solution = [ 'accountSid' => $accountSid, 'conferenceSid' => $conferenceSid, 'callSid' => $callSid ?: $this->properties['callSid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return ParticipantContext Context for this ParticipantInstance */ protected function proxy(): ParticipantContext { if (!$this->context) { $this->context = new ParticipantContext( $this->version, $this->solution['accountSid'], $this->solution['conferenceSid'], $this->solution['callSid'] ); } return $this->context; } /** * Fetch the ParticipantInstance * * @return ParticipantInstance Fetched ParticipantInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ParticipantInstance { return $this->proxy()->fetch(); } /** * Update the ParticipantInstance * * @param array|Options $options Optional Arguments * @return ParticipantInstance Updated ParticipantInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ParticipantInstance { return $this->proxy()->update($options); } /** * Delete the ParticipantInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.ParticipantInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Recording/AddOnResultList.php000064400000012205150515725670020016 0ustar00solution = ['accountSid' => $accountSid, 'referenceSid' => $referenceSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Recordings/' . \rawurlencode($referenceSid) . '/AddOnResults.json'; } /** * Streams AddOnResultInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads AddOnResultInstance 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 AddOnResultInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of AddOnResultInstance 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 AddOnResultPage Page of AddOnResultInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): AddOnResultPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new AddOnResultPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of AddOnResultInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return AddOnResultPage Page of AddOnResultInstance */ public function getPage(string $targetUrl): AddOnResultPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new AddOnResultPage($this->version, $response, $this->solution); } /** * Constructs a AddOnResultContext * * @param string $sid The unique string that identifies the resource to fetch */ public function getContext(string $sid): AddOnResultContext { return new AddOnResultContext( $this->version, $this->solution['accountSid'], $this->solution['referenceSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.AddOnResultList]'; } }src/Twilio/Rest/Api/V2010/Account/Recording/TranscriptionList.php000064400000012227150515725670020475 0ustar00solution = ['accountSid' => $accountSid, 'recordingSid' => $recordingSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Recordings/' . \rawurlencode($recordingSid) . '/Transcriptions.json'; } /** * Streams TranscriptionInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads TranscriptionInstance 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 TranscriptionInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of TranscriptionInstance 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 TranscriptionPage Page of TranscriptionInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): TranscriptionPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new TranscriptionPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of TranscriptionInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return TranscriptionPage Page of TranscriptionInstance */ public function getPage(string $targetUrl): TranscriptionPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new TranscriptionPage($this->version, $response, $this->solution); } /** * Constructs a TranscriptionContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): TranscriptionContext { return new TranscriptionContext( $this->version, $this->solution['accountSid'], $this->solution['recordingSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.TranscriptionList]'; } }src/Twilio/Rest/Api/V2010/Account/Recording/AddOnResultContext.php000064400000010170150515725670020526 0ustar00solution = ['accountSid' => $accountSid, 'referenceSid' => $referenceSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Recordings/' . \rawurlencode($referenceSid) . '/AddOnResults/' . \rawurlencode($sid) . '.json'; } /** * Fetch the AddOnResultInstance * * @return AddOnResultInstance Fetched AddOnResultInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AddOnResultInstance { $payload = $this->version->fetch('GET', $this->uri); return new AddOnResultInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['referenceSid'], $this->solution['sid'] ); } /** * Delete the AddOnResultInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the payloads */ protected function getPayloads(): PayloadList { if (!$this->_payloads) { $this->_payloads = new PayloadList( $this->version, $this->solution['accountSid'], $this->solution['referenceSid'], $this->solution['sid'] ); } return $this->_payloads; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.AddOnResultContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Recording/AddOnResultPage.php000064400000002457150515725670017767 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return AddOnResultInstance \Twilio\Rest\Api\V2010\Account\Recording\AddOnResultInstance */ public function buildInstance(array $payload): AddOnResultInstance { return new AddOnResultInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['referenceSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.AddOnResultPage]'; } }src/Twilio/Rest/Api/V2010/Account/Recording/AddOnResultInstance.php000064400000011302150515725670020644 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'status' => Values::array_get($payload, 'status'), 'addOnSid' => Values::array_get($payload, 'add_on_sid'), 'addOnConfigurationSid' => Values::array_get($payload, 'add_on_configuration_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'dateCompleted' => Deserialize::dateTime(Values::array_get($payload, 'date_completed')), 'referenceSid' => Values::array_get($payload, 'reference_sid'), 'subresourceUris' => Values::array_get($payload, 'subresource_uris'), ]; $this->solution = [ 'accountSid' => $accountSid, 'referenceSid' => $referenceSid, '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 AddOnResultContext Context for this AddOnResultInstance */ protected function proxy(): AddOnResultContext { if (!$this->context) { $this->context = new AddOnResultContext( $this->version, $this->solution['accountSid'], $this->solution['referenceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the AddOnResultInstance * * @return AddOnResultInstance Fetched AddOnResultInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AddOnResultInstance { return $this->proxy()->fetch(); } /** * Delete the AddOnResultInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the payloads */ protected function getPayloads(): PayloadList { return $this->proxy()->payloads; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.AddOnResultInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Recording/TranscriptionInstance.php000064400000011220150515725670021316 0ustar00properties = [ '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')), 'duration' => Values::array_get($payload, 'duration'), 'price' => Values::array_get($payload, 'price'), 'priceUnit' => Values::array_get($payload, 'price_unit'), 'recordingSid' => Values::array_get($payload, 'recording_sid'), 'sid' => Values::array_get($payload, 'sid'), 'status' => Values::array_get($payload, 'status'), 'transcriptionText' => Values::array_get($payload, 'transcription_text'), 'type' => Values::array_get($payload, 'type'), 'uri' => Values::array_get($payload, 'uri'), ]; $this->solution = [ 'accountSid' => $accountSid, 'recordingSid' => $recordingSid, '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 TranscriptionContext Context for this TranscriptionInstance */ protected function proxy(): TranscriptionContext { if (!$this->context) { $this->context = new TranscriptionContext( $this->version, $this->solution['accountSid'], $this->solution['recordingSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the TranscriptionInstance * * @return TranscriptionInstance Fetched TranscriptionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TranscriptionInstance { return $this->proxy()->fetch(); } /** * Delete the TranscriptionInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.TranscriptionInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Recording/TranscriptionContext.php000064400000004600150515725670021202 0ustar00solution = ['accountSid' => $accountSid, 'recordingSid' => $recordingSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Recordings/' . \rawurlencode($recordingSid) . '/Transcriptions/' . \rawurlencode($sid) . '.json'; } /** * Fetch the TranscriptionInstance * * @return TranscriptionInstance Fetched TranscriptionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TranscriptionInstance { $payload = $this->version->fetch('GET', $this->uri); return new TranscriptionInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['recordingSid'], $this->solution['sid'] ); } /** * Delete the TranscriptionInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.TranscriptionContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Recording/AddOnResult/PayloadInstance.php000064400000011475150515725670022250 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'addOnResultSid' => Values::array_get($payload, 'add_on_result_sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'label' => Values::array_get($payload, 'label'), 'addOnSid' => Values::array_get($payload, 'add_on_sid'), 'addOnConfigurationSid' => Values::array_get($payload, 'add_on_configuration_sid'), 'contentType' => Values::array_get($payload, 'content_type'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'referenceSid' => Values::array_get($payload, 'reference_sid'), 'subresourceUris' => Values::array_get($payload, 'subresource_uris'), ]; $this->solution = [ 'accountSid' => $accountSid, 'referenceSid' => $referenceSid, 'addOnResultSid' => $addOnResultSid, '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 PayloadContext Context for this PayloadInstance */ protected function proxy(): PayloadContext { if (!$this->context) { $this->context = new PayloadContext( $this->version, $this->solution['accountSid'], $this->solution['referenceSid'], $this->solution['addOnResultSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the PayloadInstance * * @return PayloadInstance Fetched PayloadInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): PayloadInstance { return $this->proxy()->fetch(); } /** * Delete the PayloadInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.PayloadInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Recording/AddOnResult/PayloadContext.php000064400000005375150515725670022132 0ustar00solution = [ 'accountSid' => $accountSid, 'referenceSid' => $referenceSid, 'addOnResultSid' => $addOnResultSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Recordings/' . \rawurlencode($referenceSid) . '/AddOnResults/' . \rawurlencode($addOnResultSid) . '/Payloads/' . \rawurlencode($sid) . '.json'; } /** * Fetch the PayloadInstance * * @return PayloadInstance Fetched PayloadInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): PayloadInstance { $payload = $this->version->fetch('GET', $this->uri); return new PayloadInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['referenceSid'], $this->solution['addOnResultSid'], $this->solution['sid'] ); } /** * Delete the PayloadInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.PayloadContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Recording/AddOnResult/PayloadList.php000064400000012715150515725670021415 0ustar00solution = [ 'accountSid' => $accountSid, 'referenceSid' => $referenceSid, 'addOnResultSid' => $addOnResultSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Recordings/' . \rawurlencode($referenceSid) . '/AddOnResults/' . \rawurlencode($addOnResultSid) . '/Payloads.json'; } /** * Streams PayloadInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads PayloadInstance 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 PayloadInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of PayloadInstance 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 PayloadPage Page of PayloadInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): PayloadPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new PayloadPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of PayloadInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return PayloadPage Page of PayloadInstance */ public function getPage(string $targetUrl): PayloadPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new PayloadPage($this->version, $response, $this->solution); } /** * Constructs a PayloadContext * * @param string $sid The unique string that identifies the resource to fetch */ public function getContext(string $sid): PayloadContext { return new PayloadContext( $this->version, $this->solution['accountSid'], $this->solution['referenceSid'], $this->solution['addOnResultSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.PayloadList]'; } }src/Twilio/Rest/Api/V2010/Account/Recording/AddOnResult/PayloadPage.php000064400000002536150515725670021356 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return PayloadInstance \Twilio\Rest\Api\V2010\Account\Recording\AddOnResult\PayloadInstance */ public function buildInstance(array $payload): PayloadInstance { return new PayloadInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['referenceSid'], $this->solution['addOnResultSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.PayloadPage]'; } }src/Twilio/Rest/Api/V2010/Account/Recording/TranscriptionPage.php000064400000002473150515725670020440 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return TranscriptionInstance \Twilio\Rest\Api\V2010\Account\Recording\TranscriptionInstance */ public function buildInstance(array $payload): TranscriptionInstance { return new TranscriptionInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['recordingSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.TranscriptionPage]'; } }src/Twilio/Rest/Api/V2010/Account/Sip/DomainOptions.php000064400000053031150515725670016402 0ustar00options['friendlyName'] = $friendlyName; $this->options['voiceUrl'] = $voiceUrl; $this->options['voiceMethod'] = $voiceMethod; $this->options['voiceFallbackUrl'] = $voiceFallbackUrl; $this->options['voiceFallbackMethod'] = $voiceFallbackMethod; $this->options['voiceStatusCallbackUrl'] = $voiceStatusCallbackUrl; $this->options['voiceStatusCallbackMethod'] = $voiceStatusCallbackMethod; $this->options['sipRegistration'] = $sipRegistration; $this->options['emergencyCallingEnabled'] = $emergencyCallingEnabled; $this->options['secure'] = $secure; $this->options['byocTrunkSid'] = $byocTrunkSid; $this->options['emergencyCallerSid'] = $emergencyCallerSid; } /** * A descriptive string that you created to describe the resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The URL we should when the domain receives a call. * * @param string $voiceUrl The URL we should call when receiving a call * @return $this Fluent Builder */ public function setVoiceUrl(string $voiceUrl): self { $this->options['voiceUrl'] = $voiceUrl; return $this; } /** * The HTTP method we should use to call `voice_url`. Can be: `GET` or `POST`. * * @param string $voiceMethod The HTTP method to use with voice_url * @return $this Fluent Builder */ public function setVoiceMethod(string $voiceMethod): self { $this->options['voiceMethod'] = $voiceMethod; return $this; } /** * The URL that we should call when an error occurs while retrieving or executing the TwiML from `voice_url`. * * @param string $voiceFallbackUrl The URL we should call when an error occurs * in executing TwiML * @return $this Fluent Builder */ public function setVoiceFallbackUrl(string $voiceFallbackUrl): self { $this->options['voiceFallbackUrl'] = $voiceFallbackUrl; return $this; } /** * The HTTP method we should use to call `voice_fallback_url`. Can be: `GET` or `POST`. * * @param string $voiceFallbackMethod The HTTP method to use with * voice_fallback_url * @return $this Fluent Builder */ public function setVoiceFallbackMethod(string $voiceFallbackMethod): self { $this->options['voiceFallbackMethod'] = $voiceFallbackMethod; return $this; } /** * The URL that we should call to pass status parameters (such as call ended) to your application. * * @param string $voiceStatusCallbackUrl The URL that we should call to pass * status updates * @return $this Fluent Builder */ public function setVoiceStatusCallbackUrl(string $voiceStatusCallbackUrl): self { $this->options['voiceStatusCallbackUrl'] = $voiceStatusCallbackUrl; return $this; } /** * The HTTP method we should use to call `voice_status_callback_url`. Can be: `GET` or `POST`. * * @param string $voiceStatusCallbackMethod The HTTP method we should use to * call `voice_status_callback_url` * @return $this Fluent Builder */ public function setVoiceStatusCallbackMethod(string $voiceStatusCallbackMethod): self { $this->options['voiceStatusCallbackMethod'] = $voiceStatusCallbackMethod; return $this; } /** * Whether to allow SIP Endpoints to register with the domain to receive calls. Can be `true` or `false`. `true` allows SIP Endpoints to register with the domain to receive calls, `false` does not. * * @param bool $sipRegistration Whether SIP registration is allowed * @return $this Fluent Builder */ public function setSipRegistration(bool $sipRegistration): self { $this->options['sipRegistration'] = $sipRegistration; return $this; } /** * Whether emergency calling is enabled for the domain. If enabled, allows emergency calls on the domain from phone numbers with validated addresses. * * @param bool $emergencyCallingEnabled Whether emergency calling is enabled * for the domain. * @return $this Fluent Builder */ public function setEmergencyCallingEnabled(bool $emergencyCallingEnabled): self { $this->options['emergencyCallingEnabled'] = $emergencyCallingEnabled; return $this; } /** * Whether secure SIP is enabled for the domain. If enabled, TLS will be enforced and SRTP will be negotiated on all incoming calls to this sip domain. * * @param bool $secure Whether secure SIP is enabled for the domain * @return $this Fluent Builder */ public function setSecure(bool $secure): self { $this->options['secure'] = $secure; return $this; } /** * The SID of the BYOC Trunk(Bring Your Own Carrier) resource that the Sip Domain will be associated with. * * @param string $byocTrunkSid The SID of the BYOC Trunk resource. * @return $this Fluent Builder */ public function setByocTrunkSid(string $byocTrunkSid): self { $this->options['byocTrunkSid'] = $byocTrunkSid; return $this; } /** * Whether an emergency caller sid is configured for the domain. If present, this phone number will be used as the callback for the emergency call. * * @param string $emergencyCallerSid Whether an emergency caller sid is * configured for the domain. * @return $this Fluent Builder */ public function setEmergencyCallerSid(string $emergencyCallerSid): self { $this->options['emergencyCallerSid'] = $emergencyCallerSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.CreateDomainOptions ' . $options . ']'; } } class UpdateDomainOptions extends Options { /** * @param string $friendlyName A string to describe the resource * @param string $voiceFallbackMethod The HTTP method used with * voice_fallback_url * @param string $voiceFallbackUrl The URL we should call when an error occurs * in executing TwiML * @param string $voiceMethod The HTTP method we should use with voice_url * @param string $voiceStatusCallbackMethod The HTTP method we should use to * call voice_status_callback_url * @param string $voiceStatusCallbackUrl The URL that we should call to pass * status updates * @param string $voiceUrl The URL we should call when receiving a call * @param bool $sipRegistration Whether SIP registration is allowed * @param string $domainName The unique address on Twilio to route SIP traffic * @param bool $emergencyCallingEnabled Whether emergency calling is enabled * for the domain. * @param bool $secure Whether secure SIP is enabled for the domain * @param string $byocTrunkSid The SID of the BYOC Trunk resource. * @param string $emergencyCallerSid Whether an emergency caller sid is * configured for the domain. */ public function __construct(string $friendlyName = Values::NONE, string $voiceFallbackMethod = Values::NONE, string $voiceFallbackUrl = Values::NONE, string $voiceMethod = Values::NONE, string $voiceStatusCallbackMethod = Values::NONE, string $voiceStatusCallbackUrl = Values::NONE, string $voiceUrl = Values::NONE, bool $sipRegistration = Values::NONE, string $domainName = Values::NONE, bool $emergencyCallingEnabled = Values::NONE, bool $secure = Values::NONE, string $byocTrunkSid = Values::NONE, string $emergencyCallerSid = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['voiceFallbackMethod'] = $voiceFallbackMethod; $this->options['voiceFallbackUrl'] = $voiceFallbackUrl; $this->options['voiceMethod'] = $voiceMethod; $this->options['voiceStatusCallbackMethod'] = $voiceStatusCallbackMethod; $this->options['voiceStatusCallbackUrl'] = $voiceStatusCallbackUrl; $this->options['voiceUrl'] = $voiceUrl; $this->options['sipRegistration'] = $sipRegistration; $this->options['domainName'] = $domainName; $this->options['emergencyCallingEnabled'] = $emergencyCallingEnabled; $this->options['secure'] = $secure; $this->options['byocTrunkSid'] = $byocTrunkSid; $this->options['emergencyCallerSid'] = $emergencyCallerSid; } /** * A descriptive string that you created to describe the resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The HTTP method we should use to call `voice_fallback_url`. Can be: `GET` or `POST`. * * @param string $voiceFallbackMethod The HTTP method used with * voice_fallback_url * @return $this Fluent Builder */ public function setVoiceFallbackMethod(string $voiceFallbackMethod): self { $this->options['voiceFallbackMethod'] = $voiceFallbackMethod; return $this; } /** * The URL that we should call when an error occurs while retrieving or executing the TwiML requested by `voice_url`. * * @param string $voiceFallbackUrl The URL we should call when an error occurs * in executing TwiML * @return $this Fluent Builder */ public function setVoiceFallbackUrl(string $voiceFallbackUrl): self { $this->options['voiceFallbackUrl'] = $voiceFallbackUrl; return $this; } /** * The HTTP method we should use to call `voice_url` * * @param string $voiceMethod The HTTP method we should use with voice_url * @return $this Fluent Builder */ public function setVoiceMethod(string $voiceMethod): self { $this->options['voiceMethod'] = $voiceMethod; return $this; } /** * The HTTP method we should use to call `voice_status_callback_url`. Can be: `GET` or `POST`. * * @param string $voiceStatusCallbackMethod The HTTP method we should use to * call voice_status_callback_url * @return $this Fluent Builder */ public function setVoiceStatusCallbackMethod(string $voiceStatusCallbackMethod): self { $this->options['voiceStatusCallbackMethod'] = $voiceStatusCallbackMethod; return $this; } /** * The URL that we should call to pass status parameters (such as call ended) to your application. * * @param string $voiceStatusCallbackUrl The URL that we should call to pass * status updates * @return $this Fluent Builder */ public function setVoiceStatusCallbackUrl(string $voiceStatusCallbackUrl): self { $this->options['voiceStatusCallbackUrl'] = $voiceStatusCallbackUrl; return $this; } /** * The URL we should call when the domain receives a call. * * @param string $voiceUrl The URL we should call when receiving a call * @return $this Fluent Builder */ public function setVoiceUrl(string $voiceUrl): self { $this->options['voiceUrl'] = $voiceUrl; return $this; } /** * Whether to allow SIP Endpoints to register with the domain to receive calls. Can be `true` or `false`. `true` allows SIP Endpoints to register with the domain to receive calls, `false` does not. * * @param bool $sipRegistration Whether SIP registration is allowed * @return $this Fluent Builder */ public function setSipRegistration(bool $sipRegistration): self { $this->options['sipRegistration'] = $sipRegistration; return $this; } /** * The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and "-" and must end with `sip.twilio.com`. * * @param string $domainName The unique address on Twilio to route SIP traffic * @return $this Fluent Builder */ public function setDomainName(string $domainName): self { $this->options['domainName'] = $domainName; return $this; } /** * Whether emergency calling is enabled for the domain. If enabled, allows emergency calls on the domain from phone numbers with validated addresses. * * @param bool $emergencyCallingEnabled Whether emergency calling is enabled * for the domain. * @return $this Fluent Builder */ public function setEmergencyCallingEnabled(bool $emergencyCallingEnabled): self { $this->options['emergencyCallingEnabled'] = $emergencyCallingEnabled; return $this; } /** * Whether secure SIP is enabled for the domain. If enabled, TLS will be enforced and SRTP will be negotiated on all incoming calls to this sip domain. * * @param bool $secure Whether secure SIP is enabled for the domain * @return $this Fluent Builder */ public function setSecure(bool $secure): self { $this->options['secure'] = $secure; return $this; } /** * The SID of the BYOC Trunk(Bring Your Own Carrier) resource that the Sip Domain will be associated with. * * @param string $byocTrunkSid The SID of the BYOC Trunk resource. * @return $this Fluent Builder */ public function setByocTrunkSid(string $byocTrunkSid): self { $this->options['byocTrunkSid'] = $byocTrunkSid; return $this; } /** * Whether an emergency caller sid is configured for the domain. If present, this phone number will be used as the callback for the emergency call. * * @param string $emergencyCallerSid Whether an emergency caller sid is * configured for the domain. * @return $this Fluent Builder */ public function setEmergencyCallerSid(string $emergencyCallerSid): self { $this->options['emergencyCallerSid'] = $emergencyCallerSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.UpdateDomainOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/Sip/IpAccessControlListContext.php000064400000011060150515725670021047 0ustar00solution = ['accountSid' => $accountSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/SIP/IpAccessControlLists/' . \rawurlencode($sid) . '.json'; } /** * Fetch the IpAccessControlListInstance * * @return IpAccessControlListInstance Fetched IpAccessControlListInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): IpAccessControlListInstance { $payload = $this->version->fetch('GET', $this->uri); return new IpAccessControlListInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Update the IpAccessControlListInstance * * @param string $friendlyName A human readable description of this resource * @return IpAccessControlListInstance Updated IpAccessControlListInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $friendlyName): IpAccessControlListInstance { $data = Values::of(['FriendlyName' => $friendlyName, ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new IpAccessControlListInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Delete the IpAccessControlListInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the ipAddresses */ protected function getIpAddresses(): IpAddressList { if (!$this->_ipAddresses) { $this->_ipAddresses = new IpAddressList( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->_ipAddresses; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.IpAccessControlListContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Sip/DomainInstance.php000064400000015126150515725670016516 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'apiVersion' => Values::array_get($payload, 'api_version'), 'authType' => Values::array_get($payload, 'auth_type'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'domainName' => Values::array_get($payload, 'domain_name'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'sid' => Values::array_get($payload, 'sid'), 'uri' => Values::array_get($payload, 'uri'), 'voiceFallbackMethod' => Values::array_get($payload, 'voice_fallback_method'), 'voiceFallbackUrl' => Values::array_get($payload, 'voice_fallback_url'), 'voiceMethod' => Values::array_get($payload, 'voice_method'), 'voiceStatusCallbackMethod' => Values::array_get($payload, 'voice_status_callback_method'), 'voiceStatusCallbackUrl' => Values::array_get($payload, 'voice_status_callback_url'), 'voiceUrl' => Values::array_get($payload, 'voice_url'), 'subresourceUris' => Values::array_get($payload, 'subresource_uris'), 'sipRegistration' => Values::array_get($payload, 'sip_registration'), 'emergencyCallingEnabled' => Values::array_get($payload, 'emergency_calling_enabled'), 'secure' => Values::array_get($payload, 'secure'), 'byocTrunkSid' => Values::array_get($payload, 'byoc_trunk_sid'), 'emergencyCallerSid' => Values::array_get($payload, 'emergency_caller_sid'), ]; $this->solution = ['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 DomainContext Context for this DomainInstance */ protected function proxy(): DomainContext { if (!$this->context) { $this->context = new DomainContext( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the DomainInstance * * @return DomainInstance Fetched DomainInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): DomainInstance { return $this->proxy()->fetch(); } /** * Update the DomainInstance * * @param array|Options $options Optional Arguments * @return DomainInstance Updated DomainInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): DomainInstance { return $this->proxy()->update($options); } /** * Delete the DomainInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the ipAccessControlListMappings */ protected function getIpAccessControlListMappings(): IpAccessControlListMappingList { return $this->proxy()->ipAccessControlListMappings; } /** * Access the credentialListMappings */ protected function getCredentialListMappings(): CredentialListMappingList { return $this->proxy()->credentialListMappings; } /** * Access the auth */ protected function getAuth(): AuthTypesList { return $this->proxy()->auth; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.DomainInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Sip/DomainContext.php000064400000015261150515725670016376 0ustar00solution = ['accountSid' => $accountSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/SIP/Domains/' . \rawurlencode($sid) . '.json'; } /** * Fetch the DomainInstance * * @return DomainInstance Fetched DomainInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): DomainInstance { $payload = $this->version->fetch('GET', $this->uri); return new DomainInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Update the DomainInstance * * @param array|Options $options Optional Arguments * @return DomainInstance Updated DomainInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): DomainInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'VoiceFallbackMethod' => $options['voiceFallbackMethod'], 'VoiceFallbackUrl' => $options['voiceFallbackUrl'], 'VoiceMethod' => $options['voiceMethod'], 'VoiceStatusCallbackMethod' => $options['voiceStatusCallbackMethod'], 'VoiceStatusCallbackUrl' => $options['voiceStatusCallbackUrl'], 'VoiceUrl' => $options['voiceUrl'], 'SipRegistration' => Serialize::booleanToString($options['sipRegistration']), 'DomainName' => $options['domainName'], 'EmergencyCallingEnabled' => Serialize::booleanToString($options['emergencyCallingEnabled']), 'Secure' => Serialize::booleanToString($options['secure']), 'ByocTrunkSid' => $options['byocTrunkSid'], 'EmergencyCallerSid' => $options['emergencyCallerSid'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new DomainInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Delete the DomainInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the ipAccessControlListMappings */ protected function getIpAccessControlListMappings(): IpAccessControlListMappingList { if (!$this->_ipAccessControlListMappings) { $this->_ipAccessControlListMappings = new IpAccessControlListMappingList( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->_ipAccessControlListMappings; } /** * Access the credentialListMappings */ protected function getCredentialListMappings(): CredentialListMappingList { if (!$this->_credentialListMappings) { $this->_credentialListMappings = new CredentialListMappingList( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->_credentialListMappings; } /** * Access the auth */ protected function getAuth(): AuthTypesList { if (!$this->_auth) { $this->_auth = new AuthTypesList( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->_auth; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.DomainContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Sip/CredentialListList.php000064400000012772150515725670017370 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/SIP/CredentialLists.json'; } /** * Streams CredentialListInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads CredentialListInstance 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 CredentialListInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of CredentialListInstance 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 CredentialListPage Page of CredentialListInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): CredentialListPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new CredentialListPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of CredentialListInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return CredentialListPage Page of CredentialListInstance */ public function getPage(string $targetUrl): CredentialListPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new CredentialListPage($this->version, $response, $this->solution); } /** * Create the CredentialListInstance * * @param string $friendlyName Human readable descriptive text * @return CredentialListInstance Created CredentialListInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName): CredentialListInstance { $data = Values::of(['FriendlyName' => $friendlyName, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new CredentialListInstance($this->version, $payload, $this->solution['accountSid']); } /** * Constructs a CredentialListContext * * @param string $sid Fetch by unique credential list Sid */ public function getContext(string $sid): CredentialListContext { return new CredentialListContext($this->version, $this->solution['accountSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.CredentialListList]'; } }src/Twilio/Rest/Api/V2010/Account/Sip/IpAccessControlListInstance.php000064400000011211150515725670021165 0ustar00properties = [ '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')), 'subresourceUris' => Values::array_get($payload, 'subresource_uris'), 'uri' => Values::array_get($payload, 'uri'), ]; $this->solution = ['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 IpAccessControlListContext Context for this * IpAccessControlListInstance */ protected function proxy(): IpAccessControlListContext { if (!$this->context) { $this->context = new IpAccessControlListContext( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the IpAccessControlListInstance * * @return IpAccessControlListInstance Fetched IpAccessControlListInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): IpAccessControlListInstance { return $this->proxy()->fetch(); } /** * Update the IpAccessControlListInstance * * @param string $friendlyName A human readable description of this resource * @return IpAccessControlListInstance Updated IpAccessControlListInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $friendlyName): IpAccessControlListInstance { return $this->proxy()->update($friendlyName); } /** * Delete the IpAccessControlListInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the ipAddresses */ protected function getIpAddresses(): IpAddressList { return $this->proxy()->ipAddresses; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.IpAccessControlListInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Sip/DomainPage.php000064400000002252150515725670015622 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return DomainInstance \Twilio\Rest\Api\V2010\Account\Sip\DomainInstance */ public function buildInstance(array $payload): DomainInstance { return new DomainInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.DomainPage]'; } }src/Twilio/Rest/Api/V2010/Account/Sip/IpAccessControlListList.php000064400000013227150515725670020345 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/SIP/IpAccessControlLists.json'; } /** * Streams IpAccessControlListInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads IpAccessControlListInstance 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 IpAccessControlListInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of IpAccessControlListInstance 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 IpAccessControlListPage Page of IpAccessControlListInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): IpAccessControlListPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new IpAccessControlListPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of IpAccessControlListInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return IpAccessControlListPage Page of IpAccessControlListInstance */ public function getPage(string $targetUrl): IpAccessControlListPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new IpAccessControlListPage($this->version, $response, $this->solution); } /** * Create the IpAccessControlListInstance * * @param string $friendlyName A human readable description of this resource * @return IpAccessControlListInstance Created IpAccessControlListInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName): IpAccessControlListInstance { $data = Values::of(['FriendlyName' => $friendlyName, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new IpAccessControlListInstance($this->version, $payload, $this->solution['accountSid']); } /** * Constructs a IpAccessControlListContext * * @param string $sid A string that identifies the resource to fetch */ public function getContext(string $sid): IpAccessControlListContext { return new IpAccessControlListContext($this->version, $this->solution['accountSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.IpAccessControlListList]'; } }src/Twilio/Rest/Api/V2010/Account/Sip/DomainList.php000064400000014507150515725670015667 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/SIP/Domains.json'; } /** * Streams DomainInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads DomainInstance 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 DomainInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of DomainInstance 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 DomainPage Page of DomainInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): DomainPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new DomainPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of DomainInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return DomainPage Page of DomainInstance */ public function getPage(string $targetUrl): DomainPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new DomainPage($this->version, $response, $this->solution); } /** * Create the DomainInstance * * @param string $domainName The unique address on Twilio to route SIP traffic * @param array|Options $options Optional Arguments * @return DomainInstance Created DomainInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $domainName, array $options = []): DomainInstance { $options = new Values($options); $data = Values::of([ 'DomainName' => $domainName, 'FriendlyName' => $options['friendlyName'], 'VoiceUrl' => $options['voiceUrl'], 'VoiceMethod' => $options['voiceMethod'], 'VoiceFallbackUrl' => $options['voiceFallbackUrl'], 'VoiceFallbackMethod' => $options['voiceFallbackMethod'], 'VoiceStatusCallbackUrl' => $options['voiceStatusCallbackUrl'], 'VoiceStatusCallbackMethod' => $options['voiceStatusCallbackMethod'], 'SipRegistration' => Serialize::booleanToString($options['sipRegistration']), 'EmergencyCallingEnabled' => Serialize::booleanToString($options['emergencyCallingEnabled']), 'Secure' => Serialize::booleanToString($options['secure']), 'ByocTrunkSid' => $options['byocTrunkSid'], 'EmergencyCallerSid' => $options['emergencyCallerSid'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new DomainInstance($this->version, $payload, $this->solution['accountSid']); } /** * Constructs a DomainContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): DomainContext { return new DomainContext($this->version, $this->solution['accountSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.DomainList]'; } }src/Twilio/Rest/Api/V2010/Account/Sip/CredentialListInstance.php000064400000010763150515725670020217 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), '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'), 'sid' => Values::array_get($payload, 'sid'), 'subresourceUris' => Values::array_get($payload, 'subresource_uris'), 'uri' => Values::array_get($payload, 'uri'), ]; $this->solution = ['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 CredentialListContext Context for this CredentialListInstance */ protected function proxy(): CredentialListContext { if (!$this->context) { $this->context = new CredentialListContext( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the CredentialListInstance * * @return CredentialListInstance Fetched CredentialListInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CredentialListInstance { return $this->proxy()->fetch(); } /** * Update the CredentialListInstance * * @param string $friendlyName Human readable descriptive text * @return CredentialListInstance Updated CredentialListInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $friendlyName): CredentialListInstance { return $this->proxy()->update($friendlyName); } /** * Delete the CredentialListInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the credentials */ protected function getCredentials(): CredentialList { return $this->proxy()->credentials; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.CredentialListInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Sip/IpAccessControlListPage.php000064400000002370150515725670020303 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return IpAccessControlListInstance \Twilio\Rest\Api\V2010\Account\Sip\IpAccessControlListInstance */ public function buildInstance(array $payload): IpAccessControlListInstance { return new IpAccessControlListInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.IpAccessControlListPage]'; } }src/Twilio/Rest/Api/V2010/Account/Sip/IpAccessControlList/IpAddressInstance.php000064400000011540150515725670023050 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'ipAddress' => Values::array_get($payload, 'ip_address'), 'cidrPrefixLength' => Values::array_get($payload, 'cidr_prefix_length'), 'ipAccessControlListSid' => Values::array_get($payload, 'ip_access_control_list_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'uri' => Values::array_get($payload, 'uri'), ]; $this->solution = [ 'accountSid' => $accountSid, 'ipAccessControlListSid' => $ipAccessControlListSid, '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 IpAddressContext Context for this IpAddressInstance */ protected function proxy(): IpAddressContext { if (!$this->context) { $this->context = new IpAddressContext( $this->version, $this->solution['accountSid'], $this->solution['ipAccessControlListSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the IpAddressInstance * * @return IpAddressInstance Fetched IpAddressInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): IpAddressInstance { return $this->proxy()->fetch(); } /** * Update the IpAddressInstance * * @param array|Options $options Optional Arguments * @return IpAddressInstance Updated IpAddressInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): IpAddressInstance { return $this->proxy()->update($options); } /** * Delete the IpAddressInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.IpAddressInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Sip/IpAccessControlList/IpAddressContext.php000064400000006564150515725670022742 0ustar00solution = [ 'accountSid' => $accountSid, 'ipAccessControlListSid' => $ipAccessControlListSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/SIP/IpAccessControlLists/' . \rawurlencode($ipAccessControlListSid) . '/IpAddresses/' . \rawurlencode($sid) . '.json'; } /** * Fetch the IpAddressInstance * * @return IpAddressInstance Fetched IpAddressInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): IpAddressInstance { $payload = $this->version->fetch('GET', $this->uri); return new IpAddressInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['ipAccessControlListSid'], $this->solution['sid'] ); } /** * Update the IpAddressInstance * * @param array|Options $options Optional Arguments * @return IpAddressInstance Updated IpAddressInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): IpAddressInstance { $options = new Values($options); $data = Values::of([ 'IpAddress' => $options['ipAddress'], 'FriendlyName' => $options['friendlyName'], 'CidrPrefixLength' => $options['cidrPrefixLength'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new IpAddressInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['ipAccessControlListSid'], $this->solution['sid'] ); } /** * Delete the IpAddressInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.IpAddressContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Sip/IpAccessControlList/IpAddressPage.php000064400000002511150515725670022156 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return IpAddressInstance \Twilio\Rest\Api\V2010\Account\Sip\IpAccessControlList\IpAddressInstance */ public function buildInstance(array $payload): IpAddressInstance { return new IpAddressInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['ipAccessControlListSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.IpAddressPage]'; } }src/Twilio/Rest/Api/V2010/Account/Sip/IpAccessControlList/IpAddressList.php000064400000015237150515725670022226 0ustar00solution = [ 'accountSid' => $accountSid, 'ipAccessControlListSid' => $ipAccessControlListSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/SIP/IpAccessControlLists/' . \rawurlencode($ipAccessControlListSid) . '/IpAddresses.json'; } /** * Streams IpAddressInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads IpAddressInstance 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 IpAddressInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of IpAddressInstance 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 IpAddressPage Page of IpAddressInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): IpAddressPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new IpAddressPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of IpAddressInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return IpAddressPage Page of IpAddressInstance */ public function getPage(string $targetUrl): IpAddressPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new IpAddressPage($this->version, $response, $this->solution); } /** * Create the IpAddressInstance * * @param string $friendlyName A human readable descriptive text for this * resource, up to 64 characters long. * @param string $ipAddress An IP address in dotted decimal notation from which * you want to accept traffic. Any SIP requests from * this IP address will be allowed by Twilio. IPv4 * only supported today. * @param array|Options $options Optional Arguments * @return IpAddressInstance Created IpAddressInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, string $ipAddress, array $options = []): IpAddressInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $friendlyName, 'IpAddress' => $ipAddress, 'CidrPrefixLength' => $options['cidrPrefixLength'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new IpAddressInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['ipAccessControlListSid'] ); } /** * Constructs a IpAddressContext * * @param string $sid A string that identifies the IpAddress resource to fetch */ public function getContext(string $sid): IpAddressContext { return new IpAddressContext( $this->version, $this->solution['accountSid'], $this->solution['ipAccessControlListSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.IpAddressList]'; } }src/Twilio/Rest/Api/V2010/Account/Sip/IpAccessControlList/IpAddressOptions.php000064400000014676150515725670022754 0ustar00options['cidrPrefixLength'] = $cidrPrefixLength; } /** * An integer representing the length of the CIDR prefix to use with this IP address when accepting traffic. By default the entire IP address is used. * * @param int $cidrPrefixLength An integer representing the length of the CIDR * prefix to use with this IP address when * accepting traffic. By default the entire IP * address is used. * @return $this Fluent Builder */ public function setCidrPrefixLength(int $cidrPrefixLength): self { $this->options['cidrPrefixLength'] = $cidrPrefixLength; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.CreateIpAddressOptions ' . $options . ']'; } } class UpdateIpAddressOptions extends Options { /** * @param string $ipAddress An IP address in dotted decimal notation from which * you want to accept traffic. Any SIP requests from * this IP address will be allowed by Twilio. IPv4 * only supported today. * @param string $friendlyName A human readable descriptive text for this * resource, up to 64 characters long. * @param int $cidrPrefixLength An integer representing the length of the CIDR * prefix to use with this IP address when * accepting traffic. By default the entire IP * address is used. */ public function __construct(string $ipAddress = Values::NONE, string $friendlyName = Values::NONE, int $cidrPrefixLength = Values::NONE) { $this->options['ipAddress'] = $ipAddress; $this->options['friendlyName'] = $friendlyName; $this->options['cidrPrefixLength'] = $cidrPrefixLength; } /** * An IP address in dotted decimal notation from which you want to accept traffic. Any SIP requests from this IP address will be allowed by Twilio. IPv4 only supported today. * * @param string $ipAddress An IP address in dotted decimal notation from which * you want to accept traffic. Any SIP requests from * this IP address will be allowed by Twilio. IPv4 * only supported today. * @return $this Fluent Builder */ public function setIpAddress(string $ipAddress): self { $this->options['ipAddress'] = $ipAddress; return $this; } /** * A human readable descriptive text for this resource, up to 64 characters long. * * @param string $friendlyName A human readable descriptive text for this * resource, up to 64 characters long. * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * An integer representing the length of the CIDR prefix to use with this IP address when accepting traffic. By default the entire IP address is used. * * @param int $cidrPrefixLength An integer representing the length of the CIDR * prefix to use with this IP address when * accepting traffic. By default the entire IP * address is used. * @return $this Fluent Builder */ public function setCidrPrefixLength(int $cidrPrefixLength): self { $this->options['cidrPrefixLength'] = $cidrPrefixLength; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.UpdateIpAddressOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/Sip/CredentialListContext.php000064400000011000150515725670020060 0ustar00solution = ['accountSid' => $accountSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/SIP/CredentialLists/' . \rawurlencode($sid) . '.json'; } /** * Fetch the CredentialListInstance * * @return CredentialListInstance Fetched CredentialListInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CredentialListInstance { $payload = $this->version->fetch('GET', $this->uri); return new CredentialListInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Update the CredentialListInstance * * @param string $friendlyName Human readable descriptive text * @return CredentialListInstance Updated CredentialListInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $friendlyName): CredentialListInstance { $data = Values::of(['FriendlyName' => $friendlyName, ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new CredentialListInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Delete the CredentialListInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the credentials */ protected function getCredentials(): CredentialList { if (!$this->_credentials) { $this->_credentials = new CredentialList( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->_credentials; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.CredentialListContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Sip/Domain/AuthTypesPage.php000064400000002442150515725670017551 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return AuthTypesInstance \Twilio\Rest\Api\V2010\Account\Sip\Domain\AuthTypesInstance */ public function buildInstance(array $payload): AuthTypesInstance { return new AuthTypesInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['domainSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.AuthTypesPage]'; } }src/Twilio/Rest/Api/V2010/Account/Sip/Domain/CredentialListMappingInstance.php000064400000010365150515725670022740 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'domainSid' => Values::array_get($payload, 'domain_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'sid' => Values::array_get($payload, 'sid'), 'uri' => Values::array_get($payload, 'uri'), ]; $this->solution = [ 'accountSid' => $accountSid, 'domainSid' => $domainSid, '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 CredentialListMappingContext Context for this * CredentialListMappingInstance */ protected function proxy(): CredentialListMappingContext { if (!$this->context) { $this->context = new CredentialListMappingContext( $this->version, $this->solution['accountSid'], $this->solution['domainSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the CredentialListMappingInstance * * @return CredentialListMappingInstance Fetched CredentialListMappingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CredentialListMappingInstance { return $this->proxy()->fetch(); } /** * Delete the CredentialListMappingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.CredentialListMappingInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Sip/Domain/AuthTypesList.php000064400000006351150515725670017613 0ustar00solution = ['accountSid' => $accountSid, 'domainSid' => $domainSid, ]; } /** * Access the calls */ protected function getCalls(): AuthTypeCallsList { if (!$this->_calls) { $this->_calls = new AuthTypeCallsList( $this->version, $this->solution['accountSid'], $this->solution['domainSid'] ); } return $this->_calls; } /** * Access the registrations */ protected function getRegistrations(): AuthTypeRegistrationsList { if (!$this->_registrations) { $this->_registrations = new AuthTypeRegistrationsList( $this->version, $this->solution['accountSid'], $this->solution['domainSid'] ); } return $this->_registrations; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return \Twilio\ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Api.V2010.AuthTypesList]'; } }src/Twilio/Rest/Api/V2010/Account/Sip/Domain/CredentialListMappingPage.php000064400000002552150515725670022047 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CredentialListMappingInstance \Twilio\Rest\Api\V2010\Account\Sip\Domain\CredentialListMappingInstance */ public function buildInstance(array $payload): CredentialListMappingInstance { return new CredentialListMappingInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['domainSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.CredentialListMappingPage]'; } }src/Twilio/Rest/Api/V2010/Account/Sip/Domain/CredentialListMappingContext.php000064400000004630150515725670022616 0ustar00solution = ['accountSid' => $accountSid, 'domainSid' => $domainSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/SIP/Domains/' . \rawurlencode($domainSid) . '/CredentialListMappings/' . \rawurlencode($sid) . '.json'; } /** * Fetch the CredentialListMappingInstance * * @return CredentialListMappingInstance Fetched CredentialListMappingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CredentialListMappingInstance { $payload = $this->version->fetch('GET', $this->uri); return new CredentialListMappingInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['domainSid'], $this->solution['sid'] ); } /** * Delete the CredentialListMappingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.CredentialListMappingContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Sip/Domain/IpAccessControlListMappingInstance.php000064400000010631150515725670023715 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'domainSid' => Values::array_get($payload, 'domain_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'sid' => Values::array_get($payload, 'sid'), 'uri' => Values::array_get($payload, 'uri'), ]; $this->solution = [ 'accountSid' => $accountSid, 'domainSid' => $domainSid, '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 IpAccessControlListMappingContext Context for this * IpAccessControlListMappingInstance */ protected function proxy(): IpAccessControlListMappingContext { if (!$this->context) { $this->context = new IpAccessControlListMappingContext( $this->version, $this->solution['accountSid'], $this->solution['domainSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the IpAccessControlListMappingInstance * * @return IpAccessControlListMappingInstance Fetched * IpAccessControlListMappingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): IpAccessControlListMappingInstance { return $this->proxy()->fetch(); } /** * Delete the IpAccessControlListMappingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.IpAccessControlListMappingInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Sip/Domain/IpAccessControlListMappingPage.php000064400000002610150515725670023023 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return IpAccessControlListMappingInstance \Twilio\Rest\Api\V2010\Account\Sip\Domain\IpAccessControlListMappingInstance */ public function buildInstance(array $payload): IpAccessControlListMappingInstance { return new IpAccessControlListMappingInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['domainSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.IpAccessControlListMappingPage]'; } }src/Twilio/Rest/Api/V2010/Account/Sip/Domain/AuthTypes/AuthTypeRegistrationsList.php000064400000006136150515725670024135 0ustar00solution = ['accountSid' => $accountSid, 'domainSid' => $domainSid, ]; } /** * Access the credentialListMappings */ protected function getCredentialListMappings(): AuthRegistrationsCredentialListMappingList { if (!$this->_credentialListMappings) { $this->_credentialListMappings = new AuthRegistrationsCredentialListMappingList( $this->version, $this->solution['accountSid'], $this->solution['domainSid'] ); } return $this->_credentialListMappings; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return \Twilio\ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Api.V2010.AuthTypeRegistrationsList]'; } }src/Twilio/Rest/Api/V2010/Account/Sip/Domain/AuthTypes/AuthTypeRegistrationsInstance.php000064400000003344150515725670024764 0ustar00solution = ['accountSid' => $accountSid, 'domainSid' => $domainSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Api.V2010.AuthTypeRegistrationsInstance]'; } }src/Twilio/Rest/Api/V2010/Account/Sip/Domain/AuthTypes/AuthTypeCallsList.php000064400000007650150515725670022340 0ustar00solution = ['accountSid' => $accountSid, 'domainSid' => $domainSid, ]; } /** * Access the credentialListMappings */ protected function getCredentialListMappings(): AuthCallsCredentialListMappingList { if (!$this->_credentialListMappings) { $this->_credentialListMappings = new AuthCallsCredentialListMappingList( $this->version, $this->solution['accountSid'], $this->solution['domainSid'] ); } return $this->_credentialListMappings; } /** * Access the ipAccessControlListMappings */ protected function getIpAccessControlListMappings(): AuthCallsIpAccessControlListMappingList { if (!$this->_ipAccessControlListMappings) { $this->_ipAccessControlListMappings = new AuthCallsIpAccessControlListMappingList( $this->version, $this->solution['accountSid'], $this->solution['domainSid'] ); } return $this->_ipAccessControlListMappings; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return \Twilio\ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Api.V2010.AuthTypeCallsList]'; } }src/Twilio/Rest/Api/V2010/Account/Sip/Domain/AuthTypes/AuthTypeRegistrationsPage.php000064400000002576150515725670024102 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return AuthTypeRegistrationsInstance \Twilio\Rest\Api\V2010\Account\Sip\Domain\AuthTypes\AuthTypeRegistrationsInstance */ public function buildInstance(array $payload): AuthTypeRegistrationsInstance { return new AuthTypeRegistrationsInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['domainSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.AuthTypeRegistrationsPage]'; } }Account/Sip/Domain/AuthTypes/AuthTypeRegistrations/AuthRegistrationsCredentialListMappingList.php000064400000015331150515725670033675 0ustar00src/Twilio/Rest/Api/V2010solution = ['accountSid' => $accountSid, 'domainSid' => $domainSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/SIP/Domains/' . \rawurlencode($domainSid) . '/Auth/Registrations/CredentialListMappings.json'; } /** * Create the AuthRegistrationsCredentialListMappingInstance * * @param string $credentialListSid The SID of the CredentialList resource to * map to the SIP domain * @return AuthRegistrationsCredentialListMappingInstance Created * AuthRegistrationsCredentialListMappingInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $credentialListSid): AuthRegistrationsCredentialListMappingInstance { $data = Values::of(['CredentialListSid' => $credentialListSid, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new AuthRegistrationsCredentialListMappingInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['domainSid'] ); } /** * Streams AuthRegistrationsCredentialListMappingInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads AuthRegistrationsCredentialListMappingInstance 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 AuthRegistrationsCredentialListMappingInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of AuthRegistrationsCredentialListMappingInstance * 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 AuthRegistrationsCredentialListMappingPage Page of * AuthRegistrationsCredentialListMappingInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): AuthRegistrationsCredentialListMappingPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new AuthRegistrationsCredentialListMappingPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of AuthRegistrationsCredentialListMappingInstance * records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return AuthRegistrationsCredentialListMappingPage Page of * AuthRegistrationsCredentialListMappingInstance */ public function getPage(string $targetUrl): AuthRegistrationsCredentialListMappingPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new AuthRegistrationsCredentialListMappingPage($this->version, $response, $this->solution); } /** * Constructs a AuthRegistrationsCredentialListMappingContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): AuthRegistrationsCredentialListMappingContext { return new AuthRegistrationsCredentialListMappingContext( $this->version, $this->solution['accountSid'], $this->solution['domainSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.AuthRegistrationsCredentialListMappingList]'; } }Account/Sip/Domain/AuthTypes/AuthTypeRegistrations/AuthRegistrationsCredentialListMappingPage.php000064400000003020150515725670033626 0ustar00src/Twilio/Rest/Api/V2010solution = $solution; } /** * @param array $payload Payload response from the API * @return AuthRegistrationsCredentialListMappingInstance \Twilio\Rest\Api\V2010\Account\Sip\Domain\AuthTypes\AuthTypeRegistrations\AuthRegistrationsCredentialListMappingInstance */ public function buildInstance(array $payload): AuthRegistrationsCredentialListMappingInstance { return new AuthRegistrationsCredentialListMappingInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['domainSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.AuthRegistrationsCredentialListMappingPage]'; } }Account/Sip/Domain/AuthTypes/AuthTypeRegistrations/AuthRegistrationsCredentialListMappingContext.php000064400000005303150515725670034404 0ustar00src/Twilio/Rest/Api/V2010solution = ['accountSid' => $accountSid, 'domainSid' => $domainSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/SIP/Domains/' . \rawurlencode($domainSid) . '/Auth/Registrations/CredentialListMappings/' . \rawurlencode($sid) . '.json'; } /** * Fetch the AuthRegistrationsCredentialListMappingInstance * * @return AuthRegistrationsCredentialListMappingInstance Fetched * AuthRegistrationsCredentialListMappingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AuthRegistrationsCredentialListMappingInstance { $payload = $this->version->fetch('GET', $this->uri); return new AuthRegistrationsCredentialListMappingInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['domainSid'], $this->solution['sid'] ); } /** * Delete the AuthRegistrationsCredentialListMappingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.AuthRegistrationsCredentialListMappingContext ' . \implode(' ', $context) . ']'; } }Sip/Domain/AuthTypes/AuthTypeRegistrations/AuthRegistrationsCredentialListMappingInstance.php000064400000010432150515725670034523 0ustar00src/Twilio/Rest/Api/V2010/Accountproperties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), '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'), 'sid' => Values::array_get($payload, 'sid'), ]; $this->solution = [ 'accountSid' => $accountSid, 'domainSid' => $domainSid, '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 AuthRegistrationsCredentialListMappingContext Context for this * AuthRegistrationsCredentialListMappingInstance */ protected function proxy(): AuthRegistrationsCredentialListMappingContext { if (!$this->context) { $this->context = new AuthRegistrationsCredentialListMappingContext( $this->version, $this->solution['accountSid'], $this->solution['domainSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the AuthRegistrationsCredentialListMappingInstance * * @return AuthRegistrationsCredentialListMappingInstance Fetched * AuthRegistrationsCredentialListMappingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AuthRegistrationsCredentialListMappingInstance { return $this->proxy()->fetch(); } /** * Delete the AuthRegistrationsCredentialListMappingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.AuthRegistrationsCredentialListMappingInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Sip/Domain/AuthTypes/AuthTypeCallsPage.php000064400000002516150515725670022275 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return AuthTypeCallsInstance \Twilio\Rest\Api\V2010\Account\Sip\Domain\AuthTypes\AuthTypeCallsInstance */ public function buildInstance(array $payload): AuthTypeCallsInstance { return new AuthTypeCallsInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['domainSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.AuthTypeCallsPage]'; } }src/Twilio/Rest/Api/V2010/Account/Sip/Domain/AuthTypes/AuthTypeCallsInstance.php000064400000003314150515725670023162 0ustar00solution = ['accountSid' => $accountSid, 'domainSid' => $domainSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Api.V2010.AuthTypeCallsInstance]'; } }Rest/Api/V2010/Account/Sip/Domain/AuthTypes/AuthTypeCalls/AuthCallsCredentialListMappingList.php000064400000014752150515725670030305 0ustar00src/Twiliosolution = ['accountSid' => $accountSid, 'domainSid' => $domainSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/SIP/Domains/' . \rawurlencode($domainSid) . '/Auth/Calls/CredentialListMappings.json'; } /** * Create the AuthCallsCredentialListMappingInstance * * @param string $credentialListSid The SID of the CredentialList resource to * map to the SIP domain * @return AuthCallsCredentialListMappingInstance Created * AuthCallsCredentialListMappingInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $credentialListSid): AuthCallsCredentialListMappingInstance { $data = Values::of(['CredentialListSid' => $credentialListSid, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new AuthCallsCredentialListMappingInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['domainSid'] ); } /** * Streams AuthCallsCredentialListMappingInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads AuthCallsCredentialListMappingInstance 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 AuthCallsCredentialListMappingInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of AuthCallsCredentialListMappingInstance 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 AuthCallsCredentialListMappingPage Page of * AuthCallsCredentialListMappingInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): AuthCallsCredentialListMappingPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new AuthCallsCredentialListMappingPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of AuthCallsCredentialListMappingInstance records * from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return AuthCallsCredentialListMappingPage Page of * AuthCallsCredentialListMappingInstance */ public function getPage(string $targetUrl): AuthCallsCredentialListMappingPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new AuthCallsCredentialListMappingPage($this->version, $response, $this->solution); } /** * Constructs a AuthCallsCredentialListMappingContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): AuthCallsCredentialListMappingContext { return new AuthCallsCredentialListMappingContext( $this->version, $this->solution['accountSid'], $this->solution['domainSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.AuthCallsCredentialListMappingList]'; } }Api/V2010/Account/Sip/Domain/AuthTypes/AuthTypeCalls/AuthCallsIpAccessControlListMappingPage.php000064400000002756150515725670031230 0ustar00src/Twilio/Restsolution = $solution; } /** * @param array $payload Payload response from the API * @return AuthCallsIpAccessControlListMappingInstance \Twilio\Rest\Api\V2010\Account\Sip\Domain\AuthTypes\AuthTypeCalls\AuthCallsIpAccessControlListMappingInstance */ public function buildInstance(array $payload): AuthCallsIpAccessControlListMappingInstance { return new AuthCallsIpAccessControlListMappingInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['domainSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.AuthCallsIpAccessControlListMappingPage]'; } }Rest/Api/V2010/Account/Sip/Domain/AuthTypes/AuthTypeCalls/AuthCallsCredentialListMappingInstance.php000064400000010242150515725670031124 0ustar00src/Twilioproperties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), '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'), 'sid' => Values::array_get($payload, 'sid'), ]; $this->solution = [ 'accountSid' => $accountSid, 'domainSid' => $domainSid, '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 AuthCallsCredentialListMappingContext Context for this * AuthCallsCredentialListMappingInstance */ protected function proxy(): AuthCallsCredentialListMappingContext { if (!$this->context) { $this->context = new AuthCallsCredentialListMappingContext( $this->version, $this->solution['accountSid'], $this->solution['domainSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the AuthCallsCredentialListMappingInstance * * @return AuthCallsCredentialListMappingInstance Fetched * AuthCallsCredentialListMappingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AuthCallsCredentialListMappingInstance { return $this->proxy()->fetch(); } /** * Delete the AuthCallsCredentialListMappingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.AuthCallsCredentialListMappingInstance ' . \implode(' ', $context) . ']'; } }Api/V2010/Account/Sip/Domain/AuthTypes/AuthTypeCalls/AuthCallsIpAccessControlListMappingList.php000064400000015233150515725670031261 0ustar00src/Twilio/Restsolution = ['accountSid' => $accountSid, 'domainSid' => $domainSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/SIP/Domains/' . \rawurlencode($domainSid) . '/Auth/Calls/IpAccessControlListMappings.json'; } /** * Create the AuthCallsIpAccessControlListMappingInstance * * @param string $ipAccessControlListSid The SID of the IpAccessControlList * resource to map to the SIP domain * @return AuthCallsIpAccessControlListMappingInstance Created * AuthCallsIpAccessControlListMappingInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $ipAccessControlListSid): AuthCallsIpAccessControlListMappingInstance { $data = Values::of(['IpAccessControlListSid' => $ipAccessControlListSid, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new AuthCallsIpAccessControlListMappingInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['domainSid'] ); } /** * Streams AuthCallsIpAccessControlListMappingInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads AuthCallsIpAccessControlListMappingInstance 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 AuthCallsIpAccessControlListMappingInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of AuthCallsIpAccessControlListMappingInstance * 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 AuthCallsIpAccessControlListMappingPage Page of * AuthCallsIpAccessControlListMappingInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): AuthCallsIpAccessControlListMappingPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new AuthCallsIpAccessControlListMappingPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of AuthCallsIpAccessControlListMappingInstance * records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return AuthCallsIpAccessControlListMappingPage Page of * AuthCallsIpAccessControlListMappingInstance */ public function getPage(string $targetUrl): AuthCallsIpAccessControlListMappingPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new AuthCallsIpAccessControlListMappingPage($this->version, $response, $this->solution); } /** * Constructs a AuthCallsIpAccessControlListMappingContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): AuthCallsIpAccessControlListMappingContext { return new AuthCallsIpAccessControlListMappingContext( $this->version, $this->solution['accountSid'], $this->solution['domainSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.AuthCallsIpAccessControlListMappingList]'; } }Api/V2010/Account/Sip/Domain/AuthTypes/AuthTypeCalls/AuthCallsIpAccessControlListMappingContext.php000064400000005232150515725670031770 0ustar00src/Twilio/Restsolution = ['accountSid' => $accountSid, 'domainSid' => $domainSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/SIP/Domains/' . \rawurlencode($domainSid) . '/Auth/Calls/IpAccessControlListMappings/' . \rawurlencode($sid) . '.json'; } /** * Fetch the AuthCallsIpAccessControlListMappingInstance * * @return AuthCallsIpAccessControlListMappingInstance Fetched * AuthCallsIpAccessControlListMappingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AuthCallsIpAccessControlListMappingInstance { $payload = $this->version->fetch('GET', $this->uri); return new AuthCallsIpAccessControlListMappingInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['domainSid'], $this->solution['sid'] ); } /** * Delete the AuthCallsIpAccessControlListMappingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.AuthCallsIpAccessControlListMappingContext ' . \implode(' ', $context) . ']'; } }Api/V2010/Account/Sip/Domain/AuthTypes/AuthTypeCalls/AuthCallsIpAccessControlListMappingInstance.php000064400000010350150515725670032105 0ustar00src/Twilio/Restproperties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), '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'), 'sid' => Values::array_get($payload, 'sid'), ]; $this->solution = [ 'accountSid' => $accountSid, 'domainSid' => $domainSid, '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 AuthCallsIpAccessControlListMappingContext Context for this * AuthCallsIpAccessControlListMappingInstance */ protected function proxy(): AuthCallsIpAccessControlListMappingContext { if (!$this->context) { $this->context = new AuthCallsIpAccessControlListMappingContext( $this->version, $this->solution['accountSid'], $this->solution['domainSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the AuthCallsIpAccessControlListMappingInstance * * @return AuthCallsIpAccessControlListMappingInstance Fetched * AuthCallsIpAccessControlListMappingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AuthCallsIpAccessControlListMappingInstance { return $this->proxy()->fetch(); } /** * Delete the AuthCallsIpAccessControlListMappingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.AuthCallsIpAccessControlListMappingInstance ' . \implode(' ', $context) . ']'; } }Rest/Api/V2010/Account/Sip/Domain/AuthTypes/AuthTypeCalls/AuthCallsCredentialListMappingContext.php000064400000005143150515725670031010 0ustar00src/Twiliosolution = ['accountSid' => $accountSid, 'domainSid' => $domainSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/SIP/Domains/' . \rawurlencode($domainSid) . '/Auth/Calls/CredentialListMappings/' . \rawurlencode($sid) . '.json'; } /** * Fetch the AuthCallsCredentialListMappingInstance * * @return AuthCallsCredentialListMappingInstance Fetched * AuthCallsCredentialListMappingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AuthCallsCredentialListMappingInstance { $payload = $this->version->fetch('GET', $this->uri); return new AuthCallsCredentialListMappingInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['domainSid'], $this->solution['sid'] ); } /** * Delete the AuthCallsCredentialListMappingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.AuthCallsCredentialListMappingContext ' . \implode(' ', $context) . ']'; } }Rest/Api/V2010/Account/Sip/Domain/AuthTypes/AuthTypeCalls/AuthCallsCredentialListMappingPage.php000064400000002720150515725670030236 0ustar00src/Twiliosolution = $solution; } /** * @param array $payload Payload response from the API * @return AuthCallsCredentialListMappingInstance \Twilio\Rest\Api\V2010\Account\Sip\Domain\AuthTypes\AuthTypeCalls\AuthCallsCredentialListMappingInstance */ public function buildInstance(array $payload): AuthCallsCredentialListMappingInstance { return new AuthCallsCredentialListMappingInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['domainSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.AuthCallsCredentialListMappingPage]'; } }src/Twilio/Rest/Api/V2010/Account/Sip/Domain/CredentialListMappingList.php000064400000014273150515725670022111 0ustar00solution = ['accountSid' => $accountSid, 'domainSid' => $domainSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/SIP/Domains/' . \rawurlencode($domainSid) . '/CredentialListMappings.json'; } /** * Create the CredentialListMappingInstance * * @param string $credentialListSid A string that identifies the CredentialList * resource to map to the SIP domain * @return CredentialListMappingInstance Created CredentialListMappingInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $credentialListSid): CredentialListMappingInstance { $data = Values::of(['CredentialListSid' => $credentialListSid, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new CredentialListMappingInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['domainSid'] ); } /** * Streams CredentialListMappingInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads CredentialListMappingInstance 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 CredentialListMappingInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of CredentialListMappingInstance 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 CredentialListMappingPage Page of CredentialListMappingInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): CredentialListMappingPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new CredentialListMappingPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of CredentialListMappingInstance records from the * API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return CredentialListMappingPage Page of CredentialListMappingInstance */ public function getPage(string $targetUrl): CredentialListMappingPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new CredentialListMappingPage($this->version, $response, $this->solution); } /** * Constructs a CredentialListMappingContext * * @param string $sid A string that identifies the resource to fetch */ public function getContext(string $sid): CredentialListMappingContext { return new CredentialListMappingContext( $this->version, $this->solution['accountSid'], $this->solution['domainSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.CredentialListMappingList]'; } }src/Twilio/Rest/Api/V2010/Account/Sip/Domain/IpAccessControlListMappingContext.php000064400000005053150515725670023577 0ustar00solution = ['accountSid' => $accountSid, 'domainSid' => $domainSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/SIP/Domains/' . \rawurlencode($domainSid) . '/IpAccessControlListMappings/' . \rawurlencode($sid) . '.json'; } /** * Fetch the IpAccessControlListMappingInstance * * @return IpAccessControlListMappingInstance Fetched * IpAccessControlListMappingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): IpAccessControlListMappingInstance { $payload = $this->version->fetch('GET', $this->uri); return new IpAccessControlListMappingInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['domainSid'], $this->solution['sid'] ); } /** * Delete the IpAccessControlListMappingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.IpAccessControlListMappingContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Sip/Domain/IpAccessControlListMappingList.php000064400000015016150515725670023066 0ustar00solution = ['accountSid' => $accountSid, 'domainSid' => $domainSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/SIP/Domains/' . \rawurlencode($domainSid) . '/IpAccessControlListMappings.json'; } /** * Create the IpAccessControlListMappingInstance * * @param string $ipAccessControlListSid The unique id of the IP access control * list to map to the SIP domain * @return IpAccessControlListMappingInstance Created * IpAccessControlListMappingInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $ipAccessControlListSid): IpAccessControlListMappingInstance { $data = Values::of(['IpAccessControlListSid' => $ipAccessControlListSid, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new IpAccessControlListMappingInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['domainSid'] ); } /** * Streams IpAccessControlListMappingInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads IpAccessControlListMappingInstance 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 IpAccessControlListMappingInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of IpAccessControlListMappingInstance 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 IpAccessControlListMappingPage Page of * IpAccessControlListMappingInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): IpAccessControlListMappingPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new IpAccessControlListMappingPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of IpAccessControlListMappingInstance records from * the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return IpAccessControlListMappingPage Page of * IpAccessControlListMappingInstance */ public function getPage(string $targetUrl): IpAccessControlListMappingPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new IpAccessControlListMappingPage($this->version, $response, $this->solution); } /** * Constructs a IpAccessControlListMappingContext * * @param string $sid A 34 character string that uniquely identifies the * resource to fetch. */ public function getContext(string $sid): IpAccessControlListMappingContext { return new IpAccessControlListMappingContext( $this->version, $this->solution['accountSid'], $this->solution['domainSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.IpAccessControlListMappingList]'; } }src/Twilio/Rest/Api/V2010/Account/Sip/Domain/AuthTypesInstance.php000064400000003266150515725670020446 0ustar00solution = ['accountSid' => $accountSid, 'domainSid' => $domainSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Api.V2010.AuthTypesInstance]'; } }src/Twilio/Rest/Api/V2010/Account/Sip/CredentialList/CredentialList.php000064400000014063150515725670021435 0ustar00solution = ['accountSid' => $accountSid, 'credentialListSid' => $credentialListSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/SIP/CredentialLists/' . \rawurlencode($credentialListSid) . '/Credentials.json'; } /** * Streams CredentialInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads CredentialInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return CredentialInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of CredentialInstance records from the API. * Request is executed immediately * * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return CredentialPage Page of CredentialInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): CredentialPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new CredentialPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of CredentialInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return CredentialPage Page of CredentialInstance */ public function getPage(string $targetUrl): CredentialPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new CredentialPage($this->version, $response, $this->solution); } /** * Create the CredentialInstance * * @param string $username The username for this credential. * @param string $password The password will not be returned in the response. * @return CredentialInstance Created CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $username, string $password): CredentialInstance { $data = Values::of(['Username' => $username, 'Password' => $password, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new CredentialInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['credentialListSid'] ); } /** * Constructs a CredentialContext * * @param string $sid The unique id that identifies the resource to fetch. */ public function getContext(string $sid): CredentialContext { return new CredentialContext( $this->version, $this->solution['accountSid'], $this->solution['credentialListSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.CredentialList]'; } }src/Twilio/Rest/Api/V2010/Account/Sip/CredentialList/CredentialContext.php000064400000006373150515725670022153 0ustar00solution = [ 'accountSid' => $accountSid, 'credentialListSid' => $credentialListSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/SIP/CredentialLists/' . \rawurlencode($credentialListSid) . '/Credentials/' . \rawurlencode($sid) . '.json'; } /** * Fetch the CredentialInstance * * @return CredentialInstance Fetched CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CredentialInstance { $payload = $this->version->fetch('GET', $this->uri); return new CredentialInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['credentialListSid'], $this->solution['sid'] ); } /** * Update the CredentialInstance * * @param array|Options $options Optional Arguments * @return CredentialInstance Updated CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): CredentialInstance { $options = new Values($options); $data = Values::of(['Password' => $options['password'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new CredentialInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['credentialListSid'], $this->solution['sid'] ); } /** * Delete the CredentialInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.CredentialContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Sip/CredentialList/CredentialOptions.php000064400000003133150515725670022151 0ustar00options['password'] = $password; } /** * The password that the username will use when authenticating SIP requests. The password must be a minimum of 12 characters, contain at least 1 digit, and have mixed case. (eg `IWasAtSignal2018`) * * @param string $password The password will not be returned in the response * @return $this Fluent Builder */ public function setPassword(string $password): self { $this->options['password'] = $password; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.UpdateCredentialOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/Sip/CredentialList/CredentialPage.php000064400000002500150515725670021367 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CredentialInstance \Twilio\Rest\Api\V2010\Account\Sip\CredentialList\CredentialInstance */ public function buildInstance(array $payload): CredentialInstance { return new CredentialInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['credentialListSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.CredentialPage]'; } }src/Twilio/Rest/Api/V2010/Account/Sip/CredentialList/CredentialInstance.php000064400000011112150515725670022256 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'credentialListSid' => Values::array_get($payload, 'credential_list_sid'), 'username' => Values::array_get($payload, 'username'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'uri' => Values::array_get($payload, 'uri'), ]; $this->solution = [ 'accountSid' => $accountSid, 'credentialListSid' => $credentialListSid, '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 CredentialContext Context for this CredentialInstance */ protected function proxy(): CredentialContext { if (!$this->context) { $this->context = new CredentialContext( $this->version, $this->solution['accountSid'], $this->solution['credentialListSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the CredentialInstance * * @return CredentialInstance Fetched CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CredentialInstance { return $this->proxy()->fetch(); } /** * Update the CredentialInstance * * @param array|Options $options Optional Arguments * @return CredentialInstance Updated CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): CredentialInstance { return $this->proxy()->update($options); } /** * Delete the CredentialInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.CredentialInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Sip/CredentialListPage.php000064400000002332150515725670017320 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CredentialListInstance \Twilio\Rest\Api\V2010\Account\Sip\CredentialListInstance */ public function buildInstance(array $payload): CredentialListInstance { return new CredentialListInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.CredentialListPage]'; } }src/Twilio/Rest/Api/V2010/Account/TranscriptionContext.php000064400000004141150515725670017266 0ustar00solution = ['accountSid' => $accountSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Transcriptions/' . \rawurlencode($sid) . '.json'; } /** * Fetch the TranscriptionInstance * * @return TranscriptionInstance Fetched TranscriptionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TranscriptionInstance { $payload = $this->version->fetch('GET', $this->uri); return new TranscriptionInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Delete the TranscriptionInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.TranscriptionContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/ConnectAppContext.php000064400000006431150515725670016465 0ustar00solution = ['accountSid' => $accountSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/ConnectApps/' . \rawurlencode($sid) . '.json'; } /** * Fetch the ConnectAppInstance * * @return ConnectAppInstance Fetched ConnectAppInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ConnectAppInstance { $payload = $this->version->fetch('GET', $this->uri); return new ConnectAppInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Update the ConnectAppInstance * * @param array|Options $options Optional Arguments * @return ConnectAppInstance Updated ConnectAppInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ConnectAppInstance { $options = new Values($options); $data = Values::of([ 'AuthorizeRedirectUrl' => $options['authorizeRedirectUrl'], 'CompanyName' => $options['companyName'], 'DeauthorizeCallbackMethod' => $options['deauthorizeCallbackMethod'], 'DeauthorizeCallbackUrl' => $options['deauthorizeCallbackUrl'], 'Description' => $options['description'], 'FriendlyName' => $options['friendlyName'], 'HomepageUrl' => $options['homepageUrl'], 'Permissions' => Serialize::map($options['permissions'], function($e) { return $e; }), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ConnectAppInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Delete the ConnectAppInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.ConnectAppContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/RecordingInstance.php000064400000012542150515725670016467 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'apiVersion' => Values::array_get($payload, 'api_version'), 'callSid' => Values::array_get($payload, 'call_sid'), 'conferenceSid' => Values::array_get($payload, 'conference_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'startTime' => Deserialize::dateTime(Values::array_get($payload, 'start_time')), 'duration' => Values::array_get($payload, 'duration'), 'sid' => Values::array_get($payload, 'sid'), 'price' => Values::array_get($payload, 'price'), 'priceUnit' => Values::array_get($payload, 'price_unit'), 'status' => Values::array_get($payload, 'status'), 'channels' => Values::array_get($payload, 'channels'), 'source' => Values::array_get($payload, 'source'), 'errorCode' => Values::array_get($payload, 'error_code'), 'uri' => Values::array_get($payload, 'uri'), 'encryptionDetails' => Values::array_get($payload, 'encryption_details'), 'subresourceUris' => Values::array_get($payload, 'subresource_uris'), ]; $this->solution = ['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 RecordingContext Context for this RecordingInstance */ protected function proxy(): RecordingContext { if (!$this->context) { $this->context = new RecordingContext( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the RecordingInstance * * @return RecordingInstance Fetched RecordingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RecordingInstance { return $this->proxy()->fetch(); } /** * Delete the RecordingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the transcriptions */ protected function getTranscriptions(): TranscriptionList { return $this->proxy()->transcriptions; } /** * Access the addOnResults */ protected function getAddOnResults(): AddOnResultList { return $this->proxy()->addOnResults; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.RecordingInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/SipList.php000064400000007337150515725670014463 0ustar00solution = ['accountSid' => $accountSid, ]; } /** * Access the domains */ protected function getDomains(): DomainList { if (!$this->_domains) { $this->_domains = new DomainList($this->version, $this->solution['accountSid']); } return $this->_domains; } /** * Access the ipAccessControlLists */ protected function getIpAccessControlLists(): IpAccessControlListList { if (!$this->_ipAccessControlLists) { $this->_ipAccessControlLists = new IpAccessControlListList( $this->version, $this->solution['accountSid'] ); } return $this->_ipAccessControlLists; } /** * Access the credentialLists */ protected function getCredentialLists(): CredentialListList { if (!$this->_credentialLists) { $this->_credentialLists = new CredentialListList($this->version, $this->solution['accountSid']); } return $this->_credentialLists; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return \Twilio\ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Api.V2010.SipList]'; } }src/Twilio/Rest/Api/V2010/Account/AuthorizedConnectAppPage.php000064400000002366150515725670017757 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return AuthorizedConnectAppInstance \Twilio\Rest\Api\V2010\Account\AuthorizedConnectAppInstance */ public function buildInstance(array $payload): AuthorizedConnectAppInstance { return new AuthorizedConnectAppInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.AuthorizedConnectAppPage]'; } }src/Twilio/Rest/Api/V2010/Account/TokenList.php000064400000003057150515725670015003 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Tokens.json'; } /** * Create the TokenInstance * * @param array|Options $options Optional Arguments * @return TokenInstance Created TokenInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): TokenInstance { $options = new Values($options); $data = Values::of(['Ttl' => $options['ttl'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new TokenInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.TokenList]'; } }src/Twilio/Rest/Api/V2010/Account/RecordingPage.php000064400000002264150515725670015577 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return RecordingInstance \Twilio\Rest\Api\V2010\Account\RecordingInstance */ public function buildInstance(array $payload): RecordingInstance { return new RecordingInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.RecordingPage]'; } }src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumberContext.php000064400000014003150515725670020333 0ustar00solution = ['accountSid' => $accountSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/IncomingPhoneNumbers/' . \rawurlencode($sid) . '.json'; } /** * Update the IncomingPhoneNumberInstance * * @param array|Options $options Optional Arguments * @return IncomingPhoneNumberInstance Updated IncomingPhoneNumberInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): IncomingPhoneNumberInstance { $options = new Values($options); $data = Values::of([ 'AccountSid' => $options['accountSid'], 'ApiVersion' => $options['apiVersion'], 'FriendlyName' => $options['friendlyName'], 'SmsApplicationSid' => $options['smsApplicationSid'], 'SmsFallbackMethod' => $options['smsFallbackMethod'], 'SmsFallbackUrl' => $options['smsFallbackUrl'], 'SmsMethod' => $options['smsMethod'], 'SmsUrl' => $options['smsUrl'], 'StatusCallback' => $options['statusCallback'], 'StatusCallbackMethod' => $options['statusCallbackMethod'], 'VoiceApplicationSid' => $options['voiceApplicationSid'], 'VoiceCallerIdLookup' => Serialize::booleanToString($options['voiceCallerIdLookup']), 'VoiceFallbackMethod' => $options['voiceFallbackMethod'], 'VoiceFallbackUrl' => $options['voiceFallbackUrl'], 'VoiceMethod' => $options['voiceMethod'], 'VoiceUrl' => $options['voiceUrl'], 'EmergencyStatus' => $options['emergencyStatus'], 'EmergencyAddressSid' => $options['emergencyAddressSid'], 'TrunkSid' => $options['trunkSid'], 'VoiceReceiveMode' => $options['voiceReceiveMode'], 'IdentitySid' => $options['identitySid'], 'AddressSid' => $options['addressSid'], 'BundleSid' => $options['bundleSid'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new IncomingPhoneNumberInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Fetch the IncomingPhoneNumberInstance * * @return IncomingPhoneNumberInstance Fetched IncomingPhoneNumberInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): IncomingPhoneNumberInstance { $payload = $this->version->fetch('GET', $this->uri); return new IncomingPhoneNumberInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Delete the IncomingPhoneNumberInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the assignedAddOns */ protected function getAssignedAddOns(): AssignedAddOnList { if (!$this->_assignedAddOns) { $this->_assignedAddOns = new AssignedAddOnList( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->_assignedAddOns; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.IncomingPhoneNumberContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/ShortCodeList.php000064400000012325150515725670015613 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/SMS/ShortCodes.json'; } /** * Streams ShortCodeInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ShortCodeInstance 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 ShortCodeInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of ShortCodeInstance 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 ShortCodePage Page of ShortCodeInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ShortCodePage { $options = new Values($options); $params = Values::of([ 'FriendlyName' => $options['friendlyName'], 'ShortCode' => $options['shortCode'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ShortCodePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ShortCodeInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ShortCodePage Page of ShortCodeInstance */ public function getPage(string $targetUrl): ShortCodePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ShortCodePage($this->version, $response, $this->solution); } /** * Constructs a ShortCodeContext * * @param string $sid The unique string that identifies this resource */ public function getContext(string $sid): ShortCodeContext { return new ShortCodeContext($this->version, $this->solution['accountSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.ShortCodeList]'; } }src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/MobileInstance.php000064400000012620150515725670021665 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'addressSid' => Values::array_get($payload, 'address_sid'), 'addressRequirements' => Values::array_get($payload, 'address_requirements'), 'apiVersion' => Values::array_get($payload, 'api_version'), 'beta' => Values::array_get($payload, 'beta'), 'capabilities' => Values::array_get($payload, 'capabilities'), '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'), 'identitySid' => Values::array_get($payload, 'identity_sid'), 'phoneNumber' => Values::array_get($payload, 'phone_number'), 'origin' => Values::array_get($payload, 'origin'), 'sid' => Values::array_get($payload, 'sid'), 'smsApplicationSid' => Values::array_get($payload, 'sms_application_sid'), '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'), 'statusCallback' => Values::array_get($payload, 'status_callback'), 'statusCallbackMethod' => Values::array_get($payload, 'status_callback_method'), 'trunkSid' => Values::array_get($payload, 'trunk_sid'), 'uri' => Values::array_get($payload, 'uri'), 'voiceReceiveMode' => Values::array_get($payload, 'voice_receive_mode'), 'voiceApplicationSid' => Values::array_get($payload, 'voice_application_sid'), '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'), 'emergencyStatus' => Values::array_get($payload, 'emergency_status'), 'emergencyAddressSid' => Values::array_get($payload, 'emergency_address_sid'), 'emergencyAddressStatus' => Values::array_get($payload, 'emergency_address_status'), 'bundleSid' => Values::array_get($payload, 'bundle_sid'), 'status' => Values::array_get($payload, 'status'), ]; $this->solution = ['accountSid' => $accountSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Api.V2010.MobileInstance]'; } }src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/MobilePage.php000064400000002312150515725670020772 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return MobileInstance \Twilio\Rest\Api\V2010\Account\IncomingPhoneNumber\MobileInstance */ public function buildInstance(array $payload): MobileInstance { return new MobileInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.MobilePage]'; } }src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/TollFreeList.php000064400000016137150515725670021350 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/IncomingPhoneNumbers/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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $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(array $options = [], int $limit = null, $pageSize = null): array { 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 TollFreePage Page of TollFreeInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): TollFreePage { $options = new Values($options); $params = Values::of([ 'Beta' => Serialize::booleanToString($options['beta']), 'FriendlyName' => $options['friendlyName'], 'PhoneNumber' => $options['phoneNumber'], 'Origin' => $options['origin'], '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 TollFreePage Page of TollFreeInstance */ public function getPage(string $targetUrl): TollFreePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new TollFreePage($this->version, $response, $this->solution); } /** * Create the TollFreeInstance * * @param string $phoneNumber The phone number to purchase in E.164 format * @param array|Options $options Optional Arguments * @return TollFreeInstance Created TollFreeInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $phoneNumber, array $options = []): TollFreeInstance { $options = new Values($options); $data = Values::of([ 'PhoneNumber' => $phoneNumber, 'ApiVersion' => $options['apiVersion'], 'FriendlyName' => $options['friendlyName'], 'SmsApplicationSid' => $options['smsApplicationSid'], 'SmsFallbackMethod' => $options['smsFallbackMethod'], 'SmsFallbackUrl' => $options['smsFallbackUrl'], 'SmsMethod' => $options['smsMethod'], 'SmsUrl' => $options['smsUrl'], 'StatusCallback' => $options['statusCallback'], 'StatusCallbackMethod' => $options['statusCallbackMethod'], 'VoiceApplicationSid' => $options['voiceApplicationSid'], 'VoiceCallerIdLookup' => Serialize::booleanToString($options['voiceCallerIdLookup']), 'VoiceFallbackMethod' => $options['voiceFallbackMethod'], 'VoiceFallbackUrl' => $options['voiceFallbackUrl'], 'VoiceMethod' => $options['voiceMethod'], 'VoiceUrl' => $options['voiceUrl'], 'IdentitySid' => $options['identitySid'], 'AddressSid' => $options['addressSid'], 'EmergencyStatus' => $options['emergencyStatus'], 'EmergencyAddressSid' => $options['emergencyAddressSid'], 'TrunkSid' => $options['trunkSid'], 'VoiceReceiveMode' => $options['voiceReceiveMode'], 'BundleSid' => $options['bundleSid'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new TollFreeInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.TollFreeList]'; } }Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/AssignedAddOn/AssignedAddOnExtensionInstance.php000064400000010756150515725670027412 0ustar00srcproperties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'resourceSid' => Values::array_get($payload, 'resource_sid'), 'assignedAddOnSid' => Values::array_get($payload, 'assigned_add_on_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'productName' => Values::array_get($payload, 'product_name'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'uri' => Values::array_get($payload, 'uri'), 'enabled' => Values::array_get($payload, 'enabled'), ]; $this->solution = [ 'accountSid' => $accountSid, 'resourceSid' => $resourceSid, 'assignedAddOnSid' => $assignedAddOnSid, '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 AssignedAddOnExtensionContext Context for this * AssignedAddOnExtensionInstance */ protected function proxy(): AssignedAddOnExtensionContext { if (!$this->context) { $this->context = new AssignedAddOnExtensionContext( $this->version, $this->solution['accountSid'], $this->solution['resourceSid'], $this->solution['assignedAddOnSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the AssignedAddOnExtensionInstance * * @return AssignedAddOnExtensionInstance Fetched AssignedAddOnExtensionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AssignedAddOnExtensionInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.AssignedAddOnExtensionInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/AssignedAddOn/AssignedAddOnExtensionList.php000064400000013516150515725670026635 0ustar00solution = [ 'accountSid' => $accountSid, 'resourceSid' => $resourceSid, 'assignedAddOnSid' => $assignedAddOnSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/IncomingPhoneNumbers/' . \rawurlencode($resourceSid) . '/AssignedAddOns/' . \rawurlencode($assignedAddOnSid) . '/Extensions.json'; } /** * Streams AssignedAddOnExtensionInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads AssignedAddOnExtensionInstance 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 AssignedAddOnExtensionInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of AssignedAddOnExtensionInstance 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 AssignedAddOnExtensionPage Page of AssignedAddOnExtensionInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): AssignedAddOnExtensionPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new AssignedAddOnExtensionPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of AssignedAddOnExtensionInstance records from the * API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return AssignedAddOnExtensionPage Page of AssignedAddOnExtensionInstance */ public function getPage(string $targetUrl): AssignedAddOnExtensionPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new AssignedAddOnExtensionPage($this->version, $response, $this->solution); } /** * Constructs a AssignedAddOnExtensionContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): AssignedAddOnExtensionContext { return new AssignedAddOnExtensionContext( $this->version, $this->solution['accountSid'], $this->solution['resourceSid'], $this->solution['assignedAddOnSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.AssignedAddOnExtensionList]'; } }Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/AssignedAddOn/AssignedAddOnExtensionContext.php000064400000005231150515725670027262 0ustar00srcsolution = [ 'accountSid' => $accountSid, 'resourceSid' => $resourceSid, 'assignedAddOnSid' => $assignedAddOnSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/IncomingPhoneNumbers/' . \rawurlencode($resourceSid) . '/AssignedAddOns/' . \rawurlencode($assignedAddOnSid) . '/Extensions/' . \rawurlencode($sid) . '.json'; } /** * Fetch the AssignedAddOnExtensionInstance * * @return AssignedAddOnExtensionInstance Fetched AssignedAddOnExtensionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AssignedAddOnExtensionInstance { $payload = $this->version->fetch('GET', $this->uri); return new AssignedAddOnExtensionInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['resourceSid'], $this->solution['assignedAddOnSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.AssignedAddOnExtensionContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/AssignedAddOn/AssignedAddOnExtensionPage.php000064400000003102150515725670026564 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return AssignedAddOnExtensionInstance \Twilio\Rest\Api\V2010\Account\IncomingPhoneNumber\AssignedAddOn\AssignedAddOnExtensionInstance */ public function buildInstance(array $payload): AssignedAddOnExtensionInstance { return new AssignedAddOnExtensionInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['resourceSid'], $this->solution['assignedAddOnSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.AssignedAddOnExtensionPage]'; } }src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/AssignedAddOnPage.php000064400000002677150515725670022244 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return AssignedAddOnInstance \Twilio\Rest\Api\V2010\Account\IncomingPhoneNumber\AssignedAddOnInstance */ public function buildInstance(array $payload): AssignedAddOnInstance { return new AssignedAddOnInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['resourceSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.AssignedAddOnPage]'; } }src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/AssignedAddOnContext.php000064400000010547150515725670023007 0ustar00solution = ['accountSid' => $accountSid, 'resourceSid' => $resourceSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/IncomingPhoneNumbers/' . \rawurlencode($resourceSid) . '/AssignedAddOns/' . \rawurlencode($sid) . '.json'; } /** * Fetch the AssignedAddOnInstance * * @return AssignedAddOnInstance Fetched AssignedAddOnInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AssignedAddOnInstance { $payload = $this->version->fetch('GET', $this->uri); return new AssignedAddOnInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['resourceSid'], $this->solution['sid'] ); } /** * Delete the AssignedAddOnInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the extensions */ protected function getExtensions(): AssignedAddOnExtensionList { if (!$this->_extensions) { $this->_extensions = new AssignedAddOnExtensionList( $this->version, $this->solution['accountSid'], $this->solution['resourceSid'], $this->solution['sid'] ); } return $this->_extensions; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.AssignedAddOnContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/TollFreePage.php000064400000002326150515725670021304 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return TollFreeInstance \Twilio\Rest\Api\V2010\Account\IncomingPhoneNumber\TollFreeInstance */ public function buildInstance(array $payload): TollFreeInstance { return new TollFreeInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.TollFreePage]'; } }src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/TollFreeOptions.php000064400000055551150515725670022073 0ustar00options['beta'] = $beta; $this->options['friendlyName'] = $friendlyName; $this->options['phoneNumber'] = $phoneNumber; $this->options['origin'] = $origin; } /** * Whether to include phone numbers new to the Twilio platform. Can be: `true` or `false` and the default is `true`. * * @param bool $beta Whether to include new phone numbers * @return $this Fluent Builder */ public function setBeta(bool $beta): self { $this->options['beta'] = $beta; return $this; } /** * A string that identifies the resources to read. * * @param string $friendlyName A string that identifies the resources to read * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The phone numbers of the IncomingPhoneNumber resources to read. You can specify partial numbers and use '*' as a wildcard for any digit. * * @param string $phoneNumber The phone numbers of the resources to read * @return $this Fluent Builder */ public function setPhoneNumber(string $phoneNumber): self { $this->options['phoneNumber'] = $phoneNumber; return $this; } /** * Whether to include phone numbers based on their origin. Can be: `twilio` or `hosted`. By default, phone numbers of all origin are included. * * @param string $origin Include phone numbers based on their origin. By * default, phone numbers of all origin are included. * @return $this Fluent Builder */ public function setOrigin(string $origin): self { $this->options['origin'] = $origin; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadTollFreeOptions ' . $options . ']'; } } class CreateTollFreeOptions extends Options { /** * @param string $apiVersion The API version to use for incoming calls made to * the new phone number * @param string $friendlyName A string to describe the new phone number * @param string $smsApplicationSid The SID of the application to handle SMS * messages * @param string $smsFallbackMethod HTTP method used with sms_fallback_url * @param string $smsFallbackUrl The URL we call when an error occurs while * executing TwiML * @param string $smsMethod The HTTP method to use with sms_url * @param string $smsUrl The URL we should call when the new phone number * receives an incoming SMS message * @param string $statusCallback The URL to send status information to your * application * @param string $statusCallbackMethod The HTTP method we should use to call * status_callback * @param string $voiceApplicationSid The SID of the application to handle the * new phone number * @param bool $voiceCallerIdLookup Whether to lookup the caller's name * @param string $voiceFallbackMethod The HTTP method used with * voice_fallback_url * @param string $voiceFallbackUrl The URL we will call when an error occurs in * TwiML * @param string $voiceMethod The HTTP method used with the voice_url * @param string $voiceUrl The URL we should call when the phone number * receives a call * @param string $identitySid The SID of the Identity resource to associate * with the new phone number * @param string $addressSid The SID of the Address resource associated with * the phone number * @param string $emergencyStatus Displays if emergency calling is enabled for * this number. * @param string $emergencyAddressSid The emergency address configuration to * use for emergency calling * @param string $trunkSid SID of the trunk to handle calls to the new phone * number * @param string $voiceReceiveMode Incoming call type: fax or voice * @param string $bundleSid The SID of the Bundle resource associated with * number */ public function __construct(string $apiVersion = Values::NONE, string $friendlyName = Values::NONE, string $smsApplicationSid = Values::NONE, string $smsFallbackMethod = Values::NONE, string $smsFallbackUrl = Values::NONE, string $smsMethod = Values::NONE, string $smsUrl = Values::NONE, string $statusCallback = Values::NONE, string $statusCallbackMethod = Values::NONE, string $voiceApplicationSid = Values::NONE, bool $voiceCallerIdLookup = Values::NONE, string $voiceFallbackMethod = Values::NONE, string $voiceFallbackUrl = Values::NONE, string $voiceMethod = Values::NONE, string $voiceUrl = Values::NONE, string $identitySid = Values::NONE, string $addressSid = Values::NONE, string $emergencyStatus = Values::NONE, string $emergencyAddressSid = Values::NONE, string $trunkSid = Values::NONE, string $voiceReceiveMode = Values::NONE, string $bundleSid = Values::NONE) { $this->options['apiVersion'] = $apiVersion; $this->options['friendlyName'] = $friendlyName; $this->options['smsApplicationSid'] = $smsApplicationSid; $this->options['smsFallbackMethod'] = $smsFallbackMethod; $this->options['smsFallbackUrl'] = $smsFallbackUrl; $this->options['smsMethod'] = $smsMethod; $this->options['smsUrl'] = $smsUrl; $this->options['statusCallback'] = $statusCallback; $this->options['statusCallbackMethod'] = $statusCallbackMethod; $this->options['voiceApplicationSid'] = $voiceApplicationSid; $this->options['voiceCallerIdLookup'] = $voiceCallerIdLookup; $this->options['voiceFallbackMethod'] = $voiceFallbackMethod; $this->options['voiceFallbackUrl'] = $voiceFallbackUrl; $this->options['voiceMethod'] = $voiceMethod; $this->options['voiceUrl'] = $voiceUrl; $this->options['identitySid'] = $identitySid; $this->options['addressSid'] = $addressSid; $this->options['emergencyStatus'] = $emergencyStatus; $this->options['emergencyAddressSid'] = $emergencyAddressSid; $this->options['trunkSid'] = $trunkSid; $this->options['voiceReceiveMode'] = $voiceReceiveMode; $this->options['bundleSid'] = $bundleSid; } /** * The API version to use for incoming calls made to the new phone number. The default is `2010-04-01`. * * @param string $apiVersion The API version to use for incoming calls made to * the new phone number * @return $this Fluent Builder */ public function setApiVersion(string $apiVersion): self { $this->options['apiVersion'] = $apiVersion; return $this; } /** * A descriptive string that you created to describe the new phone number. It can be up to 64 characters long. By default, this is a formatted version of the phone number. * * @param string $friendlyName A string to describe the new phone number * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The SID of the application that should handle SMS messages sent to the new phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. * * @param string $smsApplicationSid The SID of the application to handle SMS * messages * @return $this Fluent Builder */ public function setSmsApplicationSid(string $smsApplicationSid): self { $this->options['smsApplicationSid'] = $smsApplicationSid; return $this; } /** * The HTTP method that we should use to call `sms_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $smsFallbackMethod HTTP method used with sms_fallback_url * @return $this Fluent Builder */ public function setSmsFallbackMethod(string $smsFallbackMethod): self { $this->options['smsFallbackMethod'] = $smsFallbackMethod; return $this; } /** * The URL that we should call when an error occurs while requesting or executing the TwiML defined by `sms_url`. * * @param string $smsFallbackUrl The URL we call when an error occurs while * executing TwiML * @return $this Fluent Builder */ public function setSmsFallbackUrl(string $smsFallbackUrl): self { $this->options['smsFallbackUrl'] = $smsFallbackUrl; return $this; } /** * The HTTP method that we should use to call `sms_url`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $smsMethod The HTTP method to use with sms_url * @return $this Fluent Builder */ public function setSmsMethod(string $smsMethod): self { $this->options['smsMethod'] = $smsMethod; return $this; } /** * The URL we should call when the new phone number receives an incoming SMS message. * * @param string $smsUrl The URL we should call when the new phone number * receives an incoming SMS message * @return $this Fluent Builder */ public function setSmsUrl(string $smsUrl): self { $this->options['smsUrl'] = $smsUrl; return $this; } /** * The URL we should call using the `status_callback_method` to send status information to your application. * * @param string $statusCallback The URL to send status information to your * application * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $statusCallbackMethod The HTTP method we should use to call * status_callback * @return $this Fluent Builder */ public function setStatusCallbackMethod(string $statusCallbackMethod): self { $this->options['statusCallbackMethod'] = $statusCallbackMethod; return $this; } /** * The SID of the application we should use to handle calls to the new phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. * * @param string $voiceApplicationSid The SID of the application to handle the * new phone number * @return $this Fluent Builder */ public function setVoiceApplicationSid(string $voiceApplicationSid): self { $this->options['voiceApplicationSid'] = $voiceApplicationSid; return $this; } /** * Whether to lookup the caller's name from the CNAM database and post it to your app. Can be: `true` or `false` and defaults to `false`. * * @param bool $voiceCallerIdLookup Whether to lookup the caller's name * @return $this Fluent Builder */ public function setVoiceCallerIdLookup(bool $voiceCallerIdLookup): self { $this->options['voiceCallerIdLookup'] = $voiceCallerIdLookup; return $this; } /** * The HTTP method that we should use to call `voice_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $voiceFallbackMethod The HTTP method used with * voice_fallback_url * @return $this Fluent Builder */ public function setVoiceFallbackMethod(string $voiceFallbackMethod): self { $this->options['voiceFallbackMethod'] = $voiceFallbackMethod; return $this; } /** * The URL that we should call when an error occurs retrieving or executing the TwiML requested by `url`. * * @param string $voiceFallbackUrl The URL we will call when an error occurs in * TwiML * @return $this Fluent Builder */ public function setVoiceFallbackUrl(string $voiceFallbackUrl): self { $this->options['voiceFallbackUrl'] = $voiceFallbackUrl; return $this; } /** * The HTTP method that we should use to call `voice_url`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $voiceMethod The HTTP method used with the voice_url * @return $this Fluent Builder */ public function setVoiceMethod(string $voiceMethod): self { $this->options['voiceMethod'] = $voiceMethod; return $this; } /** * The URL that we should call to answer a call to the new phone number. The `voice_url` will not be called if a `voice_application_sid` or a `trunk_sid` is set. * * @param string $voiceUrl The URL we should call when the phone number * receives a call * @return $this Fluent Builder */ public function setVoiceUrl(string $voiceUrl): self { $this->options['voiceUrl'] = $voiceUrl; return $this; } /** * The SID of the Identity resource that we should associate with the new phone number. Some regions require an Identity to meet local regulations. * * @param string $identitySid The SID of the Identity resource to associate * with the new phone number * @return $this Fluent Builder */ public function setIdentitySid(string $identitySid): self { $this->options['identitySid'] = $identitySid; return $this; } /** * The SID of the Address resource we should associate with the new phone number. Some regions require addresses to meet local regulations. * * @param string $addressSid The SID of the Address resource associated with * the phone number * @return $this Fluent Builder */ public function setAddressSid(string $addressSid): self { $this->options['addressSid'] = $addressSid; return $this; } /** * The parameter displays if emergency calling is enabled for this number. Active numbers may place emergency calls by dialing valid emergency numbers for the country. * * @param string $emergencyStatus Displays if emergency calling is enabled for * this number. * @return $this Fluent Builder */ public function setEmergencyStatus(string $emergencyStatus): self { $this->options['emergencyStatus'] = $emergencyStatus; return $this; } /** * The SID of the emergency address configuration to use for emergency calling from the new phone number. * * @param string $emergencyAddressSid The emergency address configuration to * use for emergency calling * @return $this Fluent Builder */ public function setEmergencyAddressSid(string $emergencyAddressSid): self { $this->options['emergencyAddressSid'] = $emergencyAddressSid; return $this; } /** * The SID of the Trunk we should use to handle calls to the new phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use only those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. * * @param string $trunkSid SID of the trunk to handle calls to the new phone * number * @return $this Fluent Builder */ public function setTrunkSid(string $trunkSid): self { $this->options['trunkSid'] = $trunkSid; return $this; } /** * The configuration parameter for the new phone number to receive incoming voice calls or faxes. Can be: `fax` or `voice` and defaults to `voice`. * * @param string $voiceReceiveMode Incoming call type: fax or voice * @return $this Fluent Builder */ public function setVoiceReceiveMode(string $voiceReceiveMode): self { $this->options['voiceReceiveMode'] = $voiceReceiveMode; return $this; } /** * The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. * * @param string $bundleSid The SID of the Bundle resource associated with * number * @return $this Fluent Builder */ public function setBundleSid(string $bundleSid): self { $this->options['bundleSid'] = $bundleSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.CreateTollFreeOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/AssignedAddOnInstance.php000064400000011621150515725670023121 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'resourceSid' => Values::array_get($payload, 'resource_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'description' => Values::array_get($payload, 'description'), 'configuration' => Values::array_get($payload, 'configuration'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'uri' => Values::array_get($payload, 'uri'), 'subresourceUris' => Values::array_get($payload, 'subresource_uris'), ]; $this->solution = [ 'accountSid' => $accountSid, 'resourceSid' => $resourceSid, '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 AssignedAddOnContext Context for this AssignedAddOnInstance */ protected function proxy(): AssignedAddOnContext { if (!$this->context) { $this->context = new AssignedAddOnContext( $this->version, $this->solution['accountSid'], $this->solution['resourceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the AssignedAddOnInstance * * @return AssignedAddOnInstance Fetched AssignedAddOnInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AssignedAddOnInstance { return $this->proxy()->fetch(); } /** * Delete the AssignedAddOnInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the extensions */ protected function getExtensions(): AssignedAddOnExtensionList { return $this->proxy()->extensions; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.AssignedAddOnInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/LocalList.php000064400000016035150515725670020663 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/IncomingPhoneNumbers/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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $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(array $options = [], int $limit = null, $pageSize = null): array { 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 LocalPage Page of LocalInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): LocalPage { $options = new Values($options); $params = Values::of([ 'Beta' => Serialize::booleanToString($options['beta']), 'FriendlyName' => $options['friendlyName'], 'PhoneNumber' => $options['phoneNumber'], 'Origin' => $options['origin'], '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 LocalPage Page of LocalInstance */ public function getPage(string $targetUrl): LocalPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new LocalPage($this->version, $response, $this->solution); } /** * Create the LocalInstance * * @param string $phoneNumber The phone number to purchase in E.164 format * @param array|Options $options Optional Arguments * @return LocalInstance Created LocalInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $phoneNumber, array $options = []): LocalInstance { $options = new Values($options); $data = Values::of([ 'PhoneNumber' => $phoneNumber, 'ApiVersion' => $options['apiVersion'], 'FriendlyName' => $options['friendlyName'], 'SmsApplicationSid' => $options['smsApplicationSid'], 'SmsFallbackMethod' => $options['smsFallbackMethod'], 'SmsFallbackUrl' => $options['smsFallbackUrl'], 'SmsMethod' => $options['smsMethod'], 'SmsUrl' => $options['smsUrl'], 'StatusCallback' => $options['statusCallback'], 'StatusCallbackMethod' => $options['statusCallbackMethod'], 'VoiceApplicationSid' => $options['voiceApplicationSid'], 'VoiceCallerIdLookup' => Serialize::booleanToString($options['voiceCallerIdLookup']), 'VoiceFallbackMethod' => $options['voiceFallbackMethod'], 'VoiceFallbackUrl' => $options['voiceFallbackUrl'], 'VoiceMethod' => $options['voiceMethod'], 'VoiceUrl' => $options['voiceUrl'], 'IdentitySid' => $options['identitySid'], 'AddressSid' => $options['addressSid'], 'EmergencyStatus' => $options['emergencyStatus'], 'EmergencyAddressSid' => $options['emergencyAddressSid'], 'TrunkSid' => $options['trunkSid'], 'VoiceReceiveMode' => $options['voiceReceiveMode'], 'BundleSid' => $options['bundleSid'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new LocalInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.LocalList]'; } }src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/LocalInstance.php000064400000012615150515725670021514 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'addressSid' => Values::array_get($payload, 'address_sid'), 'addressRequirements' => Values::array_get($payload, 'address_requirements'), 'apiVersion' => Values::array_get($payload, 'api_version'), 'beta' => Values::array_get($payload, 'beta'), 'capabilities' => Values::array_get($payload, 'capabilities'), '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'), 'identitySid' => Values::array_get($payload, 'identity_sid'), 'phoneNumber' => Values::array_get($payload, 'phone_number'), 'origin' => Values::array_get($payload, 'origin'), 'sid' => Values::array_get($payload, 'sid'), 'smsApplicationSid' => Values::array_get($payload, 'sms_application_sid'), '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'), 'statusCallback' => Values::array_get($payload, 'status_callback'), 'statusCallbackMethod' => Values::array_get($payload, 'status_callback_method'), 'trunkSid' => Values::array_get($payload, 'trunk_sid'), 'uri' => Values::array_get($payload, 'uri'), 'voiceReceiveMode' => Values::array_get($payload, 'voice_receive_mode'), 'voiceApplicationSid' => Values::array_get($payload, 'voice_application_sid'), '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'), 'emergencyStatus' => Values::array_get($payload, 'emergency_status'), 'emergencyAddressSid' => Values::array_get($payload, 'emergency_address_sid'), 'emergencyAddressStatus' => Values::array_get($payload, 'emergency_address_status'), 'bundleSid' => Values::array_get($payload, 'bundle_sid'), 'status' => Values::array_get($payload, 'status'), ]; $this->solution = ['accountSid' => $accountSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Api.V2010.LocalInstance]'; } }src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/MobileOptions.php000064400000055611150515725670021563 0ustar00options['beta'] = $beta; $this->options['friendlyName'] = $friendlyName; $this->options['phoneNumber'] = $phoneNumber; $this->options['origin'] = $origin; } /** * Whether to include phone numbers new to the Twilio platform. Can be: `true` or `false` and the default is `true`. * * @param bool $beta Whether to include new phone numbers * @return $this Fluent Builder */ public function setBeta(bool $beta): self { $this->options['beta'] = $beta; return $this; } /** * A string that identifies the resources to read. * * @param string $friendlyName A string that identifies the resources to read * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The phone numbers of the IncomingPhoneNumber resources to read. You can specify partial numbers and use '*' as a wildcard for any digit. * * @param string $phoneNumber The phone numbers of the resources to read * @return $this Fluent Builder */ public function setPhoneNumber(string $phoneNumber): self { $this->options['phoneNumber'] = $phoneNumber; return $this; } /** * Whether to include phone numbers based on their origin. Can be: `twilio` or `hosted`. By default, phone numbers of all origin are included. * * @param string $origin Include phone numbers based on their origin. By * default, phone numbers of all origin are included. * @return $this Fluent Builder */ public function setOrigin(string $origin): self { $this->options['origin'] = $origin; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadMobileOptions ' . $options . ']'; } } class CreateMobileOptions extends Options { /** * @param string $apiVersion The API version to use for incoming calls made to * the new phone number * @param string $friendlyName A string to describe the new phone number * @param string $smsApplicationSid The SID of the application to handle SMS * messages * @param string $smsFallbackMethod HTTP method used with sms_fallback_url * @param string $smsFallbackUrl The URL we call when an error occurs while * executing TwiML * @param string $smsMethod The HTTP method to use with sms url * @param string $smsUrl The URL we should call when the new phone number * receives an incoming SMS message * @param string $statusCallback The URL we should call to send status * information to your application * @param string $statusCallbackMethod The HTTP method we should use to call * status_callback * @param string $voiceApplicationSid The SID of the application to handle the * new phone number * @param bool $voiceCallerIdLookup Whether to lookup the caller's name * @param string $voiceFallbackMethod The HTTP method used with * voice_fallback_url * @param string $voiceFallbackUrl The URL we will call when an error occurs in * TwiML * @param string $voiceMethod The HTTP method used with the voice_url * @param string $voiceUrl The URL we should call when the phone number * receives a call * @param string $identitySid The SID of the Identity resource to associate * with the new phone number * @param string $addressSid The SID of the Address resource associated with * the phone number * @param string $emergencyStatus Displays if emergency calling is enabled for * this number. * @param string $emergencyAddressSid The emergency address configuration to * use for emergency calling * @param string $trunkSid SID of the trunk to handle calls to the new phone * number * @param string $voiceReceiveMode Incoming call type: fax or voice * @param string $bundleSid The SID of the Bundle resource associated with * number */ public function __construct(string $apiVersion = Values::NONE, string $friendlyName = Values::NONE, string $smsApplicationSid = Values::NONE, string $smsFallbackMethod = Values::NONE, string $smsFallbackUrl = Values::NONE, string $smsMethod = Values::NONE, string $smsUrl = Values::NONE, string $statusCallback = Values::NONE, string $statusCallbackMethod = Values::NONE, string $voiceApplicationSid = Values::NONE, bool $voiceCallerIdLookup = Values::NONE, string $voiceFallbackMethod = Values::NONE, string $voiceFallbackUrl = Values::NONE, string $voiceMethod = Values::NONE, string $voiceUrl = Values::NONE, string $identitySid = Values::NONE, string $addressSid = Values::NONE, string $emergencyStatus = Values::NONE, string $emergencyAddressSid = Values::NONE, string $trunkSid = Values::NONE, string $voiceReceiveMode = Values::NONE, string $bundleSid = Values::NONE) { $this->options['apiVersion'] = $apiVersion; $this->options['friendlyName'] = $friendlyName; $this->options['smsApplicationSid'] = $smsApplicationSid; $this->options['smsFallbackMethod'] = $smsFallbackMethod; $this->options['smsFallbackUrl'] = $smsFallbackUrl; $this->options['smsMethod'] = $smsMethod; $this->options['smsUrl'] = $smsUrl; $this->options['statusCallback'] = $statusCallback; $this->options['statusCallbackMethod'] = $statusCallbackMethod; $this->options['voiceApplicationSid'] = $voiceApplicationSid; $this->options['voiceCallerIdLookup'] = $voiceCallerIdLookup; $this->options['voiceFallbackMethod'] = $voiceFallbackMethod; $this->options['voiceFallbackUrl'] = $voiceFallbackUrl; $this->options['voiceMethod'] = $voiceMethod; $this->options['voiceUrl'] = $voiceUrl; $this->options['identitySid'] = $identitySid; $this->options['addressSid'] = $addressSid; $this->options['emergencyStatus'] = $emergencyStatus; $this->options['emergencyAddressSid'] = $emergencyAddressSid; $this->options['trunkSid'] = $trunkSid; $this->options['voiceReceiveMode'] = $voiceReceiveMode; $this->options['bundleSid'] = $bundleSid; } /** * The API version to use for incoming calls made to the new phone number. The default is `2010-04-01`. * * @param string $apiVersion The API version to use for incoming calls made to * the new phone number * @return $this Fluent Builder */ public function setApiVersion(string $apiVersion): self { $this->options['apiVersion'] = $apiVersion; return $this; } /** * A descriptive string that you created to describe the new phone number. It can be up to 64 characters long. By default, the is a formatted version of the phone number. * * @param string $friendlyName A string to describe the new phone number * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The SID of the application that should handle SMS messages sent to the new phone number. If an `sms_application_sid` is present, we ignore all of the `sms_*_url` urls and use those of the application. * * @param string $smsApplicationSid The SID of the application to handle SMS * messages * @return $this Fluent Builder */ public function setSmsApplicationSid(string $smsApplicationSid): self { $this->options['smsApplicationSid'] = $smsApplicationSid; return $this; } /** * The HTTP method that we should use to call `sms_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $smsFallbackMethod HTTP method used with sms_fallback_url * @return $this Fluent Builder */ public function setSmsFallbackMethod(string $smsFallbackMethod): self { $this->options['smsFallbackMethod'] = $smsFallbackMethod; return $this; } /** * The URL that we should call when an error occurs while requesting or executing the TwiML defined by `sms_url`. * * @param string $smsFallbackUrl The URL we call when an error occurs while * executing TwiML * @return $this Fluent Builder */ public function setSmsFallbackUrl(string $smsFallbackUrl): self { $this->options['smsFallbackUrl'] = $smsFallbackUrl; return $this; } /** * The HTTP method that we should use to call `sms_url`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $smsMethod The HTTP method to use with sms url * @return $this Fluent Builder */ public function setSmsMethod(string $smsMethod): self { $this->options['smsMethod'] = $smsMethod; return $this; } /** * The URL we should call when the new phone number receives an incoming SMS message. * * @param string $smsUrl The URL we should call when the new phone number * receives an incoming SMS message * @return $this Fluent Builder */ public function setSmsUrl(string $smsUrl): self { $this->options['smsUrl'] = $smsUrl; return $this; } /** * The URL we should call using the `status_callback_method` to send status information to your application. * * @param string $statusCallback The URL we should call to send status * information to your application * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $statusCallbackMethod The HTTP method we should use to call * status_callback * @return $this Fluent Builder */ public function setStatusCallbackMethod(string $statusCallbackMethod): self { $this->options['statusCallbackMethod'] = $statusCallbackMethod; return $this; } /** * The SID of the application we should use to handle calls to the new phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use only those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. * * @param string $voiceApplicationSid The SID of the application to handle the * new phone number * @return $this Fluent Builder */ public function setVoiceApplicationSid(string $voiceApplicationSid): self { $this->options['voiceApplicationSid'] = $voiceApplicationSid; return $this; } /** * Whether to lookup the caller's name from the CNAM database and post it to your app. Can be: `true` or `false` and defaults to `false`. * * @param bool $voiceCallerIdLookup Whether to lookup the caller's name * @return $this Fluent Builder */ public function setVoiceCallerIdLookup(bool $voiceCallerIdLookup): self { $this->options['voiceCallerIdLookup'] = $voiceCallerIdLookup; return $this; } /** * The HTTP method that we should use to call `voice_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $voiceFallbackMethod The HTTP method used with * voice_fallback_url * @return $this Fluent Builder */ public function setVoiceFallbackMethod(string $voiceFallbackMethod): self { $this->options['voiceFallbackMethod'] = $voiceFallbackMethod; return $this; } /** * The URL that we should call when an error occurs retrieving or executing the TwiML requested by `url`. * * @param string $voiceFallbackUrl The URL we will call when an error occurs in * TwiML * @return $this Fluent Builder */ public function setVoiceFallbackUrl(string $voiceFallbackUrl): self { $this->options['voiceFallbackUrl'] = $voiceFallbackUrl; return $this; } /** * The HTTP method that we should use to call `voice_url`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $voiceMethod The HTTP method used with the voice_url * @return $this Fluent Builder */ public function setVoiceMethod(string $voiceMethod): self { $this->options['voiceMethod'] = $voiceMethod; return $this; } /** * The URL that we should call to answer a call to the new phone number. The `voice_url` will not be called if a `voice_application_sid` or a `trunk_sid` is set. * * @param string $voiceUrl The URL we should call when the phone number * receives a call * @return $this Fluent Builder */ public function setVoiceUrl(string $voiceUrl): self { $this->options['voiceUrl'] = $voiceUrl; return $this; } /** * The SID of the Identity resource that we should associate with the new phone number. Some regions require an identity to meet local regulations. * * @param string $identitySid The SID of the Identity resource to associate * with the new phone number * @return $this Fluent Builder */ public function setIdentitySid(string $identitySid): self { $this->options['identitySid'] = $identitySid; return $this; } /** * The SID of the Address resource we should associate with the new phone number. Some regions require addresses to meet local regulations. * * @param string $addressSid The SID of the Address resource associated with * the phone number * @return $this Fluent Builder */ public function setAddressSid(string $addressSid): self { $this->options['addressSid'] = $addressSid; return $this; } /** * The parameter displays if emergency calling is enabled for this number. Active numbers may place emergency calls by dialing valid emergency numbers for the country. * * @param string $emergencyStatus Displays if emergency calling is enabled for * this number. * @return $this Fluent Builder */ public function setEmergencyStatus(string $emergencyStatus): self { $this->options['emergencyStatus'] = $emergencyStatus; return $this; } /** * The SID of the emergency address configuration to use for emergency calling from the new phone number. * * @param string $emergencyAddressSid The emergency address configuration to * use for emergency calling * @return $this Fluent Builder */ public function setEmergencyAddressSid(string $emergencyAddressSid): self { $this->options['emergencyAddressSid'] = $emergencyAddressSid; return $this; } /** * The SID of the Trunk we should use to handle calls to the new phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use only those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. * * @param string $trunkSid SID of the trunk to handle calls to the new phone * number * @return $this Fluent Builder */ public function setTrunkSid(string $trunkSid): self { $this->options['trunkSid'] = $trunkSid; return $this; } /** * The configuration parameter for the new phone number to receive incoming voice calls or faxes. Can be: `fax` or `voice` and defaults to `voice`. * * @param string $voiceReceiveMode Incoming call type: fax or voice * @return $this Fluent Builder */ public function setVoiceReceiveMode(string $voiceReceiveMode): self { $this->options['voiceReceiveMode'] = $voiceReceiveMode; return $this; } /** * The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. * * @param string $bundleSid The SID of the Bundle resource associated with * number * @return $this Fluent Builder */ public function setBundleSid(string $bundleSid): self { $this->options['bundleSid'] = $bundleSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.CreateMobileOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/MobileList.php000064400000016063150515725670021041 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/IncomingPhoneNumbers/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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $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(array $options = [], int $limit = null, $pageSize = null): array { 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 MobilePage Page of MobileInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): MobilePage { $options = new Values($options); $params = Values::of([ 'Beta' => Serialize::booleanToString($options['beta']), 'FriendlyName' => $options['friendlyName'], 'PhoneNumber' => $options['phoneNumber'], 'Origin' => $options['origin'], '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 MobilePage Page of MobileInstance */ public function getPage(string $targetUrl): MobilePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new MobilePage($this->version, $response, $this->solution); } /** * Create the MobileInstance * * @param string $phoneNumber The phone number to purchase in E.164 format * @param array|Options $options Optional Arguments * @return MobileInstance Created MobileInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $phoneNumber, array $options = []): MobileInstance { $options = new Values($options); $data = Values::of([ 'PhoneNumber' => $phoneNumber, 'ApiVersion' => $options['apiVersion'], 'FriendlyName' => $options['friendlyName'], 'SmsApplicationSid' => $options['smsApplicationSid'], 'SmsFallbackMethod' => $options['smsFallbackMethod'], 'SmsFallbackUrl' => $options['smsFallbackUrl'], 'SmsMethod' => $options['smsMethod'], 'SmsUrl' => $options['smsUrl'], 'StatusCallback' => $options['statusCallback'], 'StatusCallbackMethod' => $options['statusCallbackMethod'], 'VoiceApplicationSid' => $options['voiceApplicationSid'], 'VoiceCallerIdLookup' => Serialize::booleanToString($options['voiceCallerIdLookup']), 'VoiceFallbackMethod' => $options['voiceFallbackMethod'], 'VoiceFallbackUrl' => $options['voiceFallbackUrl'], 'VoiceMethod' => $options['voiceMethod'], 'VoiceUrl' => $options['voiceUrl'], 'IdentitySid' => $options['identitySid'], 'AddressSid' => $options['addressSid'], 'EmergencyStatus' => $options['emergencyStatus'], 'EmergencyAddressSid' => $options['emergencyAddressSid'], 'TrunkSid' => $options['trunkSid'], 'VoiceReceiveMode' => $options['voiceReceiveMode'], 'BundleSid' => $options['bundleSid'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new MobileInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.MobileList]'; } }src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/AssignedAddOnList.php000064400000014043150515725670022271 0ustar00solution = ['accountSid' => $accountSid, 'resourceSid' => $resourceSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/IncomingPhoneNumbers/' . \rawurlencode($resourceSid) . '/AssignedAddOns.json'; } /** * Streams AssignedAddOnInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads AssignedAddOnInstance 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 AssignedAddOnInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of AssignedAddOnInstance 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 AssignedAddOnPage Page of AssignedAddOnInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): AssignedAddOnPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new AssignedAddOnPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of AssignedAddOnInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return AssignedAddOnPage Page of AssignedAddOnInstance */ public function getPage(string $targetUrl): AssignedAddOnPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new AssignedAddOnPage($this->version, $response, $this->solution); } /** * Create the AssignedAddOnInstance * * @param string $installedAddOnSid The SID that identifies the Add-on * installation * @return AssignedAddOnInstance Created AssignedAddOnInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $installedAddOnSid): AssignedAddOnInstance { $data = Values::of(['InstalledAddOnSid' => $installedAddOnSid, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new AssignedAddOnInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['resourceSid'] ); } /** * Constructs a AssignedAddOnContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): AssignedAddOnContext { return new AssignedAddOnContext( $this->version, $this->solution['accountSid'], $this->solution['resourceSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.AssignedAddOnList]'; } }src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/LocalPage.php000064400000002304150515725670020616 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return LocalInstance \Twilio\Rest\Api\V2010\Account\IncomingPhoneNumber\LocalInstance */ public function buildInstance(array $payload): LocalInstance { return new LocalInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.LocalPage]'; } }src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/LocalOptions.php000064400000056007150515725670021406 0ustar00options['beta'] = $beta; $this->options['friendlyName'] = $friendlyName; $this->options['phoneNumber'] = $phoneNumber; $this->options['origin'] = $origin; } /** * Whether to include phone numbers new to the Twilio platform. Can be: `true` or `false` and the default is `true`. * * @param bool $beta Whether to include new phone numbers * @return $this Fluent Builder */ public function setBeta(bool $beta): self { $this->options['beta'] = $beta; return $this; } /** * A string that identifies the resources to read. * * @param string $friendlyName A string that identifies the resources to read * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The phone numbers of the IncomingPhoneNumber resources to read. You can specify partial numbers and use '*' as a wildcard for any digit. * * @param string $phoneNumber The phone numbers of the resources to read * @return $this Fluent Builder */ public function setPhoneNumber(string $phoneNumber): self { $this->options['phoneNumber'] = $phoneNumber; return $this; } /** * Whether to include phone numbers based on their origin. Can be: `twilio` or `hosted`. By default, phone numbers of all origin are included. * * @param string $origin Include phone numbers based on their origin. By * default, phone numbers of all origin are included. * @return $this Fluent Builder */ public function setOrigin(string $origin): self { $this->options['origin'] = $origin; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadLocalOptions ' . $options . ']'; } } class CreateLocalOptions extends Options { /** * @param string $apiVersion The API version to use for incoming calls made to * the new phone number * @param string $friendlyName A string to describe the new phone number * @param string $smsApplicationSid The SID of the application to handle SMS * messages * @param string $smsFallbackMethod The HTTP method we use to call * status_callback * @param string $smsFallbackUrl The URL we call when an error occurs while * executing TwiML * @param string $smsMethod The HTTP method to use with sms url * @param string $smsUrl The URL we should call when the new phone number * receives an incoming SMS message * @param string $statusCallback The URL we should call to send status * information to your application * @param string $statusCallbackMethod HTTP method we should use to call * status_callback * @param string $voiceApplicationSid The SID of the application to handle the * new phone number * @param bool $voiceCallerIdLookup Whether to lookup the caller's name * @param string $voiceFallbackMethod The HTTP method used with * voice_fallback_url * @param string $voiceFallbackUrl The URL we will call when an error occurs in * TwiML * @param string $voiceMethod The HTTP method used with the voice_url * @param string $voiceUrl The URL we should call when the phone number * receives a call * @param string $identitySid The SID of the Identity resource to associate * with the new phone number * @param string $addressSid The SID of the Address resource associated with * the phone number * @param string $emergencyStatus Displays if emergency calling is enabled for * this number. * @param string $emergencyAddressSid The emergency address configuration to * use for emergency calling * @param string $trunkSid SID of the trunk to handle calls to the new phone * number * @param string $voiceReceiveMode Incoming call type: fax or voice * @param string $bundleSid The SID of the Bundle resource associated with * number */ public function __construct(string $apiVersion = Values::NONE, string $friendlyName = Values::NONE, string $smsApplicationSid = Values::NONE, string $smsFallbackMethod = Values::NONE, string $smsFallbackUrl = Values::NONE, string $smsMethod = Values::NONE, string $smsUrl = Values::NONE, string $statusCallback = Values::NONE, string $statusCallbackMethod = Values::NONE, string $voiceApplicationSid = Values::NONE, bool $voiceCallerIdLookup = Values::NONE, string $voiceFallbackMethod = Values::NONE, string $voiceFallbackUrl = Values::NONE, string $voiceMethod = Values::NONE, string $voiceUrl = Values::NONE, string $identitySid = Values::NONE, string $addressSid = Values::NONE, string $emergencyStatus = Values::NONE, string $emergencyAddressSid = Values::NONE, string $trunkSid = Values::NONE, string $voiceReceiveMode = Values::NONE, string $bundleSid = Values::NONE) { $this->options['apiVersion'] = $apiVersion; $this->options['friendlyName'] = $friendlyName; $this->options['smsApplicationSid'] = $smsApplicationSid; $this->options['smsFallbackMethod'] = $smsFallbackMethod; $this->options['smsFallbackUrl'] = $smsFallbackUrl; $this->options['smsMethod'] = $smsMethod; $this->options['smsUrl'] = $smsUrl; $this->options['statusCallback'] = $statusCallback; $this->options['statusCallbackMethod'] = $statusCallbackMethod; $this->options['voiceApplicationSid'] = $voiceApplicationSid; $this->options['voiceCallerIdLookup'] = $voiceCallerIdLookup; $this->options['voiceFallbackMethod'] = $voiceFallbackMethod; $this->options['voiceFallbackUrl'] = $voiceFallbackUrl; $this->options['voiceMethod'] = $voiceMethod; $this->options['voiceUrl'] = $voiceUrl; $this->options['identitySid'] = $identitySid; $this->options['addressSid'] = $addressSid; $this->options['emergencyStatus'] = $emergencyStatus; $this->options['emergencyAddressSid'] = $emergencyAddressSid; $this->options['trunkSid'] = $trunkSid; $this->options['voiceReceiveMode'] = $voiceReceiveMode; $this->options['bundleSid'] = $bundleSid; } /** * The API version to use for incoming calls made to the new phone number. The default is `2010-04-01`. * * @param string $apiVersion The API version to use for incoming calls made to * the new phone number * @return $this Fluent Builder */ public function setApiVersion(string $apiVersion): self { $this->options['apiVersion'] = $apiVersion; return $this; } /** * A descriptive string that you created to describe the new phone number. It can be up to 64 characters long. By default, this is a formatted version of the phone number. * * @param string $friendlyName A string to describe the new phone number * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The SID of the application that should handle SMS messages sent to the new phone number. If an `sms_application_sid` is present, we ignore all of the `sms_*_url` urls and use those set on the application. * * @param string $smsApplicationSid The SID of the application to handle SMS * messages * @return $this Fluent Builder */ public function setSmsApplicationSid(string $smsApplicationSid): self { $this->options['smsApplicationSid'] = $smsApplicationSid; return $this; } /** * The HTTP method that we should use to call `sms_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $smsFallbackMethod The HTTP method we use to call * status_callback * @return $this Fluent Builder */ public function setSmsFallbackMethod(string $smsFallbackMethod): self { $this->options['smsFallbackMethod'] = $smsFallbackMethod; return $this; } /** * The URL that we should call when an error occurs while requesting or executing the TwiML defined by `sms_url`. * * @param string $smsFallbackUrl The URL we call when an error occurs while * executing TwiML * @return $this Fluent Builder */ public function setSmsFallbackUrl(string $smsFallbackUrl): self { $this->options['smsFallbackUrl'] = $smsFallbackUrl; return $this; } /** * The HTTP method that we should use to call `sms_url`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $smsMethod The HTTP method to use with sms url * @return $this Fluent Builder */ public function setSmsMethod(string $smsMethod): self { $this->options['smsMethod'] = $smsMethod; return $this; } /** * The URL we should call when the new phone number receives an incoming SMS message. * * @param string $smsUrl The URL we should call when the new phone number * receives an incoming SMS message * @return $this Fluent Builder */ public function setSmsUrl(string $smsUrl): self { $this->options['smsUrl'] = $smsUrl; return $this; } /** * The URL we should call using the `status_callback_method` to send status information to your application. * * @param string $statusCallback The URL we should call to send status * information to your application * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * The HTTP method we should use to call `status_callback`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $statusCallbackMethod HTTP method we should use to call * status_callback * @return $this Fluent Builder */ public function setStatusCallbackMethod(string $statusCallbackMethod): self { $this->options['statusCallbackMethod'] = $statusCallbackMethod; return $this; } /** * The SID of the application we should use to handle calls to the new phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use only those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. * * @param string $voiceApplicationSid The SID of the application to handle the * new phone number * @return $this Fluent Builder */ public function setVoiceApplicationSid(string $voiceApplicationSid): self { $this->options['voiceApplicationSid'] = $voiceApplicationSid; return $this; } /** * Whether to lookup the caller's name from the CNAM database and post it to your app. Can be: `true` or `false` and defaults to `false`. * * @param bool $voiceCallerIdLookup Whether to lookup the caller's name * @return $this Fluent Builder */ public function setVoiceCallerIdLookup(bool $voiceCallerIdLookup): self { $this->options['voiceCallerIdLookup'] = $voiceCallerIdLookup; return $this; } /** * The HTTP method that we should use to call `voice_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $voiceFallbackMethod The HTTP method used with * voice_fallback_url * @return $this Fluent Builder */ public function setVoiceFallbackMethod(string $voiceFallbackMethod): self { $this->options['voiceFallbackMethod'] = $voiceFallbackMethod; return $this; } /** * The URL that we should call when an error occurs retrieving or executing the TwiML requested by `url`. * * @param string $voiceFallbackUrl The URL we will call when an error occurs in * TwiML * @return $this Fluent Builder */ public function setVoiceFallbackUrl(string $voiceFallbackUrl): self { $this->options['voiceFallbackUrl'] = $voiceFallbackUrl; return $this; } /** * The HTTP method that we should use to call `voice_url`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $voiceMethod The HTTP method used with the voice_url * @return $this Fluent Builder */ public function setVoiceMethod(string $voiceMethod): self { $this->options['voiceMethod'] = $voiceMethod; return $this; } /** * The URL that we should call to answer a call to the new phone number. The `voice_url` will not be called if a `voice_application_sid` or a `trunk_sid` is set. * * @param string $voiceUrl The URL we should call when the phone number * receives a call * @return $this Fluent Builder */ public function setVoiceUrl(string $voiceUrl): self { $this->options['voiceUrl'] = $voiceUrl; return $this; } /** * The SID of the Identity resource that we should associate with the new phone number. Some regions require an identity to meet local regulations. * * @param string $identitySid The SID of the Identity resource to associate * with the new phone number * @return $this Fluent Builder */ public function setIdentitySid(string $identitySid): self { $this->options['identitySid'] = $identitySid; return $this; } /** * The SID of the Address resource we should associate with the new phone number. Some regions require addresses to meet local regulations. * * @param string $addressSid The SID of the Address resource associated with * the phone number * @return $this Fluent Builder */ public function setAddressSid(string $addressSid): self { $this->options['addressSid'] = $addressSid; return $this; } /** * The parameter displays if emergency calling is enabled for this number. Active numbers may place emergency calls by dialing valid emergency numbers for the country. * * @param string $emergencyStatus Displays if emergency calling is enabled for * this number. * @return $this Fluent Builder */ public function setEmergencyStatus(string $emergencyStatus): self { $this->options['emergencyStatus'] = $emergencyStatus; return $this; } /** * The SID of the emergency address configuration to use for emergency calling from the new phone number. * * @param string $emergencyAddressSid The emergency address configuration to * use for emergency calling * @return $this Fluent Builder */ public function setEmergencyAddressSid(string $emergencyAddressSid): self { $this->options['emergencyAddressSid'] = $emergencyAddressSid; return $this; } /** * The SID of the Trunk we should use to handle calls to the new phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use only those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. * * @param string $trunkSid SID of the trunk to handle calls to the new phone * number * @return $this Fluent Builder */ public function setTrunkSid(string $trunkSid): self { $this->options['trunkSid'] = $trunkSid; return $this; } /** * The configuration parameter for the new phone number to receive incoming voice calls or faxes. Can be: `fax` or `voice` and defaults to `voice`. * * @param string $voiceReceiveMode Incoming call type: fax or voice * @return $this Fluent Builder */ public function setVoiceReceiveMode(string $voiceReceiveMode): self { $this->options['voiceReceiveMode'] = $voiceReceiveMode; return $this; } /** * The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. * * @param string $bundleSid The SID of the Bundle resource associated with * number * @return $this Fluent Builder */ public function setBundleSid(string $bundleSid): self { $this->options['bundleSid'] = $bundleSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.CreateLocalOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumber/TollFreeInstance.php000064400000012626150515725670022200 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'addressSid' => Values::array_get($payload, 'address_sid'), 'addressRequirements' => Values::array_get($payload, 'address_requirements'), 'apiVersion' => Values::array_get($payload, 'api_version'), 'beta' => Values::array_get($payload, 'beta'), 'capabilities' => Values::array_get($payload, 'capabilities'), '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'), 'identitySid' => Values::array_get($payload, 'identity_sid'), 'phoneNumber' => Values::array_get($payload, 'phone_number'), 'origin' => Values::array_get($payload, 'origin'), 'sid' => Values::array_get($payload, 'sid'), 'smsApplicationSid' => Values::array_get($payload, 'sms_application_sid'), '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'), 'statusCallback' => Values::array_get($payload, 'status_callback'), 'statusCallbackMethod' => Values::array_get($payload, 'status_callback_method'), 'trunkSid' => Values::array_get($payload, 'trunk_sid'), 'uri' => Values::array_get($payload, 'uri'), 'voiceReceiveMode' => Values::array_get($payload, 'voice_receive_mode'), 'voiceApplicationSid' => Values::array_get($payload, 'voice_application_sid'), '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'), 'emergencyStatus' => Values::array_get($payload, 'emergency_status'), 'emergencyAddressSid' => Values::array_get($payload, 'emergency_address_sid'), 'emergencyAddressStatus' => Values::array_get($payload, 'emergency_address_status'), 'bundleSid' => Values::array_get($payload, 'bundle_sid'), 'status' => Values::array_get($payload, 'status'), ]; $this->solution = ['accountSid' => $accountSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Api.V2010.TollFreeInstance]'; } }src/Twilio/Rest/Api/V2010/Account/KeyOptions.php000064400000002677150515725670015202 0ustar00options['friendlyName'] = $friendlyName; } /** * A descriptive string that you create to describe the resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.UpdateKeyOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/UsageInstance.php000064400000003120150515725670015607 0ustar00solution = ['accountSid' => $accountSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Api.V2010.UsageInstance]'; } }src/Twilio/Rest/Api/V2010/Account/QueueContext.php000064400000010613150515725670015514 0ustar00solution = ['accountSid' => $accountSid, 'sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Queues/' . \rawurlencode($sid) . '.json'; } /** * Fetch the QueueInstance * * @return QueueInstance Fetched QueueInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): QueueInstance { $payload = $this->version->fetch('GET', $this->uri); return new QueueInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Update the QueueInstance * * @param array|Options $options Optional Arguments * @return QueueInstance Updated QueueInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): QueueInstance { $options = new Values($options); $data = Values::of(['FriendlyName' => $options['friendlyName'], 'MaxSize' => $options['maxSize'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new QueueInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['sid'] ); } /** * Delete the QueueInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the members */ protected function getMembers(): MemberList { if (!$this->_members) { $this->_members = new MemberList( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->_members; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.QueueContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/UsageList.php000064400000005631150515725670014767 0ustar00solution = ['accountSid' => $accountSid, ]; } /** * Access the records */ protected function getRecords(): RecordList { if (!$this->_records) { $this->_records = new RecordList($this->version, $this->solution['accountSid']); } return $this->_records; } /** * Access the triggers */ protected function getTriggers(): TriggerList { if (!$this->_triggers) { $this->_triggers = new TriggerList($this->version, $this->solution['accountSid']); } return $this->_triggers; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return \Twilio\ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Api.V2010.UsageList]'; } }src/Twilio/Rest/Api/V2010/Account/QueueInstance.php000064400000010737150515725670015643 0ustar00properties = [ 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'currentSize' => Values::array_get($payload, 'current_size'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'uri' => Values::array_get($payload, 'uri'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'averageWaitTime' => Values::array_get($payload, 'average_wait_time'), 'sid' => Values::array_get($payload, 'sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'maxSize' => Values::array_get($payload, 'max_size'), ]; $this->solution = ['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 QueueContext Context for this QueueInstance */ protected function proxy(): QueueContext { if (!$this->context) { $this->context = new QueueContext( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the QueueInstance * * @return QueueInstance Fetched QueueInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): QueueInstance { return $this->proxy()->fetch(); } /** * Update the QueueInstance * * @param array|Options $options Optional Arguments * @return QueueInstance Updated QueueInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): QueueInstance { return $this->proxy()->update($options); } /** * Delete the QueueInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the members */ protected function getMembers(): MemberList { return $this->proxy()->members; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.QueueInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/OutgoingCallerIdOptions.php000064400000007341150515725670017636 0ustar00options['friendlyName'] = $friendlyName; } /** * A descriptive string that you create to describe the resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.UpdateOutgoingCallerIdOptions ' . $options . ']'; } } class ReadOutgoingCallerIdOptions extends Options { /** * @param string $phoneNumber The phone number of the OutgoingCallerId * resources to read * @param string $friendlyName The string that identifies the OutgoingCallerId * resources to read */ public function __construct(string $phoneNumber = Values::NONE, string $friendlyName = Values::NONE) { $this->options['phoneNumber'] = $phoneNumber; $this->options['friendlyName'] = $friendlyName; } /** * The phone number of the OutgoingCallerId resources to read. * * @param string $phoneNumber The phone number of the OutgoingCallerId * resources to read * @return $this Fluent Builder */ public function setPhoneNumber(string $phoneNumber): self { $this->options['phoneNumber'] = $phoneNumber; return $this; } /** * The string that identifies the OutgoingCallerId resources to read. * * @param string $friendlyName The string that identifies the OutgoingCallerId * resources to read * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadOutgoingCallerIdOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/AddressList.php000064400000015525150515725670015313 0ustar00solution = ['accountSid' => $accountSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Addresses.json'; } /** * Create the AddressInstance * * @param string $customerName The name to associate with the new address * @param string $street The number and street address of the new address * @param string $city The city of the new address * @param string $region The state or region of the new address * @param string $postalCode The postal code of the new address * @param string $isoCountry The ISO country code of the new address * @param array|Options $options Optional Arguments * @return AddressInstance Created AddressInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $customerName, string $street, string $city, string $region, string $postalCode, string $isoCountry, array $options = []): AddressInstance { $options = new Values($options); $data = Values::of([ '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, [], $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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $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(array $options = [], int $limit = null, $pageSize = null): array { 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 AddressPage Page of AddressInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): AddressPage { $options = new Values($options); $params = Values::of([ '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 AddressPage Page of AddressInstance */ public function getPage(string $targetUrl): AddressPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new AddressPage($this->version, $response, $this->solution); } /** * Constructs a AddressContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): AddressContext { return new AddressContext($this->version, $this->solution['accountSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.AddressList]'; } }src/Twilio/Rest/Api/V2010/Account/ValidationRequestInstance.php000064400000004254150515725670020217 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'callSid' => Values::array_get($payload, 'call_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'phoneNumber' => Values::array_get($payload, 'phone_number'), 'validationCode' => Values::array_get($payload, 'validation_code'), ]; $this->solution = ['accountSid' => $accountSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Api.V2010.ValidationRequestInstance]'; } }src/Twilio/Rest/Api/V2010/Account/QueueOptions.php000064400000006364150515725670015533 0ustar00options['friendlyName'] = $friendlyName; $this->options['maxSize'] = $maxSize; } /** * A descriptive string that you created to describe this resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe this resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The maximum number of calls allowed to be in the queue. The default is 100. The maximum is 5000. * * @param int $maxSize The max number of calls allowed in the queue * @return $this Fluent Builder */ public function setMaxSize(int $maxSize): self { $this->options['maxSize'] = $maxSize; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.UpdateQueueOptions ' . $options . ']'; } } class CreateQueueOptions extends Options { /** * @param int $maxSize The max number of calls allowed in the queue */ public function __construct(int $maxSize = Values::NONE) { $this->options['maxSize'] = $maxSize; } /** * The maximum number of calls allowed to be in the queue. The default is 100. The maximum is 5000. * * @param int $maxSize The max number of calls allowed in the queue * @return $this Fluent Builder */ public function setMaxSize(int $maxSize): self { $this->options['maxSize'] = $maxSize; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.CreateQueueOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/IncomingPhoneNumberInstance.php000064400000017117150515725670020464 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'addressSid' => Values::array_get($payload, 'address_sid'), 'addressRequirements' => Values::array_get($payload, 'address_requirements'), 'apiVersion' => Values::array_get($payload, 'api_version'), 'beta' => Values::array_get($payload, 'beta'), 'capabilities' => Values::array_get($payload, 'capabilities'), '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'), 'identitySid' => Values::array_get($payload, 'identity_sid'), 'phoneNumber' => Values::array_get($payload, 'phone_number'), 'origin' => Values::array_get($payload, 'origin'), 'sid' => Values::array_get($payload, 'sid'), 'smsApplicationSid' => Values::array_get($payload, 'sms_application_sid'), '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'), 'statusCallback' => Values::array_get($payload, 'status_callback'), 'statusCallbackMethod' => Values::array_get($payload, 'status_callback_method'), 'trunkSid' => Values::array_get($payload, 'trunk_sid'), 'uri' => Values::array_get($payload, 'uri'), 'voiceReceiveMode' => Values::array_get($payload, 'voice_receive_mode'), 'voiceApplicationSid' => Values::array_get($payload, 'voice_application_sid'), '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'), 'emergencyStatus' => Values::array_get($payload, 'emergency_status'), 'emergencyAddressSid' => Values::array_get($payload, 'emergency_address_sid'), 'emergencyAddressStatus' => Values::array_get($payload, 'emergency_address_status'), 'bundleSid' => Values::array_get($payload, 'bundle_sid'), 'status' => Values::array_get($payload, 'status'), ]; $this->solution = ['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 IncomingPhoneNumberContext Context for this * IncomingPhoneNumberInstance */ protected function proxy(): IncomingPhoneNumberContext { if (!$this->context) { $this->context = new IncomingPhoneNumberContext( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->context; } /** * Update the IncomingPhoneNumberInstance * * @param array|Options $options Optional Arguments * @return IncomingPhoneNumberInstance Updated IncomingPhoneNumberInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): IncomingPhoneNumberInstance { return $this->proxy()->update($options); } /** * Fetch the IncomingPhoneNumberInstance * * @return IncomingPhoneNumberInstance Fetched IncomingPhoneNumberInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): IncomingPhoneNumberInstance { return $this->proxy()->fetch(); } /** * Delete the IncomingPhoneNumberInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the assignedAddOns */ protected function getAssignedAddOns(): AssignedAddOnList { return $this->proxy()->assignedAddOns; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.IncomingPhoneNumberInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/AddressInstance.php000064400000012310150515725670016131 0ustar00properties = [ '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'), 'verified' => Values::array_get($payload, 'verified'), ]; $this->solution = ['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 AddressContext Context for this AddressInstance */ protected function proxy(): AddressContext { if (!$this->context) { $this->context = new AddressContext( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->context; } /** * Delete the AddressInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Fetch the AddressInstance * * @return AddressInstance Fetched AddressInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AddressInstance { return $this->proxy()->fetch(); } /** * Update the AddressInstance * * @param array|Options $options Optional Arguments * @return AddressInstance Updated AddressInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): AddressInstance { return $this->proxy()->update($options); } /** * Access the dependentPhoneNumbers */ protected function getDependentPhoneNumbers(): DependentPhoneNumberList { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.AddressInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/ConnectAppInstance.php000064400000011117150515725670016602 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'authorizeRedirectUrl' => Values::array_get($payload, 'authorize_redirect_url'), 'companyName' => Values::array_get($payload, 'company_name'), 'deauthorizeCallbackMethod' => Values::array_get($payload, 'deauthorize_callback_method'), 'deauthorizeCallbackUrl' => Values::array_get($payload, 'deauthorize_callback_url'), 'description' => Values::array_get($payload, 'description'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'homepageUrl' => Values::array_get($payload, 'homepage_url'), 'permissions' => Values::array_get($payload, 'permissions'), 'sid' => Values::array_get($payload, 'sid'), 'uri' => Values::array_get($payload, 'uri'), ]; $this->solution = ['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 ConnectAppContext Context for this ConnectAppInstance */ protected function proxy(): ConnectAppContext { if (!$this->context) { $this->context = new ConnectAppContext( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the ConnectAppInstance * * @return ConnectAppInstance Fetched ConnectAppInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ConnectAppInstance { return $this->proxy()->fetch(); } /** * Update the ConnectAppInstance * * @param array|Options $options Optional Arguments * @return ConnectAppInstance Updated ConnectAppInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ConnectAppInstance { return $this->proxy()->update($options); } /** * Delete the ConnectAppInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.ConnectAppInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/BalancePage.php000064400000002250150515725670015203 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return BalanceInstance \Twilio\Rest\Api\V2010\Account\BalanceInstance */ public function buildInstance(array $payload): BalanceInstance { return new BalanceInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.BalancePage]'; } }src/Twilio/Rest/Api/V2010/Account/ApplicationInstance.php000064400000013231150515725670017012 0ustar00properties = [ '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 = ['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 ApplicationContext Context for this ApplicationInstance */ protected function proxy(): ApplicationContext { if (!$this->context) { $this->context = new ApplicationContext( $this->version, $this->solution['accountSid'], $this->solution['sid'] ); } return $this->context; } /** * Delete the ApplicationInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Fetch the ApplicationInstance * * @return ApplicationInstance Fetched ApplicationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ApplicationInstance { return $this->proxy()->fetch(); } /** * Update the ApplicationInstance * * @param array|Options $options Optional Arguments * @return ApplicationInstance Updated ApplicationInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ApplicationInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.ApplicationInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/TranscriptionPage.php000064400000002314150515725670016516 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return TranscriptionInstance \Twilio\Rest\Api\V2010\Account\TranscriptionInstance */ public function buildInstance(array $payload): TranscriptionInstance { return new TranscriptionInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.TranscriptionPage]'; } }src/Twilio/Rest/Api/V2010/Account/MessagePage.php000064400000002250150515725670015242 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return MessageInstance \Twilio\Rest\Api\V2010\Account\MessageInstance */ public function buildInstance(array $payload): MessageInstance { return new MessageInstance($this->version, $payload, $this->solution['accountSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.MessagePage]'; } }src/Twilio/Rest/Api/V2010/Account/Queue/MemberOptions.php000064400000002742150515725670016736 0ustar00options['method'] = $method; } /** * How to pass the update request data. Can be `GET` or `POST` and the default is `POST`. `POST` sends the data as encoded form data and `GET` sends the data as query parameters. * * @param string $method How to pass the update request data * @return $this Fluent Builder */ public function setMethod(string $method): self { $this->options['method'] = $method; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.UpdateMemberOptions ' . $options . ']'; } }src/Twilio/Rest/Api/V2010/Account/Queue/MemberList.php000064400000011677150515725670016225 0ustar00solution = ['accountSid' => $accountSid, 'queueSid' => $queueSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Queues/' . \rawurlencode($queueSid) . '/Members.json'; } /** * Streams MemberInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads MemberInstance 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 MemberInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of MemberInstance 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 MemberPage Page of MemberInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): MemberPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new MemberPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of MemberInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return MemberPage Page of MemberInstance */ public function getPage(string $targetUrl): MemberPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new MemberPage($this->version, $response, $this->solution); } /** * Constructs a MemberContext * * @param string $callSid The Call SID of the resource(s) to fetch */ public function getContext(string $callSid): MemberContext { return new MemberContext( $this->version, $this->solution['accountSid'], $this->solution['queueSid'], $callSid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.MemberList]'; } }src/Twilio/Rest/Api/V2010/Account/Queue/MemberContext.php000064400000005416150515725670016730 0ustar00solution = ['accountSid' => $accountSid, 'queueSid' => $queueSid, 'callSid' => $callSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/Queues/' . \rawurlencode($queueSid) . '/Members/' . \rawurlencode($callSid) . '.json'; } /** * Fetch the MemberInstance * * @return MemberInstance Fetched MemberInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MemberInstance { $payload = $this->version->fetch('GET', $this->uri); return new MemberInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['queueSid'], $this->solution['callSid'] ); } /** * Update the MemberInstance * * @param string $url The absolute URL of the Queue resource * @param array|Options $options Optional Arguments * @return MemberInstance Updated MemberInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $url, array $options = []): MemberInstance { $options = new Values($options); $data = Values::of(['Url' => $url, 'Method' => $options['method'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new MemberInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['queueSid'], $this->solution['callSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.MemberContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/Queue/MemberPage.php000064400000002405150515725670016153 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return MemberInstance \Twilio\Rest\Api\V2010\Account\Queue\MemberInstance */ public function buildInstance(array $payload): MemberInstance { return new MemberInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['queueSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.MemberPage]'; } }src/Twilio/Rest/Api/V2010/Account/Queue/MemberInstance.php000064400000007742150515725670017054 0ustar00properties = [ 'callSid' => Values::array_get($payload, 'call_sid'), 'dateEnqueued' => Deserialize::dateTime(Values::array_get($payload, 'date_enqueued')), 'position' => Values::array_get($payload, 'position'), 'uri' => Values::array_get($payload, 'uri'), 'waitTime' => Values::array_get($payload, 'wait_time'), 'queueSid' => Values::array_get($payload, 'queue_sid'), ]; $this->solution = [ 'accountSid' => $accountSid, 'queueSid' => $queueSid, 'callSid' => $callSid ?: $this->properties['callSid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return MemberContext Context for this MemberInstance */ protected function proxy(): MemberContext { if (!$this->context) { $this->context = new MemberContext( $this->version, $this->solution['accountSid'], $this->solution['queueSid'], $this->solution['callSid'] ); } return $this->context; } /** * Fetch the MemberInstance * * @return MemberInstance Fetched MemberInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MemberInstance { return $this->proxy()->fetch(); } /** * Update the MemberInstance * * @param string $url The absolute URL of the Queue resource * @param array|Options $options Optional Arguments * @return MemberInstance Updated MemberInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $url, array $options = []): MemberInstance { return $this->proxy()->update($url, $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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.MemberInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/Account/AuthorizedConnectAppContext.php000064400000003662150515725670020527 0ustar00solution = ['accountSid' => $accountSid, 'connectAppSid' => $connectAppSid, ]; $this->uri = '/Accounts/' . \rawurlencode($accountSid) . '/AuthorizedConnectApps/' . \rawurlencode($connectAppSid) . '.json'; } /** * Fetch the AuthorizedConnectAppInstance * * @return AuthorizedConnectAppInstance Fetched AuthorizedConnectAppInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AuthorizedConnectAppInstance { $payload = $this->version->fetch('GET', $this->uri); return new AuthorizedConnectAppInstance( $this->version, $payload, $this->solution['accountSid'], $this->solution['connectAppSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.AuthorizedConnectAppContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/AccountList.php000064400000013013150515725670013714 0ustar00solution = []; $this->uri = '/Accounts.json'; } /** * Create the AccountInstance * * @param array|Options $options Optional Arguments * @return AccountInstance Created AccountInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): AccountInstance { $options = new Values($options); $data = Values::of(['FriendlyName' => $options['friendlyName'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new AccountInstance($this->version, $payload); } /** * Streams AccountInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads AccountInstance 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 AccountInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of AccountInstance 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 AccountPage Page of AccountInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): AccountPage { $options = new Values($options); $params = Values::of([ 'FriendlyName' => $options['friendlyName'], 'Status' => $options['status'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new AccountPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of AccountInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return AccountPage Page of AccountInstance */ public function getPage(string $targetUrl): AccountPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new AccountPage($this->version, $response, $this->solution); } /** * Constructs a AccountContext * * @param string $sid Fetch by unique Account Sid */ public function getContext(string $sid): AccountContext { return new AccountContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.AccountList]'; } }src/Twilio/Rest/Api/V2010/AccountInstance.php000064400000022603150515725670014552 0ustar00properties = [ 'authToken' => Values::array_get($payload, 'auth_token'), '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'), 'ownerAccountSid' => Values::array_get($payload, 'owner_account_sid'), 'sid' => Values::array_get($payload, 'sid'), 'status' => Values::array_get($payload, 'status'), 'subresourceUris' => Values::array_get($payload, 'subresource_uris'), 'type' => Values::array_get($payload, 'type'), 'uri' => Values::array_get($payload, 'uri'), ]; $this->solution = ['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 AccountContext Context for this AccountInstance */ protected function proxy(): AccountContext { if (!$this->context) { $this->context = new AccountContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the AccountInstance * * @return AccountInstance Fetched AccountInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AccountInstance { return $this->proxy()->fetch(); } /** * Update the AccountInstance * * @param array|Options $options Optional Arguments * @return AccountInstance Updated AccountInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): AccountInstance { return $this->proxy()->update($options); } /** * Access the addresses */ protected function getAddresses(): AddressList { return $this->proxy()->addresses; } /** * Access the applications */ protected function getApplications(): ApplicationList { return $this->proxy()->applications; } /** * Access the authorizedConnectApps */ protected function getAuthorizedConnectApps(): AuthorizedConnectAppList { return $this->proxy()->authorizedConnectApps; } /** * Access the availablePhoneNumbers */ protected function getAvailablePhoneNumbers(): AvailablePhoneNumberCountryList { return $this->proxy()->availablePhoneNumbers; } /** * Access the balance */ protected function getBalance(): BalanceList { return $this->proxy()->balance; } /** * Access the calls */ protected function getCalls(): CallList { return $this->proxy()->calls; } /** * Access the conferences */ protected function getConferences(): ConferenceList { return $this->proxy()->conferences; } /** * Access the connectApps */ protected function getConnectApps(): ConnectAppList { return $this->proxy()->connectApps; } /** * Access the incomingPhoneNumbers */ protected function getIncomingPhoneNumbers(): IncomingPhoneNumberList { return $this->proxy()->incomingPhoneNumbers; } /** * Access the keys */ protected function getKeys(): KeyList { return $this->proxy()->keys; } /** * Access the messages */ protected function getMessages(): MessageList { return $this->proxy()->messages; } /** * Access the newKeys */ protected function getNewKeys(): NewKeyList { return $this->proxy()->newKeys; } /** * Access the newSigningKeys */ protected function getNewSigningKeys(): NewSigningKeyList { return $this->proxy()->newSigningKeys; } /** * Access the notifications */ protected function getNotifications(): NotificationList { return $this->proxy()->notifications; } /** * Access the outgoingCallerIds */ protected function getOutgoingCallerIds(): OutgoingCallerIdList { return $this->proxy()->outgoingCallerIds; } /** * Access the queues */ protected function getQueues(): QueueList { return $this->proxy()->queues; } /** * Access the recordings */ protected function getRecordings(): RecordingList { return $this->proxy()->recordings; } /** * Access the signingKeys */ protected function getSigningKeys(): SigningKeyList { return $this->proxy()->signingKeys; } /** * Access the sip */ protected function getSip(): SipList { return $this->proxy()->sip; } /** * Access the shortCodes */ protected function getShortCodes(): ShortCodeList { return $this->proxy()->shortCodes; } /** * Access the tokens */ protected function getTokens(): TokenList { return $this->proxy()->tokens; } /** * Access the transcriptions */ protected function getTranscriptions(): TranscriptionList { return $this->proxy()->transcriptions; } /** * Access the usage */ protected function getUsage(): UsageList { return $this->proxy()->usage; } /** * Access the validationRequests */ protected function getValidationRequests(): ValidationRequestList { return $this->proxy()->validationRequests; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.AccountInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/AccountContext.php000064400000034527150515725670014442 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Accounts/' . \rawurlencode($sid) . '.json'; } /** * Fetch the AccountInstance * * @return AccountInstance Fetched AccountInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AccountInstance { $payload = $this->version->fetch('GET', $this->uri); return new AccountInstance($this->version, $payload, $this->solution['sid']); } /** * Update the AccountInstance * * @param array|Options $options Optional Arguments * @return AccountInstance Updated AccountInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): AccountInstance { $options = new Values($options); $data = Values::of(['FriendlyName' => $options['friendlyName'], 'Status' => $options['status'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new AccountInstance($this->version, $payload, $this->solution['sid']); } /** * Access the addresses */ protected function getAddresses(): AddressList { if (!$this->_addresses) { $this->_addresses = new AddressList($this->version, $this->solution['sid']); } return $this->_addresses; } /** * Access the applications */ protected function getApplications(): ApplicationList { if (!$this->_applications) { $this->_applications = new ApplicationList($this->version, $this->solution['sid']); } return $this->_applications; } /** * Access the authorizedConnectApps */ protected function getAuthorizedConnectApps(): AuthorizedConnectAppList { if (!$this->_authorizedConnectApps) { $this->_authorizedConnectApps = new AuthorizedConnectAppList( $this->version, $this->solution['sid'] ); } return $this->_authorizedConnectApps; } /** * Access the availablePhoneNumbers */ protected function getAvailablePhoneNumbers(): AvailablePhoneNumberCountryList { if (!$this->_availablePhoneNumbers) { $this->_availablePhoneNumbers = new AvailablePhoneNumberCountryList( $this->version, $this->solution['sid'] ); } return $this->_availablePhoneNumbers; } /** * Access the balance */ protected function getBalance(): BalanceList { if (!$this->_balance) { $this->_balance = new BalanceList($this->version, $this->solution['sid']); } return $this->_balance; } /** * Access the calls */ protected function getCalls(): CallList { if (!$this->_calls) { $this->_calls = new CallList($this->version, $this->solution['sid']); } return $this->_calls; } /** * Access the conferences */ protected function getConferences(): ConferenceList { if (!$this->_conferences) { $this->_conferences = new ConferenceList($this->version, $this->solution['sid']); } return $this->_conferences; } /** * Access the connectApps */ protected function getConnectApps(): ConnectAppList { if (!$this->_connectApps) { $this->_connectApps = new ConnectAppList($this->version, $this->solution['sid']); } return $this->_connectApps; } /** * Access the incomingPhoneNumbers */ protected function getIncomingPhoneNumbers(): IncomingPhoneNumberList { if (!$this->_incomingPhoneNumbers) { $this->_incomingPhoneNumbers = new IncomingPhoneNumberList($this->version, $this->solution['sid']); } return $this->_incomingPhoneNumbers; } /** * Access the keys */ protected function getKeys(): KeyList { if (!$this->_keys) { $this->_keys = new KeyList($this->version, $this->solution['sid']); } return $this->_keys; } /** * Access the messages */ protected function getMessages(): MessageList { if (!$this->_messages) { $this->_messages = new MessageList($this->version, $this->solution['sid']); } return $this->_messages; } /** * Access the newKeys */ protected function getNewKeys(): NewKeyList { if (!$this->_newKeys) { $this->_newKeys = new NewKeyList($this->version, $this->solution['sid']); } return $this->_newKeys; } /** * Access the newSigningKeys */ protected function getNewSigningKeys(): NewSigningKeyList { if (!$this->_newSigningKeys) { $this->_newSigningKeys = new NewSigningKeyList($this->version, $this->solution['sid']); } return $this->_newSigningKeys; } /** * Access the notifications */ protected function getNotifications(): NotificationList { if (!$this->_notifications) { $this->_notifications = new NotificationList($this->version, $this->solution['sid']); } return $this->_notifications; } /** * Access the outgoingCallerIds */ protected function getOutgoingCallerIds(): OutgoingCallerIdList { if (!$this->_outgoingCallerIds) { $this->_outgoingCallerIds = new OutgoingCallerIdList($this->version, $this->solution['sid']); } return $this->_outgoingCallerIds; } /** * Access the queues */ protected function getQueues(): QueueList { if (!$this->_queues) { $this->_queues = new QueueList($this->version, $this->solution['sid']); } return $this->_queues; } /** * Access the recordings */ protected function getRecordings(): RecordingList { if (!$this->_recordings) { $this->_recordings = new RecordingList($this->version, $this->solution['sid']); } return $this->_recordings; } /** * Access the signingKeys */ protected function getSigningKeys(): SigningKeyList { if (!$this->_signingKeys) { $this->_signingKeys = new SigningKeyList($this->version, $this->solution['sid']); } return $this->_signingKeys; } /** * Access the sip */ protected function getSip(): SipList { if (!$this->_sip) { $this->_sip = new SipList($this->version, $this->solution['sid']); } return $this->_sip; } /** * Access the shortCodes */ protected function getShortCodes(): ShortCodeList { if (!$this->_shortCodes) { $this->_shortCodes = new ShortCodeList($this->version, $this->solution['sid']); } return $this->_shortCodes; } /** * Access the tokens */ protected function getTokens(): TokenList { if (!$this->_tokens) { $this->_tokens = new TokenList($this->version, $this->solution['sid']); } return $this->_tokens; } /** * Access the transcriptions */ protected function getTranscriptions(): TranscriptionList { if (!$this->_transcriptions) { $this->_transcriptions = new TranscriptionList($this->version, $this->solution['sid']); } return $this->_transcriptions; } /** * Access the usage */ protected function getUsage(): UsageList { if (!$this->_usage) { $this->_usage = new UsageList($this->version, $this->solution['sid']); } return $this->_usage; } /** * Access the validationRequests */ protected function getValidationRequests(): ValidationRequestList { if (!$this->_validationRequests) { $this->_validationRequests = new ValidationRequestList($this->version, $this->solution['sid']); } return $this->_validationRequests; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Api.V2010.AccountContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Api/V2010/AccountPage.php000064400000002171150515725670013660 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return AccountInstance \Twilio\Rest\Api\V2010\AccountInstance */ public function buildInstance(array $payload): AccountInstance { return new AccountInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api.V2010.AccountPage]'; } }src/Twilio/Rest/Api/V2010/AccountOptions.php000064400000012017150515725670014437 0ustar00options['friendlyName'] = $friendlyName; } /** * A human readable description of the account to create, defaults to `SubAccount Created at {YYYY-MM-DD HH:MM meridian}` * * @param string $friendlyName A human readable description of the account * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.CreateAccountOptions ' . $options . ']'; } } class ReadAccountOptions extends Options { /** * @param string $friendlyName FriendlyName to filter on * @param string $status Status to filter on */ public function __construct(string $friendlyName = Values::NONE, string $status = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['status'] = $status; } /** * Only return the Account resources with friendly names that exactly match this name. * * @param string $friendlyName FriendlyName to filter on * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Only return Account resources with the given status. Can be `closed`, `suspended` or `active`. * * @param string $status Status to filter on * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.ReadAccountOptions ' . $options . ']'; } } class UpdateAccountOptions extends Options { /** * @param string $friendlyName FriendlyName to update * @param string $status Status to update the Account with */ public function __construct(string $friendlyName = Values::NONE, string $status = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['status'] = $status; } /** * Update the human-readable description of this Account * * @param string $friendlyName FriendlyName to update * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Alter the status of this account: use `closed` to irreversibly close this account, `suspended` to temporarily suspend it, or `active` to reactivate it. * * @param string $status Status to update the Account with * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Api.V2010.UpdateAccountOptions ' . $options . ']'; } }src/Twilio/Rest/Events/V1/SinkOptions.php000064400000004156150515725670014265 0ustar00options['inUse'] = $inUse; $this->options['status'] = $status; } /** * A boolean query parameter filtering the results to return sinks used/not used by a subscription. * * @param bool $inUse A boolean to return sinks used/not used by a subscription. * @return $this Fluent Builder */ public function setInUse(bool $inUse): self { $this->options['inUse'] = $inUse; return $this; } /** * A String query parameter filtering the results by status `initialized`, `validating`, `active` or `failed`. * * @param string $status A string to filter sinks by status. * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Events.V1.ReadSinkOptions ' . $options . ']'; } }src/Twilio/Rest/Events/V1/SchemaPage.php000064400000002344150515725670013777 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SchemaInstance \Twilio\Rest\Events\V1\SchemaInstance */ public function buildInstance(array $payload): SchemaInstance { return new SchemaInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Events.V1.SchemaPage]'; } }src/Twilio/Rest/Events/V1/EventTypePage.php000064400000002366150515725670014526 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return EventTypeInstance \Twilio\Rest\Events\V1\EventTypeInstance */ public function buildInstance(array $payload): EventTypeInstance { return new EventTypeInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Events.V1.EventTypePage]'; } }src/Twilio/Rest/Events/V1/EventTypeList.php000064400000012055150515725670014561 0ustar00solution = []; $this->uri = '/Types'; } /** * Streams EventTypeInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads EventTypeInstance 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 EventTypeInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of EventTypeInstance 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 EventTypePage Page of EventTypeInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): EventTypePage { $options = new Values($options); $params = Values::of([ 'SchemaId' => $options['schemaId'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new EventTypePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of EventTypeInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return EventTypePage Page of EventTypeInstance */ public function getPage(string $targetUrl): EventTypePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new EventTypePage($this->version, $response, $this->solution); } /** * Constructs a EventTypeContext * * @param string $type A string that uniquely identifies this Event Type. */ public function getContext(string $type): EventTypeContext { return new EventTypeContext($this->version, $type); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Events.V1.EventTypeList]'; } }src/Twilio/Rest/Events/V1/SinkPage.php000064400000002330150515725670013476 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SinkInstance \Twilio\Rest\Events\V1\SinkInstance */ public function buildInstance(array $payload): SinkInstance { return new SinkInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Events.V1.SinkPage]'; } }src/Twilio/Rest/Events/V1/EventTypeInstance.php000064400000006551150515725670015416 0ustar00properties = [ 'type' => Values::array_get($payload, 'type'), 'schemaId' => Values::array_get($payload, 'schema_id'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'description' => Values::array_get($payload, 'description'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['type' => $type ?: $this->properties['type'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return EventTypeContext Context for this EventTypeInstance */ protected function proxy(): EventTypeContext { if (!$this->context) { $this->context = new EventTypeContext($this->version, $this->solution['type']); } return $this->context; } /** * Fetch the EventTypeInstance * * @return EventTypeInstance Fetched EventTypeInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): EventTypeInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Events.V1.EventTypeInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Events/V1/SchemaInstance.php000064400000006522150515725670014671 0ustar00properties = [ 'id' => Values::array_get($payload, 'id'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), 'latestVersionDateCreated' => Deserialize::dateTime(Values::array_get($payload, 'latest_version_date_created')), 'latestVersion' => Values::array_get($payload, 'latest_version'), ]; $this->solution = ['id' => $id ?: $this->properties['id'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return SchemaContext Context for this SchemaInstance */ protected function proxy(): SchemaContext { if (!$this->context) { $this->context = new SchemaContext($this->version, $this->solution['id']); } return $this->context; } /** * Fetch the SchemaInstance * * @return SchemaInstance Fetched SchemaInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SchemaInstance { return $this->proxy()->fetch(); } /** * Access the versions */ protected function getVersions(): SchemaVersionList { return $this->proxy()->versions; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Events.V1.SchemaInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Events/V1/SubscriptionOptions.php000064400000006250150515725670016042 0ustar00options['sinkSid'] = $sinkSid; } /** * The SID of the sink that the list of Subscriptions should be filtered by. * * @param string $sinkSid Sink SID. * @return $this Fluent Builder */ public function setSinkSid(string $sinkSid): self { $this->options['sinkSid'] = $sinkSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Events.V1.ReadSubscriptionOptions ' . $options . ']'; } } class UpdateSubscriptionOptions extends Options { /** * @param string $description Subscription description. * @param string $sinkSid Sink SID. */ public function __construct(string $description = Values::NONE, string $sinkSid = Values::NONE) { $this->options['description'] = $description; $this->options['sinkSid'] = $sinkSid; } /** * A human readable description for the Subscription. * * @param string $description Subscription description. * @return $this Fluent Builder */ public function setDescription(string $description): self { $this->options['description'] = $description; return $this; } /** * The SID of the sink that events selected by this subscription should be sent to. Sink must be active for the subscription to be created. * * @param string $sinkSid Sink SID. * @return $this Fluent Builder */ public function setSinkSid(string $sinkSid): self { $this->options['sinkSid'] = $sinkSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Events.V1.UpdateSubscriptionOptions ' . $options . ']'; } }src/Twilio/Rest/Events/V1/SubscriptionList.php000064400000013717150515725670015330 0ustar00solution = []; $this->uri = '/Subscriptions'; } /** * Streams SubscriptionInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads SubscriptionInstance 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 SubscriptionInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of SubscriptionInstance 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 SubscriptionPage Page of SubscriptionInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SubscriptionPage { $options = new Values($options); $params = Values::of([ 'SinkSid' => $options['sinkSid'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new SubscriptionPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of SubscriptionInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return SubscriptionPage Page of SubscriptionInstance */ public function getPage(string $targetUrl): SubscriptionPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new SubscriptionPage($this->version, $response, $this->solution); } /** * Create the SubscriptionInstance * * @param string $description Subscription description * @param string $sinkSid Sink SID. * @param array[] $types Subscribed Event Types * @return SubscriptionInstance Created SubscriptionInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $description, string $sinkSid, array $types): SubscriptionInstance { $data = Values::of([ 'Description' => $description, 'SinkSid' => $sinkSid, 'Types' => Serialize::map($types, function($e) { return Serialize::jsonObject($e); }), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new SubscriptionInstance($this->version, $payload); } /** * Constructs a SubscriptionContext * * @param string $sid A string that uniquely identifies this Subscription. */ public function getContext(string $sid): SubscriptionContext { return new SubscriptionContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Events.V1.SubscriptionList]'; } }src/Twilio/Rest/Events/V1/SchemaContext.php000064400000006226150515725670014552 0ustar00solution = ['id' => $id, ]; $this->uri = '/Schemas/' . \rawurlencode($id) . ''; } /** * Fetch the SchemaInstance * * @return SchemaInstance Fetched SchemaInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SchemaInstance { $payload = $this->version->fetch('GET', $this->uri); return new SchemaInstance($this->version, $payload, $this->solution['id']); } /** * Access the versions */ protected function getVersions(): SchemaVersionList { if (!$this->_versions) { $this->_versions = new SchemaVersionList($this->version, $this->solution['id']); } return $this->_versions; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Events.V1.SchemaContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Events/V1/Subscription/SubscribedEventPage.php000064400000002530150515725670020347 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SubscribedEventInstance \Twilio\Rest\Events\V1\Subscription\SubscribedEventInstance */ public function buildInstance(array $payload): SubscribedEventInstance { return new SubscribedEventInstance($this->version, $payload, $this->solution['subscriptionSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Events.V1.SubscribedEventPage]'; } }src/Twilio/Rest/Events/V1/Subscription/SubscribedEventContext.php000064400000005633150515725670021126 0ustar00solution = ['subscriptionSid' => $subscriptionSid, 'type' => $type, ]; $this->uri = '/Subscriptions/' . \rawurlencode($subscriptionSid) . '/SubscribedEvents/' . \rawurlencode($type) . ''; } /** * Fetch the SubscribedEventInstance * * @return SubscribedEventInstance Fetched SubscribedEventInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SubscribedEventInstance { $payload = $this->version->fetch('GET', $this->uri); return new SubscribedEventInstance( $this->version, $payload, $this->solution['subscriptionSid'], $this->solution['type'] ); } /** * Update the SubscribedEventInstance * * @param array|Options $options Optional Arguments * @return SubscribedEventInstance Updated SubscribedEventInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SubscribedEventInstance { $options = new Values($options); $data = Values::of(['SchemaVersion' => $options['schemaVersion'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new SubscribedEventInstance( $this->version, $payload, $this->solution['subscriptionSid'], $this->solution['type'] ); } /** * Delete the SubscribedEventInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Events.V1.SubscribedEventContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Events/V1/Subscription/SubscribedEventOptions.php000064400000006145150515725670021134 0ustar00options['schemaVersion'] = $schemaVersion; } /** * The schema version that the subscription should use. * * @param int $schemaVersion The schema version that the subscription should * use. * @return $this Fluent Builder */ public function setSchemaVersion(int $schemaVersion): self { $this->options['schemaVersion'] = $schemaVersion; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Events.V1.CreateSubscribedEventOptions ' . $options . ']'; } } class UpdateSubscribedEventOptions extends Options { /** * @param int $schemaVersion The schema version that the subscription should * use. */ public function __construct(int $schemaVersion = Values::NONE) { $this->options['schemaVersion'] = $schemaVersion; } /** * The schema version that the subscription should use. * * @param int $schemaVersion The schema version that the subscription should * use. * @return $this Fluent Builder */ public function setSchemaVersion(int $schemaVersion): self { $this->options['schemaVersion'] = $schemaVersion; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Events.V1.UpdateSubscribedEventOptions ' . $options . ']'; } }src/Twilio/Rest/Events/V1/Subscription/SubscribedEventList.php000064400000013365150515725670020416 0ustar00solution = ['subscriptionSid' => $subscriptionSid, ]; $this->uri = '/Subscriptions/' . \rawurlencode($subscriptionSid) . '/SubscribedEvents'; } /** * Streams SubscribedEventInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads SubscribedEventInstance 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 SubscribedEventInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of SubscribedEventInstance 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 SubscribedEventPage Page of SubscribedEventInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SubscribedEventPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new SubscribedEventPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of SubscribedEventInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return SubscribedEventPage Page of SubscribedEventInstance */ public function getPage(string $targetUrl): SubscribedEventPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new SubscribedEventPage($this->version, $response, $this->solution); } /** * Create the SubscribedEventInstance * * @param string $type Type of event being subscribed to. * @param array|Options $options Optional Arguments * @return SubscribedEventInstance Created SubscribedEventInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $type, array $options = []): SubscribedEventInstance { $options = new Values($options); $data = Values::of(['Type' => $type, 'SchemaVersion' => $options['schemaVersion'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new SubscribedEventInstance($this->version, $payload, $this->solution['subscriptionSid']); } /** * Constructs a SubscribedEventContext * * @param string $type Type of event being subscribed to. */ public function getContext(string $type): SubscribedEventContext { return new SubscribedEventContext($this->version, $this->solution['subscriptionSid'], $type); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Events.V1.SubscribedEventList]'; } }src/Twilio/Rest/Events/V1/Subscription/SubscribedEventInstance.php000064400000010111150515725670021231 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'type' => Values::array_get($payload, 'type'), 'schemaVersion' => Values::array_get($payload, 'schema_version'), 'subscriptionSid' => Values::array_get($payload, 'subscription_sid'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'subscriptionSid' => $subscriptionSid, 'type' => $type ?: $this->properties['type'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return SubscribedEventContext Context for this SubscribedEventInstance */ protected function proxy(): SubscribedEventContext { if (!$this->context) { $this->context = new SubscribedEventContext( $this->version, $this->solution['subscriptionSid'], $this->solution['type'] ); } return $this->context; } /** * Fetch the SubscribedEventInstance * * @return SubscribedEventInstance Fetched SubscribedEventInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SubscribedEventInstance { return $this->proxy()->fetch(); } /** * Update the SubscribedEventInstance * * @param array|Options $options Optional Arguments * @return SubscribedEventInstance Updated SubscribedEventInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SubscribedEventInstance { return $this->proxy()->update($options); } /** * Delete the SubscribedEventInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Events.V1.SubscribedEventInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Events/V1/SubscriptionInstance.php000064400000010605150515725670016152 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'sid' => Values::array_get($payload, 'sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'description' => Values::array_get($payload, 'description'), 'sinkSid' => Values::array_get($payload, 'sink_sid'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 SubscriptionContext Context for this SubscriptionInstance */ protected function proxy(): SubscriptionContext { if (!$this->context) { $this->context = new SubscriptionContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the SubscriptionInstance * * @return SubscriptionInstance Fetched SubscriptionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SubscriptionInstance { return $this->proxy()->fetch(); } /** * Update the SubscriptionInstance * * @param array|Options $options Optional Arguments * @return SubscriptionInstance Updated SubscriptionInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SubscriptionInstance { return $this->proxy()->update($options); } /** * Delete the SubscriptionInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the subscribedEvents */ protected function getSubscribedEvents(): SubscribedEventList { return $this->proxy()->subscribedEvents; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Events.V1.SubscriptionInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Events/V1/SinkList.php000064400000013504150515725670013542 0ustar00solution = []; $this->uri = '/Sinks'; } /** * Create the SinkInstance * * @param string $description Sink Description. * @param array $sinkConfiguration JSON Sink configuration. * @param string $sinkType Sink type. * @return SinkInstance Created SinkInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $description, array $sinkConfiguration, string $sinkType): SinkInstance { $data = Values::of([ 'Description' => $description, 'SinkConfiguration' => Serialize::jsonObject($sinkConfiguration), 'SinkType' => $sinkType, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new SinkInstance($this->version, $payload); } /** * Streams SinkInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads SinkInstance 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 SinkInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of SinkInstance 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 SinkPage Page of SinkInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SinkPage { $options = new Values($options); $params = Values::of([ 'InUse' => Serialize::booleanToString($options['inUse']), 'Status' => $options['status'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new SinkPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of SinkInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return SinkPage Page of SinkInstance */ public function getPage(string $targetUrl): SinkPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new SinkPage($this->version, $response, $this->solution); } /** * Constructs a SinkContext * * @param string $sid A string that uniquely identifies this Sink. */ public function getContext(string $sid): SinkContext { return new SinkContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Events.V1.SinkList]'; } }src/Twilio/Rest/Events/V1/SchemaList.php000064400000002072150515725670014034 0ustar00solution = []; } /** * Constructs a SchemaContext * * @param string $id The unique identifier of the schema. */ public function getContext(string $id): SchemaContext { return new SchemaContext($this->version, $id); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Events.V1.SchemaList]'; } }src/Twilio/Rest/Events/V1/SubscriptionPage.php000064400000002410150515725670015255 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SubscriptionInstance \Twilio\Rest\Events\V1\SubscriptionInstance */ public function buildInstance(array $payload): SubscriptionInstance { return new SubscriptionInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Events.V1.SubscriptionPage]'; } }src/Twilio/Rest/Events/V1/EventTypeOptions.php000064400000003043150515725670015276 0ustar00options['schemaId'] = $schemaId; } /** * A string parameter filtering the results to return only the Event Types using a given schema. * * @param string $schemaId A string to filter Event Types by schema. * @return $this Fluent Builder */ public function setSchemaId(string $schemaId): self { $this->options['schemaId'] = $schemaId; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Events.V1.ReadEventTypeOptions ' . $options . ']'; } }src/Twilio/Rest/Events/V1/Sink/SinkTestPage.php000064400000002422150515725670015244 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SinkTestInstance \Twilio\Rest\Events\V1\Sink\SinkTestInstance */ public function buildInstance(array $payload): SinkTestInstance { return new SinkTestInstance($this->version, $payload, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Events.V1.SinkTestPage]'; } }src/Twilio/Rest/Events/V1/Sink/SinkValidatePage.php000064400000002452150515725670016061 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SinkValidateInstance \Twilio\Rest\Events\V1\Sink\SinkValidateInstance */ public function buildInstance(array $payload): SinkValidateInstance { return new SinkValidateInstance($this->version, $payload, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Events.V1.SinkValidatePage]'; } }src/Twilio/Rest/Events/V1/Sink/SinkValidateInstance.php000064400000003430150515725670016746 0ustar00properties = ['result' => Values::array_get($payload, 'result'), ]; $this->solution = ['sid' => $sid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Events.V1.SinkValidateInstance]'; } }src/Twilio/Rest/Events/V1/Sink/SinkTestList.php000064400000002656150515725670015314 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Sinks/' . \rawurlencode($sid) . '/Test'; } /** * Create the SinkTestInstance * * @return SinkTestInstance Created SinkTestInstance * @throws TwilioException When an HTTP error occurs. */ public function create(): SinkTestInstance { $payload = $this->version->create('POST', $this->uri); return new SinkTestInstance($this->version, $payload, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Events.V1.SinkTestList]'; } }src/Twilio/Rest/Events/V1/Sink/SinkValidateList.php000064400000003250150515725670016115 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Sinks/' . \rawurlencode($sid) . '/Validate'; } /** * Create the SinkValidateInstance * * @param string $testId A string that uniquely identifies the test event for a * Sink being validated. * @return SinkValidateInstance Created SinkValidateInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $testId): SinkValidateInstance { $data = Values::of(['TestId' => $testId, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new SinkValidateInstance($this->version, $payload, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Events.V1.SinkValidateList]'; } }src/Twilio/Rest/Events/V1/Sink/SinkTestInstance.php000064400000003414150515725670016136 0ustar00properties = ['result' => Values::array_get($payload, 'result'), ]; $this->solution = ['sid' => $sid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Events.V1.SinkTestInstance]'; } }src/Twilio/Rest/Events/V1/SubscriptionContext.php000064400000010342150515725670016030 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Subscriptions/' . \rawurlencode($sid) . ''; } /** * Fetch the SubscriptionInstance * * @return SubscriptionInstance Fetched SubscriptionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SubscriptionInstance { $payload = $this->version->fetch('GET', $this->uri); return new SubscriptionInstance($this->version, $payload, $this->solution['sid']); } /** * Update the SubscriptionInstance * * @param array|Options $options Optional Arguments * @return SubscriptionInstance Updated SubscriptionInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SubscriptionInstance { $options = new Values($options); $data = Values::of(['Description' => $options['description'], 'SinkSid' => $options['sinkSid'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new SubscriptionInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the SubscriptionInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the subscribedEvents */ protected function getSubscribedEvents(): SubscribedEventList { if (!$this->_subscribedEvents) { $this->_subscribedEvents = new SubscribedEventList($this->version, $this->solution['sid']); } return $this->_subscribedEvents; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Events.V1.SubscriptionContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Events/V1/EventTypeContext.php000064400000003134150515725670015270 0ustar00solution = ['type' => $type, ]; $this->uri = '/Types/' . \rawurlencode($type) . ''; } /** * Fetch the EventTypeInstance * * @return EventTypeInstance Fetched EventTypeInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): EventTypeInstance { $payload = $this->version->fetch('GET', $this->uri); return new EventTypeInstance($this->version, $payload, $this->solution['type']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Events.V1.EventTypeContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Events/V1/SinkInstance.php000064400000011023150515725670014365 0ustar00properties = [ 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'description' => Values::array_get($payload, 'description'), 'sid' => Values::array_get($payload, 'sid'), 'sinkConfiguration' => Values::array_get($payload, 'sink_configuration'), 'sinkType' => Values::array_get($payload, 'sink_type'), 'status' => Values::array_get($payload, 'status'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 SinkContext Context for this SinkInstance */ protected function proxy(): SinkContext { if (!$this->context) { $this->context = new SinkContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the SinkInstance * * @return SinkInstance Fetched SinkInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SinkInstance { return $this->proxy()->fetch(); } /** * Delete the SinkInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the SinkInstance * * @param string $description Sink Description * @return SinkInstance Updated SinkInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $description): SinkInstance { return $this->proxy()->update($description); } /** * Access the sinkTest */ protected function getSinkTest(): SinkTestList { return $this->proxy()->sinkTest; } /** * Access the sinkValidate */ protected function getSinkValidate(): SinkValidateList { return $this->proxy()->sinkValidate; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Events.V1.SinkInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Events/V1/SinkContext.php000064400000010325150515725670014251 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Sinks/' . \rawurlencode($sid) . ''; } /** * Fetch the SinkInstance * * @return SinkInstance Fetched SinkInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SinkInstance { $payload = $this->version->fetch('GET', $this->uri); return new SinkInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the SinkInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the SinkInstance * * @param string $description Sink Description * @return SinkInstance Updated SinkInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $description): SinkInstance { $data = Values::of(['Description' => $description, ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new SinkInstance($this->version, $payload, $this->solution['sid']); } /** * Access the sinkTest */ protected function getSinkTest(): SinkTestList { if (!$this->_sinkTest) { $this->_sinkTest = new SinkTestList($this->version, $this->solution['sid']); } return $this->_sinkTest; } /** * Access the sinkValidate */ protected function getSinkValidate(): SinkValidateList { if (!$this->_sinkValidate) { $this->_sinkValidate = new SinkValidateList($this->version, $this->solution['sid']); } return $this->_sinkValidate; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Events.V1.SinkContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Events/V1/Schema/SchemaVersionContext.php000064400000003544150515725670017320 0ustar00solution = ['id' => $id, 'schemaVersion' => $schemaVersion, ]; $this->uri = '/Schemas/' . \rawurlencode($id) . '/Versions/' . \rawurlencode($schemaVersion) . ''; } /** * Fetch the SchemaVersionInstance * * @return SchemaVersionInstance Fetched SchemaVersionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SchemaVersionInstance { $payload = $this->version->fetch('GET', $this->uri); return new SchemaVersionInstance( $this->version, $payload, $this->solution['id'], $this->solution['schemaVersion'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Events.V1.SchemaVersionContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Events/V1/Schema/SchemaVersionList.php000064400000011572150515725670016607 0ustar00solution = ['id' => $id, ]; $this->uri = '/Schemas/' . \rawurlencode($id) . '/Versions'; } /** * Streams SchemaVersionInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads SchemaVersionInstance 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 SchemaVersionInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of SchemaVersionInstance 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 SchemaVersionPage Page of SchemaVersionInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SchemaVersionPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new SchemaVersionPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of SchemaVersionInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return SchemaVersionPage Page of SchemaVersionInstance */ public function getPage(string $targetUrl): SchemaVersionPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new SchemaVersionPage($this->version, $response, $this->solution); } /** * Constructs a SchemaVersionContext * * @param int $schemaVersion The version of the schema */ public function getContext(int $schemaVersion): SchemaVersionContext { return new SchemaVersionContext($this->version, $this->solution['id'], $schemaVersion); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Events.V1.SchemaVersionList]'; } }src/Twilio/Rest/Events/V1/Schema/SchemaVersionPage.php000064400000002463150515725670016547 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SchemaVersionInstance \Twilio\Rest\Events\V1\Schema\SchemaVersionInstance */ public function buildInstance(array $payload): SchemaVersionInstance { return new SchemaVersionInstance($this->version, $payload, $this->solution['id']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Events.V1.SchemaVersionPage]'; } }src/Twilio/Rest/Events/V1/Schema/SchemaVersionInstance.php000064400000006622150515725670017440 0ustar00properties = [ 'id' => Values::array_get($payload, 'id'), 'schemaVersion' => Values::array_get($payload, 'schema_version'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'url' => Values::array_get($payload, 'url'), 'raw' => Values::array_get($payload, 'raw'), ]; $this->solution = [ 'id' => $id, 'schemaVersion' => $schemaVersion ?: $this->properties['schemaVersion'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return SchemaVersionContext Context for this SchemaVersionInstance */ protected function proxy(): SchemaVersionContext { if (!$this->context) { $this->context = new SchemaVersionContext( $this->version, $this->solution['id'], $this->solution['schemaVersion'] ); } return $this->context; } /** * Fetch the SchemaVersionInstance * * @return SchemaVersionInstance Fetched SchemaVersionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SchemaVersionInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Events.V1.SchemaVersionInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Events/V1.php000064400000006377150515725670012014 0ustar00version = 'v1'; } protected function getEventTypes(): EventTypeList { if (!$this->_eventTypes) { $this->_eventTypes = new EventTypeList($this); } return $this->_eventTypes; } protected function getSchemas(): SchemaList { if (!$this->_schemas) { $this->_schemas = new SchemaList($this); } return $this->_schemas; } protected function getSinks(): SinkList { if (!$this->_sinks) { $this->_sinks = new SinkList($this); } return $this->_sinks; } protected function getSubscriptions(): SubscriptionList { if (!$this->_subscriptions) { $this->_subscriptions = new SubscriptionList($this); } return $this->_subscriptions; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Events.V1]'; } }src/Twilio/Rest/Messaging/V1/DeactivationsContext.php000064400000003174150515725670016617 0ustar00solution = []; $this->uri = '/Deactivations'; } /** * Fetch the DeactivationsInstance * * @param array|Options $options Optional Arguments * @return DeactivationsInstance Fetched DeactivationsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): DeactivationsInstance { $options = new Values($options); $params = Values::of(['Date' => Serialize::iso8601Date($options['date']), ]); $payload = $this->version->fetch('GET', $this->uri, $params); return new DeactivationsInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Messaging.V1.DeactivationsContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Messaging/V1/ServiceInstance.php000064400000016074150515725670015545 0ustar00properties = [ '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')), 'inboundRequestUrl' => Values::array_get($payload, 'inbound_request_url'), 'inboundMethod' => Values::array_get($payload, 'inbound_method'), 'fallbackUrl' => Values::array_get($payload, 'fallback_url'), 'fallbackMethod' => Values::array_get($payload, 'fallback_method'), 'statusCallback' => Values::array_get($payload, 'status_callback'), 'stickySender' => Values::array_get($payload, 'sticky_sender'), 'mmsConverter' => Values::array_get($payload, 'mms_converter'), 'smartEncoding' => Values::array_get($payload, 'smart_encoding'), 'scanMessageContent' => Values::array_get($payload, 'scan_message_content'), 'fallbackToLongCode' => Values::array_get($payload, 'fallback_to_long_code'), 'areaCodeGeomatch' => Values::array_get($payload, 'area_code_geomatch'), 'synchronousValidation' => Values::array_get($payload, 'synchronous_validation'), 'validityPeriod' => Values::array_get($payload, 'validity_period'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), 'usecase' => Values::array_get($payload, 'usecase'), 'usAppToPersonRegistered' => Values::array_get($payload, 'us_app_to_person_registered'), 'useInboundWebhookOnNumber' => Values::array_get($payload, 'use_inbound_webhook_on_number'), ]; $this->solution = ['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 ServiceContext Context for this ServiceInstance */ protected function proxy(): ServiceContext { if (!$this->context) { $this->context = new ServiceContext($this->version, $this->solution['sid']); } return $this->context; } /** * Update the ServiceInstance * * @param array|Options $options Optional Arguments * @return ServiceInstance Updated ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ServiceInstance { return $this->proxy()->update($options); } /** * Fetch the ServiceInstance * * @return ServiceInstance Fetched ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ServiceInstance { return $this->proxy()->fetch(); } /** * Delete the ServiceInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the phoneNumbers */ protected function getPhoneNumbers(): PhoneNumberList { return $this->proxy()->phoneNumbers; } /** * Access the shortCodes */ protected function getShortCodes(): ShortCodeList { return $this->proxy()->shortCodes; } /** * Access the alphaSenders */ protected function getAlphaSenders(): AlphaSenderList { return $this->proxy()->alphaSenders; } /** * Access the usAppToPerson */ protected function getUsAppToPerson(): UsAppToPersonList { return $this->proxy()->usAppToPerson; } /** * Access the usAppToPersonUsecases */ protected function getUsAppToPersonUsecases(): UsAppToPersonUsecaseList { return $this->proxy()->usAppToPersonUsecases; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Messaging.V1.ServiceInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Messaging/V1/BrandRegistrationList.php000064400000013767150515725670016743 0ustar00solution = []; $this->uri = '/a2p/BrandRegistrations'; } /** * Streams BrandRegistrationInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads BrandRegistrationInstance 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 BrandRegistrationInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of BrandRegistrationInstance 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 BrandRegistrationPage Page of BrandRegistrationInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): BrandRegistrationPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new BrandRegistrationPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of BrandRegistrationInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return BrandRegistrationPage Page of BrandRegistrationInstance */ public function getPage(string $targetUrl): BrandRegistrationPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new BrandRegistrationPage($this->version, $response, $this->solution); } /** * Create the BrandRegistrationInstance * * @param string $customerProfileBundleSid Customer Profile Bundle Sid * @param string $a2PProfileBundleSid A2P Messaging Profile Bundle Sid * @param array|Options $options Optional Arguments * @return BrandRegistrationInstance Created BrandRegistrationInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $customerProfileBundleSid, string $a2PProfileBundleSid, array $options = []): BrandRegistrationInstance { $options = new Values($options); $data = Values::of([ 'CustomerProfileBundleSid' => $customerProfileBundleSid, 'A2PProfileBundleSid' => $a2PProfileBundleSid, 'BrandType' => $options['brandType'], 'Mock' => Serialize::booleanToString($options['mock']), 'SkipAutomaticSecVet' => Serialize::booleanToString($options['skipAutomaticSecVet']), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new BrandRegistrationInstance($this->version, $payload); } /** * Constructs a BrandRegistrationContext * * @param string $sid The SID that identifies the resource to fetch */ public function getContext(string $sid): BrandRegistrationContext { return new BrandRegistrationContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Messaging.V1.BrandRegistrationList]'; } }src/Twilio/Rest/Messaging/V1/DeactivationsPage.php000064400000002246150515725670016046 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return DeactivationsInstance \Twilio\Rest\Messaging\V1\DeactivationsInstance */ public function buildInstance(array $payload): DeactivationsInstance { return new DeactivationsInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Messaging.V1.DeactivationsPage]'; } }src/Twilio/Rest/Messaging/V1/BrandRegistrationPage.php000064400000002457150515725670016676 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return BrandRegistrationInstance \Twilio\Rest\Messaging\V1\BrandRegistrationInstance */ public function buildInstance(array $payload): BrandRegistrationInstance { return new BrandRegistrationInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Messaging.V1.BrandRegistrationPage]'; } }src/Twilio/Rest/Messaging/V1/Service/UsAppToPersonUsecaseInstance.php000064400000003754150515725670021601 0ustar00properties = [ 'usAppToPersonUsecases' => Values::array_get($payload, 'us_app_to_person_usecases'), ]; $this->solution = ['messagingServiceSid' => $messagingServiceSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Messaging.V1.UsAppToPersonUsecaseInstance]'; } }src/Twilio/Rest/Messaging/V1/Service/AlphaSenderPage.php000064400000002472150515725670017040 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return AlphaSenderInstance \Twilio\Rest\Messaging\V1\Service\AlphaSenderInstance */ public function buildInstance(array $payload): AlphaSenderInstance { return new AlphaSenderInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Messaging.V1.AlphaSenderPage]'; } }src/Twilio/Rest/Messaging/V1/Service/ShortCodeInstance.php000064400000010150150515725670017424 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'shortCode' => Values::array_get($payload, 'short_code'), 'countryCode' => Values::array_get($payload, 'country_code'), 'capabilities' => Values::array_get($payload, 'capabilities'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return ShortCodeContext Context for this ShortCodeInstance */ protected function proxy(): ShortCodeContext { if (!$this->context) { $this->context = new ShortCodeContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Delete the ShortCodeInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Fetch the ShortCodeInstance * * @return ShortCodeInstance Fetched ShortCodeInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ShortCodeInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Messaging.V1.ShortCodeInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Messaging/V1/Service/PhoneNumberContext.php000064400000004225150515725670017642 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/PhoneNumbers/' . \rawurlencode($sid) . ''; } /** * Delete the PhoneNumberInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Fetch the PhoneNumberInstance * * @return PhoneNumberInstance Fetched PhoneNumberInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): PhoneNumberInstance { $payload = $this->version->fetch('GET', $this->uri); return new PhoneNumberInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Messaging.V1.PhoneNumberContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Messaging/V1/Service/UsAppToPersonUsecaseOptions.php000064400000003253150515725670021462 0ustar00options['brandRegistrationSid'] = $brandRegistrationSid; } /** * The unique string to identify the A2P brand. * * @param string $brandRegistrationSid A2P Brand Registration SID * @return $this Fluent Builder */ public function setBrandRegistrationSid(string $brandRegistrationSid): self { $this->options['brandRegistrationSid'] = $brandRegistrationSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Messaging.V1.FetchUsAppToPersonUsecaseOptions ' . $options . ']'; } }src/Twilio/Rest/Messaging/V1/Service/UsAppToPersonUsecasePage.php000064400000002647150515725670020711 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return UsAppToPersonUsecaseInstance \Twilio\Rest\Messaging\V1\Service\UsAppToPersonUsecaseInstance */ public function buildInstance(array $payload): UsAppToPersonUsecaseInstance { return new UsAppToPersonUsecaseInstance( $this->version, $payload, $this->solution['messagingServiceSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Messaging.V1.UsAppToPersonUsecasePage]'; } }src/Twilio/Rest/Messaging/V1/Service/AlphaSenderInstance.php000064400000010033150515725670017720 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'alphaSender' => Values::array_get($payload, 'alpha_sender'), 'capabilities' => Values::array_get($payload, 'capabilities'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return AlphaSenderContext Context for this AlphaSenderInstance */ protected function proxy(): AlphaSenderContext { if (!$this->context) { $this->context = new AlphaSenderContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the AlphaSenderInstance * * @return AlphaSenderInstance Fetched AlphaSenderInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AlphaSenderInstance { return $this->proxy()->fetch(); } /** * Delete the AlphaSenderInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Messaging.V1.AlphaSenderInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Messaging/V1/Service/PhoneNumberPage.php000064400000002472150515725670017074 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return PhoneNumberInstance \Twilio\Rest\Messaging\V1\Service\PhoneNumberInstance */ public function buildInstance(array $payload): PhoneNumberInstance { return new PhoneNumberInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Messaging.V1.PhoneNumberPage]'; } }src/Twilio/Rest/Messaging/V1/Service/AlphaSenderList.php000064400000013037150515725670017076 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/AlphaSenders'; } /** * Create the AlphaSenderInstance * * @param string $alphaSender The Alphanumeric Sender ID string * @return AlphaSenderInstance Created AlphaSenderInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $alphaSender): AlphaSenderInstance { $data = Values::of(['AlphaSender' => $alphaSender, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new AlphaSenderInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Streams AlphaSenderInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads AlphaSenderInstance 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 AlphaSenderInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of AlphaSenderInstance 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 AlphaSenderPage Page of AlphaSenderInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): AlphaSenderPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new AlphaSenderPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of AlphaSenderInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return AlphaSenderPage Page of AlphaSenderInstance */ public function getPage(string $targetUrl): AlphaSenderPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new AlphaSenderPage($this->version, $response, $this->solution); } /** * Constructs a AlphaSenderContext * * @param string $sid The SID that identifies the resource to fetch */ public function getContext(string $sid): AlphaSenderContext { return new AlphaSenderContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Messaging.V1.AlphaSenderList]'; } }src/Twilio/Rest/Messaging/V1/Service/UsAppToPersonInstance.php000064400000012400150515725670020254 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'brandRegistrationSid' => Values::array_get($payload, 'brand_registration_sid'), 'messagingServiceSid' => Values::array_get($payload, 'messaging_service_sid'), 'description' => Values::array_get($payload, 'description'), 'messageSamples' => Values::array_get($payload, 'message_samples'), 'usAppToPersonUsecase' => Values::array_get($payload, 'us_app_to_person_usecase'), 'hasEmbeddedLinks' => Values::array_get($payload, 'has_embedded_links'), 'hasEmbeddedPhone' => Values::array_get($payload, 'has_embedded_phone'), 'campaignStatus' => Values::array_get($payload, 'campaign_status'), 'campaignId' => Values::array_get($payload, 'campaign_id'), 'isExternallyRegistered' => Values::array_get($payload, 'is_externally_registered'), 'rateLimits' => Values::array_get($payload, 'rate_limits'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'url' => Values::array_get($payload, 'url'), 'mock' => Values::array_get($payload, 'mock'), ]; $this->solution = [ 'messagingServiceSid' => $messagingServiceSid, '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 UsAppToPersonContext Context for this UsAppToPersonInstance */ protected function proxy(): UsAppToPersonContext { if (!$this->context) { $this->context = new UsAppToPersonContext( $this->version, $this->solution['messagingServiceSid'], $this->solution['sid'] ); } return $this->context; } /** * Delete the UsAppToPersonInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Fetch the UsAppToPersonInstance * * @return UsAppToPersonInstance Fetched UsAppToPersonInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): UsAppToPersonInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Messaging.V1.UsAppToPersonInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Messaging/V1/Service/AlphaSenderContext.php000064400000004300150515725670017600 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/AlphaSenders/' . \rawurlencode($sid) . ''; } /** * Fetch the AlphaSenderInstance * * @return AlphaSenderInstance Fetched AlphaSenderInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AlphaSenderInstance { $payload = $this->version->fetch('GET', $this->uri); return new AlphaSenderInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Delete the AlphaSenderInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Messaging.V1.AlphaSenderContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Messaging/V1/Service/UsAppToPersonContext.php000064400000004501150515725670020137 0ustar00solution = ['messagingServiceSid' => $messagingServiceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($messagingServiceSid) . '/Compliance/Usa2p/' . \rawurlencode($sid) . ''; } /** * Delete the UsAppToPersonInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Fetch the UsAppToPersonInstance * * @return UsAppToPersonInstance Fetched UsAppToPersonInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): UsAppToPersonInstance { $payload = $this->version->fetch('GET', $this->uri); return new UsAppToPersonInstance( $this->version, $payload, $this->solution['messagingServiceSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Messaging.V1.UsAppToPersonContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Messaging/V1/Service/ShortCodeContext.php000064400000004201150515725670017304 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/ShortCodes/' . \rawurlencode($sid) . ''; } /** * Delete the ShortCodeInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Fetch the ShortCodeInstance * * @return ShortCodeInstance Fetched ShortCodeInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ShortCodeInstance { $payload = $this->version->fetch('GET', $this->uri); return new ShortCodeInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Messaging.V1.ShortCodeContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Messaging/V1/Service/ShortCodePage.php000064400000002456150515725670016546 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ShortCodeInstance \Twilio\Rest\Messaging\V1\Service\ShortCodeInstance */ public function buildInstance(array $payload): ShortCodeInstance { return new ShortCodeInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Messaging.V1.ShortCodePage]'; } }src/Twilio/Rest/Messaging/V1/Service/UsAppToPersonUsecaseList.php000064400000003726150515725670020747 0ustar00solution = ['messagingServiceSid' => $messagingServiceSid, ]; $this->uri = '/Services/' . \rawurlencode($messagingServiceSid) . '/Compliance/Usa2p/Usecases'; } /** * Fetch the UsAppToPersonUsecaseInstance * * @param array|Options $options Optional Arguments * @return UsAppToPersonUsecaseInstance Fetched UsAppToPersonUsecaseInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): UsAppToPersonUsecaseInstance { $options = new Values($options); $params = Values::of(['BrandRegistrationSid' => $options['brandRegistrationSid'], ]); $payload = $this->version->fetch('GET', $this->uri, $params); return new UsAppToPersonUsecaseInstance( $this->version, $payload, $this->solution['messagingServiceSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Messaging.V1.UsAppToPersonUsecaseList]'; } }src/Twilio/Rest/Messaging/V1/Service/UsAppToPersonList.php000064400000015356150515725670017440 0ustar00solution = ['messagingServiceSid' => $messagingServiceSid, ]; $this->uri = '/Services/' . \rawurlencode($messagingServiceSid) . '/Compliance/Usa2p'; } /** * Create the UsAppToPersonInstance * * @param string $brandRegistrationSid A2P Brand Registration SID * @param string $description A short description of what this SMS campaign does * @param string[] $messageSamples Message samples * @param string $usAppToPersonUsecase A2P Campaign Use Case. * @param bool $hasEmbeddedLinks Indicates that this SMS campaign will send * messages that contain links * @param bool $hasEmbeddedPhone Indicates that this SMS campaign will send * messages that contain phone numbers * @return UsAppToPersonInstance Created UsAppToPersonInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $brandRegistrationSid, string $description, array $messageSamples, string $usAppToPersonUsecase, bool $hasEmbeddedLinks, bool $hasEmbeddedPhone): UsAppToPersonInstance { $data = Values::of([ 'BrandRegistrationSid' => $brandRegistrationSid, 'Description' => $description, 'MessageSamples' => Serialize::map($messageSamples, function($e) { return $e; }), 'UsAppToPersonUsecase' => $usAppToPersonUsecase, 'HasEmbeddedLinks' => Serialize::booleanToString($hasEmbeddedLinks), 'HasEmbeddedPhone' => Serialize::booleanToString($hasEmbeddedPhone), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new UsAppToPersonInstance($this->version, $payload, $this->solution['messagingServiceSid']); } /** * Streams UsAppToPersonInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads UsAppToPersonInstance 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 UsAppToPersonInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of UsAppToPersonInstance 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 UsAppToPersonPage Page of UsAppToPersonInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): UsAppToPersonPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new UsAppToPersonPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of UsAppToPersonInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return UsAppToPersonPage Page of UsAppToPersonInstance */ public function getPage(string $targetUrl): UsAppToPersonPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new UsAppToPersonPage($this->version, $response, $this->solution); } /** * Constructs a UsAppToPersonContext * * @param string $sid The SID that identifies the US A2P Compliance resource to * fetch */ public function getContext(string $sid): UsAppToPersonContext { return new UsAppToPersonContext($this->version, $this->solution['messagingServiceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Messaging.V1.UsAppToPersonList]'; } }src/Twilio/Rest/Messaging/V1/Service/ShortCodeList.php000064400000013046150515725670016602 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/ShortCodes'; } /** * Create the ShortCodeInstance * * @param string $shortCodeSid The SID of the ShortCode being added to the * Service * @return ShortCodeInstance Created ShortCodeInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $shortCodeSid): ShortCodeInstance { $data = Values::of(['ShortCodeSid' => $shortCodeSid, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ShortCodeInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Streams ShortCodeInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ShortCodeInstance 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 ShortCodeInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of ShortCodeInstance 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 ShortCodePage Page of ShortCodeInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ShortCodePage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ShortCodePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ShortCodeInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ShortCodePage Page of ShortCodeInstance */ public function getPage(string $targetUrl): ShortCodePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ShortCodePage($this->version, $response, $this->solution); } /** * Constructs a ShortCodeContext * * @param string $sid The SID that identifies the resource to fetch */ public function getContext(string $sid): ShortCodeContext { return new ShortCodeContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Messaging.V1.ShortCodeList]'; } }src/Twilio/Rest/Messaging/V1/Service/PhoneNumberInstance.php000064400000010206150515725670017756 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'phoneNumber' => Values::array_get($payload, 'phone_number'), 'countryCode' => Values::array_get($payload, 'country_code'), 'capabilities' => Values::array_get($payload, 'capabilities'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return PhoneNumberContext Context for this PhoneNumberInstance */ protected function proxy(): PhoneNumberContext { if (!$this->context) { $this->context = new PhoneNumberContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Delete the PhoneNumberInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Fetch the PhoneNumberInstance * * @return PhoneNumberInstance Fetched PhoneNumberInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): PhoneNumberInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Messaging.V1.PhoneNumberInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Messaging/V1/Service/UsAppToPersonPage.php000064400000002517150515725670017374 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return UsAppToPersonInstance \Twilio\Rest\Messaging\V1\Service\UsAppToPersonInstance */ public function buildInstance(array $payload): UsAppToPersonInstance { return new UsAppToPersonInstance($this->version, $payload, $this->solution['messagingServiceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Messaging.V1.UsAppToPersonPage]'; } }src/Twilio/Rest/Messaging/V1/Service/PhoneNumberList.php000064400000013145150515725670017132 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/PhoneNumbers'; } /** * Create the PhoneNumberInstance * * @param string $phoneNumberSid The SID of the Phone Number being added to the * Service * @return PhoneNumberInstance Created PhoneNumberInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $phoneNumberSid): PhoneNumberInstance { $data = Values::of(['PhoneNumberSid' => $phoneNumberSid, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new PhoneNumberInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Streams PhoneNumberInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads PhoneNumberInstance 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 PhoneNumberInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of PhoneNumberInstance 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 PhoneNumberPage Page of PhoneNumberInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): PhoneNumberPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new PhoneNumberPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of PhoneNumberInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return PhoneNumberPage Page of PhoneNumberInstance */ public function getPage(string $targetUrl): PhoneNumberPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new PhoneNumberPage($this->version, $response, $this->solution); } /** * Constructs a PhoneNumberContext * * @param string $sid The SID that identifies the resource to fetch */ public function getContext(string $sid): PhoneNumberContext { return new PhoneNumberContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Messaging.V1.PhoneNumberList]'; } }src/Twilio/Rest/Messaging/V1/UsecaseInstance.php000064400000003256150515725670015533 0ustar00properties = ['usecases' => Values::array_get($payload, 'usecases'), ]; $this->solution = []; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Messaging.V1.UsecaseInstance]'; } }src/Twilio/Rest/Messaging/V1/BrandRegistrationOptions.php000064400000007206150515725670017452 0ustar00options['brandType'] = $brandType; $this->options['mock'] = $mock; $this->options['skipAutomaticSecVet'] = $skipAutomaticSecVet; } /** * Type of brand being created. One of: "STANDARD", "STARTER". STARTER is for low volume, starter use cases. STANDARD is for all other use cases. * * @param string $brandType Type of brand being created. One of: "STANDARD", * "STARTER". * @return $this Fluent Builder */ public function setBrandType(string $brandType): self { $this->options['brandType'] = $brandType; return $this; } /** * A boolean that specifies whether brand should be a mock or not. If true, brand will be registered as a mock brand. Defaults to false if no value is provided. * * @param bool $mock A boolean that specifies whether brand should be a mock or * not. If true, brand will be registered as a mock brand. * Defaults to false if no value is provided. * @return $this Fluent Builder */ public function setMock(bool $mock): self { $this->options['mock'] = $mock; return $this; } /** * A flag to disable automatic secondary vetting for brands which it would otherwise be done. * * @param bool $skipAutomaticSecVet Skip Automatic Secondary Vetting * @return $this Fluent Builder */ public function setSkipAutomaticSecVet(bool $skipAutomaticSecVet): self { $this->options['skipAutomaticSecVet'] = $skipAutomaticSecVet; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Messaging.V1.CreateBrandRegistrationOptions ' . $options . ']'; } }src/Twilio/Rest/Messaging/V1/BrandRegistrationContext.php000064400000006527150515725670017450 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/a2p/BrandRegistrations/' . \rawurlencode($sid) . ''; } /** * Fetch the BrandRegistrationInstance * * @return BrandRegistrationInstance Fetched BrandRegistrationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): BrandRegistrationInstance { $payload = $this->version->fetch('GET', $this->uri); return new BrandRegistrationInstance($this->version, $payload, $this->solution['sid']); } /** * Access the brandVettings */ protected function getBrandVettings(): BrandVettingList { if (!$this->_brandVettings) { $this->_brandVettings = new BrandVettingList($this->version, $this->solution['sid']); } return $this->_brandVettings; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Messaging.V1.BrandRegistrationContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Messaging/V1/DeactivationsOptions.php000064400000003032150515725670016617 0ustar00options['date'] = $date; } /** * The request will return a list of all United States Phone Numbers that were deactivated on the day specified by this parameter. This date should be specified in YYYY-MM-DD format. * * @param \DateTime $date The date to retrieve deactivated numbers for. * @return $this Fluent Builder */ public function setDate(\DateTime $date): self { $this->options['date'] = $date; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Messaging.V1.FetchDeactivationsOptions ' . $options . ']'; } }src/Twilio/Rest/Messaging/V1/ServiceContext.php000064400000016375150515725670015431 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($sid) . ''; } /** * Update the ServiceInstance * * @param array|Options $options Optional Arguments * @return ServiceInstance Updated ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ServiceInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'InboundRequestUrl' => $options['inboundRequestUrl'], 'InboundMethod' => $options['inboundMethod'], 'FallbackUrl' => $options['fallbackUrl'], 'FallbackMethod' => $options['fallbackMethod'], 'StatusCallback' => $options['statusCallback'], 'StickySender' => Serialize::booleanToString($options['stickySender']), 'MmsConverter' => Serialize::booleanToString($options['mmsConverter']), 'SmartEncoding' => Serialize::booleanToString($options['smartEncoding']), 'ScanMessageContent' => $options['scanMessageContent'], 'FallbackToLongCode' => Serialize::booleanToString($options['fallbackToLongCode']), 'AreaCodeGeomatch' => Serialize::booleanToString($options['areaCodeGeomatch']), 'ValidityPeriod' => $options['validityPeriod'], 'SynchronousValidation' => Serialize::booleanToString($options['synchronousValidation']), 'Usecase' => $options['usecase'], 'UseInboundWebhookOnNumber' => Serialize::booleanToString($options['useInboundWebhookOnNumber']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ServiceInstance($this->version, $payload, $this->solution['sid']); } /** * Fetch the ServiceInstance * * @return ServiceInstance Fetched ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ServiceInstance { $payload = $this->version->fetch('GET', $this->uri); return new ServiceInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the ServiceInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the phoneNumbers */ protected function getPhoneNumbers(): PhoneNumberList { if (!$this->_phoneNumbers) { $this->_phoneNumbers = new PhoneNumberList($this->version, $this->solution['sid']); } return $this->_phoneNumbers; } /** * Access the shortCodes */ protected function getShortCodes(): ShortCodeList { if (!$this->_shortCodes) { $this->_shortCodes = new ShortCodeList($this->version, $this->solution['sid']); } return $this->_shortCodes; } /** * Access the alphaSenders */ protected function getAlphaSenders(): AlphaSenderList { if (!$this->_alphaSenders) { $this->_alphaSenders = new AlphaSenderList($this->version, $this->solution['sid']); } return $this->_alphaSenders; } /** * Access the usAppToPerson */ protected function getUsAppToPerson(): UsAppToPersonList { if (!$this->_usAppToPerson) { $this->_usAppToPerson = new UsAppToPersonList($this->version, $this->solution['sid']); } return $this->_usAppToPerson; } /** * Access the usAppToPersonUsecases */ protected function getUsAppToPersonUsecases(): UsAppToPersonUsecaseList { if (!$this->_usAppToPersonUsecases) { $this->_usAppToPersonUsecases = new UsAppToPersonUsecaseList( $this->version, $this->solution['sid'] ); } return $this->_usAppToPersonUsecases; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Messaging.V1.ServiceContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Messaging/V1/BrandRegistrationInstance.php000064400000011777150515725670017573 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'customerProfileBundleSid' => Values::array_get($payload, 'customer_profile_bundle_sid'), 'a2PProfileBundleSid' => Values::array_get($payload, 'a2p_profile_bundle_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'brandType' => Values::array_get($payload, 'brand_type'), 'status' => Values::array_get($payload, 'status'), 'tcrId' => Values::array_get($payload, 'tcr_id'), 'failureReason' => Values::array_get($payload, 'failure_reason'), 'url' => Values::array_get($payload, 'url'), 'brandScore' => Values::array_get($payload, 'brand_score'), 'brandFeedback' => Values::array_get($payload, 'brand_feedback'), 'identityStatus' => Values::array_get($payload, 'identity_status'), 'russell3000' => Values::array_get($payload, 'russell_3000'), 'taxExemptStatus' => Values::array_get($payload, 'tax_exempt_status'), 'skipAutomaticSecVet' => Values::array_get($payload, 'skip_automatic_sec_vet'), 'mock' => Values::array_get($payload, 'mock'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 BrandRegistrationContext Context for this BrandRegistrationInstance */ protected function proxy(): BrandRegistrationContext { if (!$this->context) { $this->context = new BrandRegistrationContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the BrandRegistrationInstance * * @return BrandRegistrationInstance Fetched BrandRegistrationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): BrandRegistrationInstance { return $this->proxy()->fetch(); } /** * Access the brandVettings */ protected function getBrandVettings(): BrandVettingList { return $this->proxy()->brandVettings; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Messaging.V1.BrandRegistrationInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Messaging/V1/ServiceOptions.php000064400000104630150515725670015430 0ustar00options['inboundRequestUrl'] = $inboundRequestUrl; $this->options['inboundMethod'] = $inboundMethod; $this->options['fallbackUrl'] = $fallbackUrl; $this->options['fallbackMethod'] = $fallbackMethod; $this->options['statusCallback'] = $statusCallback; $this->options['stickySender'] = $stickySender; $this->options['mmsConverter'] = $mmsConverter; $this->options['smartEncoding'] = $smartEncoding; $this->options['scanMessageContent'] = $scanMessageContent; $this->options['fallbackToLongCode'] = $fallbackToLongCode; $this->options['areaCodeGeomatch'] = $areaCodeGeomatch; $this->options['validityPeriod'] = $validityPeriod; $this->options['synchronousValidation'] = $synchronousValidation; $this->options['usecase'] = $usecase; $this->options['useInboundWebhookOnNumber'] = $useInboundWebhookOnNumber; } /** * The URL we call using `inbound_method` when a message is received by any phone number or short code in the Service. When this property is `null`, receiving inbound messages is disabled. All messages sent to the Twilio phone number or short code will not be logged and received on the Account. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `inbound_request_url` defined for the Messaging Service. * * @param string $inboundRequestUrl The URL we call using inbound_method when a * message is received by any phone number or * short code in the Service. This field will * be overridden if the * `use_inbound_webhook_on_number` field is * enabled. * @return $this Fluent Builder */ public function setInboundRequestUrl(string $inboundRequestUrl): self { $this->options['inboundRequestUrl'] = $inboundRequestUrl; return $this; } /** * The HTTP method we should use to call `inbound_request_url`. Can be `GET` or `POST` and the default is `POST`. * * @param string $inboundMethod The HTTP method we should use to call * inbound_request_url * @return $this Fluent Builder */ public function setInboundMethod(string $inboundMethod): self { $this->options['inboundMethod'] = $inboundMethod; return $this; } /** * The URL that we call using `fallback_method` if an error occurs while retrieving or executing the TwiML from the Inbound Request URL. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `fallback_url` defined for the Messaging Service. * * @param string $fallbackUrl The URL that we call using fallback_method if an * error occurs while retrieving or executing the * TwiML from the Inbound Request URL. This field * will be overridden if the * `use_inbound_webhook_on_number` field is enabled. * @return $this Fluent Builder */ public function setFallbackUrl(string $fallbackUrl): self { $this->options['fallbackUrl'] = $fallbackUrl; return $this; } /** * The HTTP method we should use to call `fallback_url`. Can be: `GET` or `POST`. * * @param string $fallbackMethod The HTTP method we should use to call * fallback_url * @return $this Fluent Builder */ public function setFallbackMethod(string $fallbackMethod): self { $this->options['fallbackMethod'] = $fallbackMethod; return $this; } /** * The URL we should call to [pass status updates](https://www.twilio.com/docs/sms/api/message-resource#message-status-values) about message delivery. * * @param string $statusCallback The URL we should call to pass status updates * about message delivery * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * Whether to enable [Sticky Sender](https://www.twilio.com/docs/sms/services#sticky-sender) on the Service instance. * * @param bool $stickySender Whether to enable Sticky Sender on the Service * instance * @return $this Fluent Builder */ public function setStickySender(bool $stickySender): self { $this->options['stickySender'] = $stickySender; return $this; } /** * Whether to enable the [MMS Converter](https://www.twilio.com/docs/sms/services#mms-converter) for messages sent through the Service instance. * * @param bool $mmsConverter Whether to enable the MMS Converter for messages * sent through the Service instance * @return $this Fluent Builder */ public function setMmsConverter(bool $mmsConverter): self { $this->options['mmsConverter'] = $mmsConverter; return $this; } /** * Whether to enable [Smart Encoding](https://www.twilio.com/docs/sms/services#smart-encoding) for messages sent through the Service instance. * * @param bool $smartEncoding Whether to enable Encoding for messages sent * through the Service instance * @return $this Fluent Builder */ public function setSmartEncoding(bool $smartEncoding): self { $this->options['smartEncoding'] = $smartEncoding; return $this; } /** * Reserved. * * @param string $scanMessageContent Reserved * @return $this Fluent Builder */ public function setScanMessageContent(string $scanMessageContent): self { $this->options['scanMessageContent'] = $scanMessageContent; return $this; } /** * Whether to enable [Fallback to Long Code](https://www.twilio.com/docs/sms/services#fallback-to-long-code) for messages sent through the Service instance. * * @param bool $fallbackToLongCode Whether to enable Fallback to Long Code for * messages sent through the Service instance * @return $this Fluent Builder */ public function setFallbackToLongCode(bool $fallbackToLongCode): self { $this->options['fallbackToLongCode'] = $fallbackToLongCode; return $this; } /** * Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/sms/services#area-code-geomatch) on the Service Instance. * * @param bool $areaCodeGeomatch Whether to enable Area Code Geomatch on the * Service Instance * @return $this Fluent Builder */ public function setAreaCodeGeomatch(bool $areaCodeGeomatch): self { $this->options['areaCodeGeomatch'] = $areaCodeGeomatch; return $this; } /** * How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. * * @param int $validityPeriod How long, in seconds, messages sent from the * Service are valid * @return $this Fluent Builder */ public function setValidityPeriod(int $validityPeriod): self { $this->options['validityPeriod'] = $validityPeriod; return $this; } /** * Reserved. * * @param bool $synchronousValidation Reserved * @return $this Fluent Builder */ public function setSynchronousValidation(bool $synchronousValidation): self { $this->options['synchronousValidation'] = $synchronousValidation; return $this; } /** * A string that describes the scenario in which the Messaging Service will be used. Examples: [notification, marketing, verification, poll ..]. * * @param string $usecase A string describing the scenario in which the * Messaging Service will be used * @return $this Fluent Builder */ public function setUsecase(string $usecase): self { $this->options['usecase'] = $usecase; return $this; } /** * A boolean value that indicates either the webhook url configured on the phone number will be used or `inbound_request_url`/`fallback_url` url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the `inbound_request_url`/`fallback_url` defined for the Messaging Service. * * @param bool $useInboundWebhookOnNumber If enabled, the webhook url * configured on the phone number will * be used and will override the * `inbound_request_url`/`fallback_url` * url called when an inbound message is * received. * @return $this Fluent Builder */ public function setUseInboundWebhookOnNumber(bool $useInboundWebhookOnNumber): self { $this->options['useInboundWebhookOnNumber'] = $useInboundWebhookOnNumber; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Messaging.V1.CreateServiceOptions ' . $options . ']'; } } class UpdateServiceOptions extends Options { /** * @param string $friendlyName A string to describe the resource * @param string $inboundRequestUrl The URL we call using inbound_method when a * message is received by any phone number or * short code in the Service. This field will * be overridden if the * `use_inbound_webhook_on_number` field is * enabled. * @param string $inboundMethod The HTTP method we should use to call * inbound_request_url * @param string $fallbackUrl The URL that we call using fallback_method if an * error occurs while retrieving or executing the * TwiML from the Inbound Request URL. This field * will be overridden if the * `use_inbound_webhook_on_number` field is enabled. * @param string $fallbackMethod The HTTP method we should use to call * fallback_url * @param string $statusCallback The URL we should call to pass status updates * about message delivery * @param bool $stickySender Whether to enable Sticky Sender on the Service * instance * @param bool $mmsConverter Whether to enable the MMS Converter for messages * sent through the Service instance * @param bool $smartEncoding Whether to enable Encoding for messages sent * through the Service instance * @param string $scanMessageContent Reserved * @param bool $fallbackToLongCode Whether to enable Fallback to Long Code for * messages sent through the Service instance * @param bool $areaCodeGeomatch Whether to enable Area Code Geomatch on the * Service Instance * @param int $validityPeriod How long, in seconds, messages sent from the * Service are valid * @param bool $synchronousValidation Reserved * @param string $usecase A string describing the scenario in which the * Messaging Service will be used * @param bool $useInboundWebhookOnNumber If enabled, the webhook url * configured on the phone number will * be used and will override the * `inbound_request_url`/`fallback_url` * url called when an inbound message is * received. */ public function __construct(string $friendlyName = Values::NONE, string $inboundRequestUrl = Values::NONE, string $inboundMethod = Values::NONE, string $fallbackUrl = Values::NONE, string $fallbackMethod = Values::NONE, string $statusCallback = Values::NONE, bool $stickySender = Values::NONE, bool $mmsConverter = Values::NONE, bool $smartEncoding = Values::NONE, string $scanMessageContent = Values::NONE, bool $fallbackToLongCode = Values::NONE, bool $areaCodeGeomatch = Values::NONE, int $validityPeriod = Values::NONE, bool $synchronousValidation = Values::NONE, string $usecase = Values::NONE, bool $useInboundWebhookOnNumber = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['inboundRequestUrl'] = $inboundRequestUrl; $this->options['inboundMethod'] = $inboundMethod; $this->options['fallbackUrl'] = $fallbackUrl; $this->options['fallbackMethod'] = $fallbackMethod; $this->options['statusCallback'] = $statusCallback; $this->options['stickySender'] = $stickySender; $this->options['mmsConverter'] = $mmsConverter; $this->options['smartEncoding'] = $smartEncoding; $this->options['scanMessageContent'] = $scanMessageContent; $this->options['fallbackToLongCode'] = $fallbackToLongCode; $this->options['areaCodeGeomatch'] = $areaCodeGeomatch; $this->options['validityPeriod'] = $validityPeriod; $this->options['synchronousValidation'] = $synchronousValidation; $this->options['usecase'] = $usecase; $this->options['useInboundWebhookOnNumber'] = $useInboundWebhookOnNumber; } /** * A descriptive string that you create to describe the resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The URL we call using `inbound_method` when a message is received by any phone number or short code in the Service. When this property is `null`, receiving inbound messages is disabled. All messages sent to the Twilio phone number or short code will not be logged and received on the Account. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `inbound_request_url` defined for the Messaging Service. * * @param string $inboundRequestUrl The URL we call using inbound_method when a * message is received by any phone number or * short code in the Service. This field will * be overridden if the * `use_inbound_webhook_on_number` field is * enabled. * @return $this Fluent Builder */ public function setInboundRequestUrl(string $inboundRequestUrl): self { $this->options['inboundRequestUrl'] = $inboundRequestUrl; return $this; } /** * The HTTP method we should use to call `inbound_request_url`. Can be `GET` or `POST` and the default is `POST`. * * @param string $inboundMethod The HTTP method we should use to call * inbound_request_url * @return $this Fluent Builder */ public function setInboundMethod(string $inboundMethod): self { $this->options['inboundMethod'] = $inboundMethod; return $this; } /** * The URL that we call using `fallback_method` if an error occurs while retrieving or executing the TwiML from the Inbound Request URL. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `fallback_url` defined for the Messaging Service. * * @param string $fallbackUrl The URL that we call using fallback_method if an * error occurs while retrieving or executing the * TwiML from the Inbound Request URL. This field * will be overridden if the * `use_inbound_webhook_on_number` field is enabled. * @return $this Fluent Builder */ public function setFallbackUrl(string $fallbackUrl): self { $this->options['fallbackUrl'] = $fallbackUrl; return $this; } /** * The HTTP method we should use to call `fallback_url`. Can be: `GET` or `POST`. * * @param string $fallbackMethod The HTTP method we should use to call * fallback_url * @return $this Fluent Builder */ public function setFallbackMethod(string $fallbackMethod): self { $this->options['fallbackMethod'] = $fallbackMethod; return $this; } /** * The URL we should call to [pass status updates](https://www.twilio.com/docs/sms/api/message-resource#message-status-values) about message delivery. * * @param string $statusCallback The URL we should call to pass status updates * about message delivery * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * Whether to enable [Sticky Sender](https://www.twilio.com/docs/sms/services#sticky-sender) on the Service instance. * * @param bool $stickySender Whether to enable Sticky Sender on the Service * instance * @return $this Fluent Builder */ public function setStickySender(bool $stickySender): self { $this->options['stickySender'] = $stickySender; return $this; } /** * Whether to enable the [MMS Converter](https://www.twilio.com/docs/sms/services#mms-converter) for messages sent through the Service instance. * * @param bool $mmsConverter Whether to enable the MMS Converter for messages * sent through the Service instance * @return $this Fluent Builder */ public function setMmsConverter(bool $mmsConverter): self { $this->options['mmsConverter'] = $mmsConverter; return $this; } /** * Whether to enable [Smart Encoding](https://www.twilio.com/docs/sms/services#smart-encoding) for messages sent through the Service instance. * * @param bool $smartEncoding Whether to enable Encoding for messages sent * through the Service instance * @return $this Fluent Builder */ public function setSmartEncoding(bool $smartEncoding): self { $this->options['smartEncoding'] = $smartEncoding; return $this; } /** * Reserved. * * @param string $scanMessageContent Reserved * @return $this Fluent Builder */ public function setScanMessageContent(string $scanMessageContent): self { $this->options['scanMessageContent'] = $scanMessageContent; return $this; } /** * Whether to enable [Fallback to Long Code](https://www.twilio.com/docs/sms/services#fallback-to-long-code) for messages sent through the Service instance. * * @param bool $fallbackToLongCode Whether to enable Fallback to Long Code for * messages sent through the Service instance * @return $this Fluent Builder */ public function setFallbackToLongCode(bool $fallbackToLongCode): self { $this->options['fallbackToLongCode'] = $fallbackToLongCode; return $this; } /** * Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/sms/services#area-code-geomatch) on the Service Instance. * * @param bool $areaCodeGeomatch Whether to enable Area Code Geomatch on the * Service Instance * @return $this Fluent Builder */ public function setAreaCodeGeomatch(bool $areaCodeGeomatch): self { $this->options['areaCodeGeomatch'] = $areaCodeGeomatch; return $this; } /** * How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. * * @param int $validityPeriod How long, in seconds, messages sent from the * Service are valid * @return $this Fluent Builder */ public function setValidityPeriod(int $validityPeriod): self { $this->options['validityPeriod'] = $validityPeriod; return $this; } /** * Reserved. * * @param bool $synchronousValidation Reserved * @return $this Fluent Builder */ public function setSynchronousValidation(bool $synchronousValidation): self { $this->options['synchronousValidation'] = $synchronousValidation; return $this; } /** * A string that describes the scenario in which the Messaging Service will be used. Examples: [notification, marketing, verification, poll ..] * * @param string $usecase A string describing the scenario in which the * Messaging Service will be used * @return $this Fluent Builder */ public function setUsecase(string $usecase): self { $this->options['usecase'] = $usecase; return $this; } /** * A boolean value that indicates either the webhook url configured on the phone number will be used or `inbound_request_url`/`fallback_url` url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the `inbound_request_url`/`fallback_url` defined for the Messaging Service. * * @param bool $useInboundWebhookOnNumber If enabled, the webhook url * configured on the phone number will * be used and will override the * `inbound_request_url`/`fallback_url` * url called when an inbound message is * received. * @return $this Fluent Builder */ public function setUseInboundWebhookOnNumber(bool $useInboundWebhookOnNumber): self { $this->options['useInboundWebhookOnNumber'] = $useInboundWebhookOnNumber; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Messaging.V1.UpdateServiceOptions ' . $options . ']'; } }src/Twilio/Rest/Messaging/V1/UsecasePage.php000064400000002363150515725670014641 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return UsecaseInstance \Twilio\Rest\Messaging\V1\UsecaseInstance */ public function buildInstance(array $payload): UsecaseInstance { return new UsecaseInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Messaging.V1.UsecasePage]'; } }src/Twilio/Rest/Messaging/V1/ServicePage.php000064400000002363150515725670014651 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ServiceInstance \Twilio\Rest\Messaging\V1\ServiceInstance */ public function buildInstance(array $payload): ServiceInstance { return new ServiceInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Messaging.V1.ServicePage]'; } }src/Twilio/Rest/Messaging/V1/DeactivationsList.php000064400000001645150515725670016107 0ustar00solution = []; } /** * Constructs a DeactivationsContext */ public function getContext(): DeactivationsContext { return new DeactivationsContext($this->version); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Messaging.V1.DeactivationsList]'; } }src/Twilio/Rest/Messaging/V1/DeactivationsInstance.php000064400000005123150515725670016733 0ustar00properties = ['redirectTo' => Values::array_get($payload, 'redirect_to'), ]; $this->solution = []; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return DeactivationsContext Context for this DeactivationsInstance */ protected function proxy(): DeactivationsContext { if (!$this->context) { $this->context = new DeactivationsContext($this->version); } return $this->context; } /** * Fetch the DeactivationsInstance * * @param array|Options $options Optional Arguments * @return DeactivationsInstance Fetched DeactivationsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): DeactivationsInstance { return $this->proxy()->fetch($options); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Messaging.V1.DeactivationsInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Messaging/V1/BrandRegistration/BrandVettingPage.php000064400000002522150515725670021256 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return BrandVettingInstance \Twilio\Rest\Messaging\V1\BrandRegistration\BrandVettingInstance */ public function buildInstance(array $payload): BrandVettingInstance { return new BrandVettingInstance($this->version, $payload, $this->solution['brandSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Messaging.V1.BrandVettingPage]'; } }src/Twilio/Rest/Messaging/V1/BrandRegistration/BrandVettingOptions.php000064400000005426150515725670022043 0ustar00options['vettingId'] = $vettingId; } /** * The unique ID of the vetting * * @param string $vettingId The unique ID of the vetting * @return $this Fluent Builder */ public function setVettingId(string $vettingId): self { $this->options['vettingId'] = $vettingId; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Messaging.V1.CreateBrandVettingOptions ' . $options . ']'; } } class ReadBrandVettingOptions extends Options { /** * @param string $vettingProvider Third-party provider of the vettings to create */ public function __construct(string $vettingProvider = Values::NONE) { $this->options['vettingProvider'] = $vettingProvider; } /** * The third-party provider of the vettings to read * * @param string $vettingProvider Third-party provider of the vettings to create * @return $this Fluent Builder */ public function setVettingProvider(string $vettingProvider): self { $this->options['vettingProvider'] = $vettingProvider; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Messaging.V1.ReadBrandVettingOptions ' . $options . ']'; } }src/Twilio/Rest/Messaging/V1/BrandRegistration/BrandVettingInstance.php000064400000010071150515725670022144 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'brandSid' => Values::array_get($payload, 'brand_sid'), 'brandVettingSid' => Values::array_get($payload, 'brand_vetting_sid'), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'vettingId' => Values::array_get($payload, 'vetting_id'), 'vettingClass' => Values::array_get($payload, 'vetting_class'), 'vettingStatus' => Values::array_get($payload, 'vetting_status'), 'vettingProvider' => Values::array_get($payload, 'vetting_provider'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'brandSid' => $brandSid, 'brandVettingSid' => $brandVettingSid ?: $this->properties['brandVettingSid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return BrandVettingContext Context for this BrandVettingInstance */ protected function proxy(): BrandVettingContext { if (!$this->context) { $this->context = new BrandVettingContext( $this->version, $this->solution['brandSid'], $this->solution['brandVettingSid'] ); } return $this->context; } /** * Fetch the BrandVettingInstance * * @return BrandVettingInstance Fetched BrandVettingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): BrandVettingInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Messaging.V1.BrandVettingInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Messaging/V1/BrandRegistration/BrandVettingList.php000064400000014161150515725670021317 0ustar00solution = ['brandSid' => $brandSid, ]; $this->uri = '/a2p/BrandRegistrations/' . \rawurlencode($brandSid) . '/Vettings'; } /** * Create the BrandVettingInstance * * @param string $vettingProvider Third-party provider of the vettings to create * @param array|Options $options Optional Arguments * @return BrandVettingInstance Created BrandVettingInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $vettingProvider, array $options = []): BrandVettingInstance { $options = new Values($options); $data = Values::of(['VettingProvider' => $vettingProvider, 'VettingId' => $options['vettingId'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new BrandVettingInstance($this->version, $payload, $this->solution['brandSid']); } /** * Streams BrandVettingInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads BrandVettingInstance 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 BrandVettingInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of BrandVettingInstance 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 BrandVettingPage Page of BrandVettingInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): BrandVettingPage { $options = new Values($options); $params = Values::of([ 'VettingProvider' => $options['vettingProvider'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new BrandVettingPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of BrandVettingInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return BrandVettingPage Page of BrandVettingInstance */ public function getPage(string $targetUrl): BrandVettingPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new BrandVettingPage($this->version, $response, $this->solution); } /** * Constructs a BrandVettingContext * * @param string $brandVettingSid SID for third-party vetting record */ public function getContext(string $brandVettingSid): BrandVettingContext { return new BrandVettingContext($this->version, $this->solution['brandSid'], $brandVettingSid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Messaging.V1.BrandVettingList]'; } }src/Twilio/Rest/Messaging/V1/BrandRegistration/BrandVettingContext.php000064400000003655150515725670022036 0ustar00solution = ['brandSid' => $brandSid, 'brandVettingSid' => $brandVettingSid, ]; $this->uri = '/a2p/BrandRegistrations/' . \rawurlencode($brandSid) . '/Vettings/' . \rawurlencode($brandVettingSid) . ''; } /** * Fetch the BrandVettingInstance * * @return BrandVettingInstance Fetched BrandVettingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): BrandVettingInstance { $payload = $this->version->fetch('GET', $this->uri); return new BrandVettingInstance( $this->version, $payload, $this->solution['brandSid'], $this->solution['brandVettingSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Messaging.V1.BrandVettingContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Messaging/V1/UsecaseList.php000064400000002423150515725670014675 0ustar00solution = []; $this->uri = '/Services/Usecases'; } /** * Fetch the UsecaseInstance * * @return UsecaseInstance Fetched UsecaseInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): UsecaseInstance { $payload = $this->version->fetch('GET', $this->uri); return new UsecaseInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Messaging.V1.UsecaseList]'; } }src/Twilio/Rest/Messaging/V1/ExternalCampaignPage.php000064400000002451150515725670016471 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ExternalCampaignInstance \Twilio\Rest\Messaging\V1\ExternalCampaignInstance */ public function buildInstance(array $payload): ExternalCampaignInstance { return new ExternalCampaignInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Messaging.V1.ExternalCampaignPage]'; } }src/Twilio/Rest/Messaging/V1/ExternalCampaignInstance.php000064400000004277150515725670017371 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'campaignId' => Values::array_get($payload, 'campaign_id'), 'messagingServiceSid' => Values::array_get($payload, 'messaging_service_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), ]; $this->solution = []; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Messaging.V1.ExternalCampaignInstance]'; } }src/Twilio/Rest/Messaging/V1/ServiceList.php000064400000014672150515725670014716 0ustar00solution = []; $this->uri = '/Services'; } /** * Create the ServiceInstance * * @param string $friendlyName A string to describe the resource * @param array|Options $options Optional Arguments * @return ServiceInstance Created ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, array $options = []): ServiceInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $friendlyName, 'InboundRequestUrl' => $options['inboundRequestUrl'], 'InboundMethod' => $options['inboundMethod'], 'FallbackUrl' => $options['fallbackUrl'], 'FallbackMethod' => $options['fallbackMethod'], 'StatusCallback' => $options['statusCallback'], 'StickySender' => Serialize::booleanToString($options['stickySender']), 'MmsConverter' => Serialize::booleanToString($options['mmsConverter']), 'SmartEncoding' => Serialize::booleanToString($options['smartEncoding']), 'ScanMessageContent' => $options['scanMessageContent'], 'FallbackToLongCode' => Serialize::booleanToString($options['fallbackToLongCode']), 'AreaCodeGeomatch' => Serialize::booleanToString($options['areaCodeGeomatch']), 'ValidityPeriod' => $options['validityPeriod'], 'SynchronousValidation' => Serialize::booleanToString($options['synchronousValidation']), 'Usecase' => $options['usecase'], 'UseInboundWebhookOnNumber' => Serialize::booleanToString($options['useInboundWebhookOnNumber']), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ServiceInstance($this->version, $payload); } /** * Streams ServiceInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ServiceInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return ServiceInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of ServiceInstance records from the API. * Request is executed immediately * * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return ServicePage Page of ServiceInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ServicePage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ServicePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ServiceInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ServicePage Page of ServiceInstance */ public function getPage(string $targetUrl): ServicePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ServicePage($this->version, $response, $this->solution); } /** * Constructs a ServiceContext * * @param string $sid The SID that identifies the resource to fetch */ public function getContext(string $sid): ServiceContext { return new ServiceContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Messaging.V1.ServiceList]'; } }src/Twilio/Rest/Messaging/V1/ExternalCampaignList.php000064400000003350150515725670016527 0ustar00solution = []; $this->uri = '/Services/PreregisteredUsa2p'; } /** * Create the ExternalCampaignInstance * * @param string $campaignId ID of the preregistered campaign. * @param string $messagingServiceSid The SID of the Messaging Service the * resource is associated with * @return ExternalCampaignInstance Created ExternalCampaignInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $campaignId, string $messagingServiceSid): ExternalCampaignInstance { $data = Values::of(['CampaignId' => $campaignId, 'MessagingServiceSid' => $messagingServiceSid, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ExternalCampaignInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Messaging.V1.ExternalCampaignList]'; } }src/Twilio/Rest/Messaging/V1.php000064400000007217150515725670012457 0ustar00version = 'v1'; } protected function getBrandRegistrations(): BrandRegistrationList { if (!$this->_brandRegistrations) { $this->_brandRegistrations = new BrandRegistrationList($this); } return $this->_brandRegistrations; } protected function getDeactivations(): DeactivationsList { if (!$this->_deactivations) { $this->_deactivations = new DeactivationsList($this); } return $this->_deactivations; } protected function getExternalCampaign(): ExternalCampaignList { if (!$this->_externalCampaign) { $this->_externalCampaign = new ExternalCampaignList($this); } return $this->_externalCampaign; } protected function getServices(): ServiceList { if (!$this->_services) { $this->_services = new ServiceList($this); } return $this->_services; } protected function getUsecases(): UsecaseList { if (!$this->_usecases) { $this->_usecases = new UsecaseList($this); } return $this->_usecases; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Messaging.V1]'; } }src/Twilio/Rest/Notify.php000064400000005744150515725670011527 0ustar00baseUrl = 'https://notify.twilio.com'; } /** * @return V1 Version v1 of notify */ protected function getV1(): V1 { 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 TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } protected function getCredentials(): \Twilio\Rest\Notify\V1\CredentialList { return $this->v1->credentials; } /** * @param string $sid The unique string that identifies the resource */ protected function contextCredentials(string $sid): \Twilio\Rest\Notify\V1\CredentialContext { return $this->v1->credentials($sid); } protected function getServices(): \Twilio\Rest\Notify\V1\ServiceList { return $this->v1->services; } /** * @param string $sid The unique string that identifies the resource */ protected function contextServices(string $sid): \Twilio\Rest\Notify\V1\ServiceContext { return $this->v1->services($sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Notify]'; } }src/Twilio/Rest/Studio/V1/FlowList.php000064400000010677150515725670013560 0ustar00solution = []; $this->uri = '/Flows'; } /** * Streams FlowInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads FlowInstance 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 FlowInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of FlowInstance 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 FlowPage Page of FlowInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): FlowPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new FlowPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of FlowInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return FlowPage Page of FlowInstance */ public function getPage(string $targetUrl): FlowPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new FlowPage($this->version, $response, $this->solution); } /** * Constructs a FlowContext * * @param string $sid The SID that identifies the resource to fetch */ public function getContext(string $sid): FlowContext { return new FlowContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V1.FlowList]'; } }src/Twilio/Rest/Studio/V1/FlowInstance.php000064400000010103150515725670014371 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'status' => Values::array_get($payload, 'status'), 'version' => Values::array_get($payload, 'version'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 FlowContext Context for this FlowInstance */ protected function proxy(): FlowContext { if (!$this->context) { $this->context = new FlowContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the FlowInstance * * @return FlowInstance Fetched FlowInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FlowInstance { return $this->proxy()->fetch(); } /** * Delete the FlowInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the engagements */ protected function getEngagements(): EngagementList { return $this->proxy()->engagements; } /** * Access the executions */ protected function getExecutions(): ExecutionList { return $this->proxy()->executions; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V1.FlowInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Studio/V1/Flow/EngagementOptions.php000064400000004307150515725670016343 0ustar00options['parameters'] = $parameters; } /** * A JSON string we will add to your flow's context and that you can access as variables inside your flow. For example, if you pass in `Parameters={'name':'Zeke'}` then inside a widget you can reference the variable `{{flow.data.name}}` which will return the string 'Zeke'. Note: the JSON value must explicitly be passed as a string, not as a hash object. Depending on your particular HTTP library, you may need to add quotes or URL encode your JSON string. * * @param array $parameters A JSON string we will add to your flow's context * and that you can access as variables inside your * flow * @return $this Fluent Builder */ public function setParameters(array $parameters): self { $this->options['parameters'] = $parameters; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Studio.V1.CreateEngagementOptions ' . $options . ']'; } }src/Twilio/Rest/Studio/V1/Flow/ExecutionContext.php000064400000011573150515725670016230 0ustar00solution = ['flowSid' => $flowSid, 'sid' => $sid, ]; $this->uri = '/Flows/' . \rawurlencode($flowSid) . '/Executions/' . \rawurlencode($sid) . ''; } /** * Fetch the ExecutionInstance * * @return ExecutionInstance Fetched ExecutionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ExecutionInstance { $payload = $this->version->fetch('GET', $this->uri); return new ExecutionInstance( $this->version, $payload, $this->solution['flowSid'], $this->solution['sid'] ); } /** * Delete the ExecutionInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the ExecutionInstance * * @param string $status The status of the Execution * @return ExecutionInstance Updated ExecutionInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $status): ExecutionInstance { $data = Values::of(['Status' => $status, ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ExecutionInstance( $this->version, $payload, $this->solution['flowSid'], $this->solution['sid'] ); } /** * Access the steps */ protected function getSteps(): ExecutionStepList { if (!$this->_steps) { $this->_steps = new ExecutionStepList( $this->version, $this->solution['flowSid'], $this->solution['sid'] ); } return $this->_steps; } /** * Access the executionContext */ protected function getExecutionContext(): ExecutionContextList { if (!$this->_executionContext) { $this->_executionContext = new ExecutionContextList( $this->version, $this->solution['flowSid'], $this->solution['sid'] ); } return $this->_executionContext; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V1.ExecutionContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Studio/V1/Flow/Execution/ExecutionStepInstance.php000064400000010715150515725670021144 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'flowSid' => Values::array_get($payload, 'flow_sid'), 'executionSid' => Values::array_get($payload, 'execution_sid'), 'name' => Values::array_get($payload, 'name'), 'context' => Values::array_get($payload, 'context'), 'transitionedFrom' => Values::array_get($payload, 'transitioned_from'), 'transitionedTo' => Values::array_get($payload, 'transitioned_to'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = [ 'flowSid' => $flowSid, 'executionSid' => $executionSid, '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 ExecutionStepContext Context for this ExecutionStepInstance */ protected function proxy(): ExecutionStepContext { if (!$this->context) { $this->context = new ExecutionStepContext( $this->version, $this->solution['flowSid'], $this->solution['executionSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the ExecutionStepInstance * * @return ExecutionStepInstance Fetched ExecutionStepInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ExecutionStepInstance { return $this->proxy()->fetch(); } /** * Access the stepContext */ protected function getStepContext(): ExecutionStepContextList { return $this->proxy()->stepContext; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V1.ExecutionStepInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Studio/V1/Flow/Execution/ExecutionContextPage.php000064400000002504150515725670020762 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ExecutionContextInstance \Twilio\Rest\Studio\V1\Flow\Execution\ExecutionContextInstance */ public function buildInstance(array $payload): ExecutionContextInstance { return new ExecutionContextInstance( $this->version, $payload, $this->solution['flowSid'], $this->solution['executionSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V1.ExecutionContextPage]'; } }src/Twilio/Rest/Studio/V1/Flow/Execution/ExecutionContextInstance.php000064400000006357150515725670021664 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'context' => Values::array_get($payload, 'context'), 'flowSid' => Values::array_get($payload, 'flow_sid'), 'executionSid' => Values::array_get($payload, 'execution_sid'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['flowSid' => $flowSid, 'executionSid' => $executionSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return ExecutionContextContext Context for this ExecutionContextInstance */ protected function proxy(): ExecutionContextContext { if (!$this->context) { $this->context = new ExecutionContextContext( $this->version, $this->solution['flowSid'], $this->solution['executionSid'] ); } return $this->context; } /** * Fetch the ExecutionContextInstance * * @return ExecutionContextInstance Fetched ExecutionContextInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ExecutionContextInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V1.ExecutionContextInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Studio/V1/Flow/Execution/ExecutionStepPage.php000064400000002462150515725670020254 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ExecutionStepInstance \Twilio\Rest\Studio\V1\Flow\Execution\ExecutionStepInstance */ public function buildInstance(array $payload): ExecutionStepInstance { return new ExecutionStepInstance( $this->version, $payload, $this->solution['flowSid'], $this->solution['executionSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V1.ExecutionStepPage]'; } }src/Twilio/Rest/Studio/V1/Flow/Execution/ExecutionContextList.php000064400000002370150515725670021022 0ustar00solution = ['flowSid' => $flowSid, 'executionSid' => $executionSid, ]; } /** * Constructs a ExecutionContextContext */ public function getContext(): ExecutionContextContext { return new ExecutionContextContext( $this->version, $this->solution['flowSid'], $this->solution['executionSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V1.ExecutionContextList]'; } }src/Twilio/Rest/Studio/V1/Flow/Execution/ExecutionContextContext.php000064400000003444150515725670021536 0ustar00solution = ['flowSid' => $flowSid, 'executionSid' => $executionSid, ]; $this->uri = '/Flows/' . \rawurlencode($flowSid) . '/Executions/' . \rawurlencode($executionSid) . '/Context'; } /** * Fetch the ExecutionContextInstance * * @return ExecutionContextInstance Fetched ExecutionContextInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ExecutionContextInstance { $payload = $this->version->fetch('GET', $this->uri); return new ExecutionContextInstance( $this->version, $payload, $this->solution['flowSid'], $this->solution['executionSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V1.ExecutionContextContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Studio/V1/Flow/Execution/ExecutionStep/ExecutionStepContextInstance.php000064400000007056150515725670025314 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'context' => Values::array_get($payload, 'context'), 'executionSid' => Values::array_get($payload, 'execution_sid'), 'flowSid' => Values::array_get($payload, 'flow_sid'), 'stepSid' => Values::array_get($payload, 'step_sid'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['flowSid' => $flowSid, 'executionSid' => $executionSid, 'stepSid' => $stepSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return ExecutionStepContextContext Context for this * ExecutionStepContextInstance */ protected function proxy(): ExecutionStepContextContext { if (!$this->context) { $this->context = new ExecutionStepContextContext( $this->version, $this->solution['flowSid'], $this->solution['executionSid'], $this->solution['stepSid'] ); } return $this->context; } /** * Fetch the ExecutionStepContextInstance * * @return ExecutionStepContextInstance Fetched ExecutionStepContextInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ExecutionStepContextInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V1.ExecutionStepContextInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Studio/V1/Flow/Execution/ExecutionStep/ExecutionStepContextPage.php000064400000002640150515725670024416 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ExecutionStepContextInstance \Twilio\Rest\Studio\V1\Flow\Execution\ExecutionStep\ExecutionStepContextInstance */ public function buildInstance(array $payload): ExecutionStepContextInstance { return new ExecutionStepContextInstance( $this->version, $payload, $this->solution['flowSid'], $this->solution['executionSid'], $this->solution['stepSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V1.ExecutionStepContextPage]'; } }src/Twilio/Rest/Studio/V1/Flow/Execution/ExecutionStep/ExecutionStepContextContext.php000064400000003750150515725670025171 0ustar00solution = ['flowSid' => $flowSid, 'executionSid' => $executionSid, 'stepSid' => $stepSid, ]; $this->uri = '/Flows/' . \rawurlencode($flowSid) . '/Executions/' . \rawurlencode($executionSid) . '/Steps/' . \rawurlencode($stepSid) . '/Context'; } /** * Fetch the ExecutionStepContextInstance * * @return ExecutionStepContextInstance Fetched ExecutionStepContextInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ExecutionStepContextInstance { $payload = $this->version->fetch('GET', $this->uri); return new ExecutionStepContextInstance( $this->version, $payload, $this->solution['flowSid'], $this->solution['executionSid'], $this->solution['stepSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V1.ExecutionStepContextContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Studio/V1/Flow/Execution/ExecutionStep/ExecutionStepContextList.php000064400000002625150515725670024460 0ustar00solution = ['flowSid' => $flowSid, 'executionSid' => $executionSid, 'stepSid' => $stepSid, ]; } /** * Constructs a ExecutionStepContextContext */ public function getContext(): ExecutionStepContextContext { return new ExecutionStepContextContext( $this->version, $this->solution['flowSid'], $this->solution['executionSid'], $this->solution['stepSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V1.ExecutionStepContextList]'; } }src/Twilio/Rest/Studio/V1/Flow/Execution/ExecutionStepList.php000064400000012024150515725670020306 0ustar00solution = ['flowSid' => $flowSid, 'executionSid' => $executionSid, ]; $this->uri = '/Flows/' . \rawurlencode($flowSid) . '/Executions/' . \rawurlencode($executionSid) . '/Steps'; } /** * Streams ExecutionStepInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ExecutionStepInstance 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 ExecutionStepInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of ExecutionStepInstance 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 ExecutionStepPage Page of ExecutionStepInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ExecutionStepPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ExecutionStepPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ExecutionStepInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ExecutionStepPage Page of ExecutionStepInstance */ public function getPage(string $targetUrl): ExecutionStepPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ExecutionStepPage($this->version, $response, $this->solution); } /** * Constructs a ExecutionStepContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): ExecutionStepContext { return new ExecutionStepContext( $this->version, $this->solution['flowSid'], $this->solution['executionSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V1.ExecutionStepList]'; } }src/Twilio/Rest/Studio/V1/Flow/Execution/ExecutionStepContext.php000064400000007370150515725670021027 0ustar00solution = ['flowSid' => $flowSid, 'executionSid' => $executionSid, 'sid' => $sid, ]; $this->uri = '/Flows/' . \rawurlencode($flowSid) . '/Executions/' . \rawurlencode($executionSid) . '/Steps/' . \rawurlencode($sid) . ''; } /** * Fetch the ExecutionStepInstance * * @return ExecutionStepInstance Fetched ExecutionStepInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ExecutionStepInstance { $payload = $this->version->fetch('GET', $this->uri); return new ExecutionStepInstance( $this->version, $payload, $this->solution['flowSid'], $this->solution['executionSid'], $this->solution['sid'] ); } /** * Access the stepContext */ protected function getStepContext(): ExecutionStepContextList { if (!$this->_stepContext) { $this->_stepContext = new ExecutionStepContextList( $this->version, $this->solution['flowSid'], $this->solution['executionSid'], $this->solution['sid'] ); } return $this->_stepContext; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V1.ExecutionStepContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Studio/V1/Flow/EngagementInstance.php000064400000011105150515725670016446 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'flowSid' => Values::array_get($payload, 'flow_sid'), 'contactSid' => Values::array_get($payload, 'contact_sid'), 'contactChannelAddress' => Values::array_get($payload, 'contact_channel_address'), 'context' => Values::array_get($payload, 'context'), 'status' => Values::array_get($payload, 'status'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['flowSid' => $flowSid, '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 EngagementContext Context for this EngagementInstance */ protected function proxy(): EngagementContext { if (!$this->context) { $this->context = new EngagementContext( $this->version, $this->solution['flowSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the EngagementInstance * * @return EngagementInstance Fetched EngagementInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): EngagementInstance { return $this->proxy()->fetch(); } /** * Delete the EngagementInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the steps */ protected function getSteps(): StepList { return $this->proxy()->steps; } /** * Access the engagementContext */ protected function getEngagementContext(): EngagementContextList { return $this->proxy()->engagementContext; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V1.EngagementInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Studio/V1/Flow/ExecutionOptions.php000064400000010533150515725670016232 0ustar00options['dateCreatedFrom'] = $dateCreatedFrom; $this->options['dateCreatedTo'] = $dateCreatedTo; } /** * Only show Execution resources starting on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. * * @param \DateTime $dateCreatedFrom Only show Executions that started on or * after this ISO 8601 date-time * @return $this Fluent Builder */ public function setDateCreatedFrom(\DateTime $dateCreatedFrom): self { $this->options['dateCreatedFrom'] = $dateCreatedFrom; return $this; } /** * Only show Execution resources starting before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. * * @param \DateTime $dateCreatedTo Only show Executions that started before * this ISO 8601 date-time * @return $this Fluent Builder */ public function setDateCreatedTo(\DateTime $dateCreatedTo): self { $this->options['dateCreatedTo'] = $dateCreatedTo; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Studio.V1.ReadExecutionOptions ' . $options . ']'; } } class CreateExecutionOptions extends Options { /** * @param array $parameters JSON data that will be added to the Flow's context */ public function __construct(array $parameters = Values::ARRAY_NONE) { $this->options['parameters'] = $parameters; } /** * JSON data that will be added to the Flow's context and that can be accessed as variables inside your Flow. For example, if you pass in `Parameters={"name":"Zeke"}`, a widget in your Flow can reference the variable `{{flow.data.name}}`, which returns "Zeke". Note: the JSON value must explicitly be passed as a string, not as a hash object. Depending on your particular HTTP library, you may need to add quotes or URL encode the JSON string. * * @param array $parameters JSON data that will be added to the Flow's context * @return $this Fluent Builder */ public function setParameters(array $parameters): self { $this->options['parameters'] = $parameters; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Studio.V1.CreateExecutionOptions ' . $options . ']'; } }src/Twilio/Rest/Studio/V1/Flow/ExecutionList.php000064400000014332150515725670015513 0ustar00solution = ['flowSid' => $flowSid, ]; $this->uri = '/Flows/' . \rawurlencode($flowSid) . '/Executions'; } /** * Streams ExecutionInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ExecutionInstance 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 ExecutionInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of ExecutionInstance 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 ExecutionPage Page of ExecutionInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ExecutionPage { $options = new Values($options); $params = Values::of([ 'DateCreatedFrom' => Serialize::iso8601DateTime($options['dateCreatedFrom']), 'DateCreatedTo' => Serialize::iso8601DateTime($options['dateCreatedTo']), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ExecutionPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ExecutionInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ExecutionPage Page of ExecutionInstance */ public function getPage(string $targetUrl): ExecutionPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ExecutionPage($this->version, $response, $this->solution); } /** * Create the ExecutionInstance * * @param string $to The Contact phone number to start a Studio Flow Execution * @param string $from The Twilio phone number or Messaging Service SID to send * messages or initiate calls from during the Flow Execution * @param array|Options $options Optional Arguments * @return ExecutionInstance Created ExecutionInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $to, string $from, array $options = []): ExecutionInstance { $options = new Values($options); $data = Values::of([ 'To' => $to, 'From' => $from, 'Parameters' => Serialize::jsonObject($options['parameters']), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ExecutionInstance($this->version, $payload, $this->solution['flowSid']); } /** * Constructs a ExecutionContext * * @param string $sid The SID of the Execution resource to fetch */ public function getContext(string $sid): ExecutionContext { return new ExecutionContext($this->version, $this->solution['flowSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V1.ExecutionList]'; } }src/Twilio/Rest/Studio/V1/Flow/EngagementPage.php000064400000002261150515725670015561 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return EngagementInstance \Twilio\Rest\Studio\V1\Flow\EngagementInstance */ public function buildInstance(array $payload): EngagementInstance { return new EngagementInstance($this->version, $payload, $this->solution['flowSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V1.EngagementPage]'; } }src/Twilio/Rest/Studio/V1/Flow/EngagementList.php000064400000013333150515725670015622 0ustar00solution = ['flowSid' => $flowSid, ]; $this->uri = '/Flows/' . \rawurlencode($flowSid) . '/Engagements'; } /** * Streams EngagementInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads EngagementInstance 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 EngagementInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of EngagementInstance 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 EngagementPage Page of EngagementInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): EngagementPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new EngagementPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of EngagementInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return EngagementPage Page of EngagementInstance */ public function getPage(string $targetUrl): EngagementPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new EngagementPage($this->version, $response, $this->solution); } /** * Create the EngagementInstance * * @param string $to The Contact phone number to start a Studio Flow Engagement * @param string $from The Twilio phone number to send messages or initiate * calls from during the Flow Engagement * @param array|Options $options Optional Arguments * @return EngagementInstance Created EngagementInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $to, string $from, array $options = []): EngagementInstance { $options = new Values($options); $data = Values::of([ 'To' => $to, 'From' => $from, 'Parameters' => Serialize::jsonObject($options['parameters']), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new EngagementInstance($this->version, $payload, $this->solution['flowSid']); } /** * Constructs a EngagementContext * * @param string $sid The SID of the Engagement resource to fetch */ public function getContext(string $sid): EngagementContext { return new EngagementContext($this->version, $this->solution['flowSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V1.EngagementList]'; } }src/Twilio/Rest/Studio/V1/Flow/EngagementContext.php000064400000010302150515725670016324 0ustar00solution = ['flowSid' => $flowSid, 'sid' => $sid, ]; $this->uri = '/Flows/' . \rawurlencode($flowSid) . '/Engagements/' . \rawurlencode($sid) . ''; } /** * Fetch the EngagementInstance * * @return EngagementInstance Fetched EngagementInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): EngagementInstance { $payload = $this->version->fetch('GET', $this->uri); return new EngagementInstance( $this->version, $payload, $this->solution['flowSid'], $this->solution['sid'] ); } /** * Delete the EngagementInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the steps */ protected function getSteps(): StepList { if (!$this->_steps) { $this->_steps = new StepList($this->version, $this->solution['flowSid'], $this->solution['sid']); } return $this->_steps; } /** * Access the engagementContext */ protected function getEngagementContext(): EngagementContextList { if (!$this->_engagementContext) { $this->_engagementContext = new EngagementContextList( $this->version, $this->solution['flowSid'], $this->solution['sid'] ); } return $this->_engagementContext; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V1.EngagementContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Studio/V1/Flow/ExecutionInstance.php000064400000011642150515725670016345 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'flowSid' => Values::array_get($payload, 'flow_sid'), 'contactSid' => Values::array_get($payload, 'contact_sid'), 'contactChannelAddress' => Values::array_get($payload, 'contact_channel_address'), 'context' => Values::array_get($payload, 'context'), 'status' => Values::array_get($payload, 'status'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['flowSid' => $flowSid, '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 ExecutionContext Context for this ExecutionInstance */ protected function proxy(): ExecutionContext { if (!$this->context) { $this->context = new ExecutionContext( $this->version, $this->solution['flowSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the ExecutionInstance * * @return ExecutionInstance Fetched ExecutionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ExecutionInstance { return $this->proxy()->fetch(); } /** * Delete the ExecutionInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the ExecutionInstance * * @param string $status The status of the Execution * @return ExecutionInstance Updated ExecutionInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $status): ExecutionInstance { return $this->proxy()->update($status); } /** * Access the steps */ protected function getSteps(): ExecutionStepList { return $this->proxy()->steps; } /** * Access the executionContext */ protected function getExecutionContext(): ExecutionContextList { return $this->proxy()->executionContext; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V1.ExecutionInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Studio/V1/Flow/ExecutionPage.php000064400000002253150515725670015453 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ExecutionInstance \Twilio\Rest\Studio\V1\Flow\ExecutionInstance */ public function buildInstance(array $payload): ExecutionInstance { return new ExecutionInstance($this->version, $payload, $this->solution['flowSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V1.ExecutionPage]'; } }src/Twilio/Rest/Studio/V1/Flow/Engagement/EngagementContextPage.php000064400000002515150515725670021202 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return EngagementContextInstance \Twilio\Rest\Studio\V1\Flow\Engagement\EngagementContextInstance */ public function buildInstance(array $payload): EngagementContextInstance { return new EngagementContextInstance( $this->version, $payload, $this->solution['flowSid'], $this->solution['engagementSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V1.EngagementContextPage]'; } }src/Twilio/Rest/Studio/V1/Flow/Engagement/EngagementContextContext.php000064400000003437150515725670021756 0ustar00solution = ['flowSid' => $flowSid, 'engagementSid' => $engagementSid, ]; $this->uri = '/Flows/' . \rawurlencode($flowSid) . '/Engagements/' . \rawurlencode($engagementSid) . '/Context'; } /** * Fetch the EngagementContextInstance * * @return EngagementContextInstance Fetched EngagementContextInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): EngagementContextInstance { $payload = $this->version->fetch('GET', $this->uri); return new EngagementContextInstance( $this->version, $payload, $this->solution['flowSid'], $this->solution['engagementSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V1.EngagementContextContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Studio/V1/Flow/Engagement/StepContext.php000064400000007174150515725670017254 0ustar00solution = ['flowSid' => $flowSid, 'engagementSid' => $engagementSid, 'sid' => $sid, ]; $this->uri = '/Flows/' . \rawurlencode($flowSid) . '/Engagements/' . \rawurlencode($engagementSid) . '/Steps/' . \rawurlencode($sid) . ''; } /** * Fetch the StepInstance * * @return StepInstance Fetched StepInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): StepInstance { $payload = $this->version->fetch('GET', $this->uri); return new StepInstance( $this->version, $payload, $this->solution['flowSid'], $this->solution['engagementSid'], $this->solution['sid'] ); } /** * Access the stepContext */ protected function getStepContext(): StepContextList { if (!$this->_stepContext) { $this->_stepContext = new StepContextList( $this->version, $this->solution['flowSid'], $this->solution['engagementSid'], $this->solution['sid'] ); } return $this->_stepContext; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V1.StepContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Studio/V1/Flow/Engagement/StepPage.php000064400000002377150515725670016504 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return StepInstance \Twilio\Rest\Studio\V1\Flow\Engagement\StepInstance */ public function buildInstance(array $payload): StepInstance { return new StepInstance( $this->version, $payload, $this->solution['flowSid'], $this->solution['engagementSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V1.StepPage]'; } }src/Twilio/Rest/Studio/V1/Flow/Engagement/StepList.php000064400000011561150515725670016536 0ustar00solution = ['flowSid' => $flowSid, 'engagementSid' => $engagementSid, ]; $this->uri = '/Flows/' . \rawurlencode($flowSid) . '/Engagements/' . \rawurlencode($engagementSid) . '/Steps'; } /** * Streams StepInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads StepInstance 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 StepInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of StepInstance 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 StepPage Page of StepInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): StepPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new StepPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of StepInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return StepPage Page of StepInstance */ public function getPage(string $targetUrl): StepPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new StepPage($this->version, $response, $this->solution); } /** * Constructs a StepContext * * @param string $sid The SID that identifies the resource to fetch */ public function getContext(string $sid): StepContext { return new StepContext( $this->version, $this->solution['flowSid'], $this->solution['engagementSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V1.StepList]'; } }src/Twilio/Rest/Studio/V1/Flow/Engagement/EngagementContextList.php000064400000002357150515725670021245 0ustar00solution = ['flowSid' => $flowSid, 'engagementSid' => $engagementSid, ]; } /** * Constructs a EngagementContextContext */ public function getContext(): EngagementContextContext { return new EngagementContextContext( $this->version, $this->solution['flowSid'], $this->solution['engagementSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V1.EngagementContextList]'; } }src/Twilio/Rest/Studio/V1/Flow/Engagement/Step/StepContextContext.php000064400000003640150515725670021526 0ustar00solution = ['flowSid' => $flowSid, 'engagementSid' => $engagementSid, 'stepSid' => $stepSid, ]; $this->uri = '/Flows/' . \rawurlencode($flowSid) . '/Engagements/' . \rawurlencode($engagementSid) . '/Steps/' . \rawurlencode($stepSid) . '/Context'; } /** * Fetch the StepContextInstance * * @return StepContextInstance Fetched StepContextInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): StepContextInstance { $payload = $this->version->fetch('GET', $this->uri); return new StepContextInstance( $this->version, $payload, $this->solution['flowSid'], $this->solution['engagementSid'], $this->solution['stepSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V1.StepContextContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Studio/V1/Flow/Engagement/Step/StepContextInstance.php000064400000006641150515725670021652 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'context' => Values::array_get($payload, 'context'), 'engagementSid' => Values::array_get($payload, 'engagement_sid'), 'flowSid' => Values::array_get($payload, 'flow_sid'), 'stepSid' => Values::array_get($payload, 'step_sid'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['flowSid' => $flowSid, 'engagementSid' => $engagementSid, 'stepSid' => $stepSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return StepContextContext Context for this StepContextInstance */ protected function proxy(): StepContextContext { if (!$this->context) { $this->context = new StepContextContext( $this->version, $this->solution['flowSid'], $this->solution['engagementSid'], $this->solution['stepSid'] ); } return $this->context; } /** * Fetch the StepContextInstance * * @return StepContextInstance Fetched StepContextInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): StepContextInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V1.StepContextInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Studio/V1/Flow/Engagement/Step/StepContextList.php000064400000002535150515725670021017 0ustar00solution = ['flowSid' => $flowSid, 'engagementSid' => $engagementSid, 'stepSid' => $stepSid, ]; } /** * Constructs a StepContextContext */ public function getContext(): StepContextContext { return new StepContextContext( $this->version, $this->solution['flowSid'], $this->solution['engagementSid'], $this->solution['stepSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V1.StepContextList]'; } }src/Twilio/Rest/Studio/V1/Flow/Engagement/Step/StepContextPage.php000064400000002533150515725670020756 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return StepContextInstance \Twilio\Rest\Studio\V1\Flow\Engagement\Step\StepContextInstance */ public function buildInstance(array $payload): StepContextInstance { return new StepContextInstance( $this->version, $payload, $this->solution['flowSid'], $this->solution['engagementSid'], $this->solution['stepSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V1.StepContextPage]'; } }src/Twilio/Rest/Studio/V1/Flow/Engagement/StepInstance.php000064400000010531150515725670017363 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'flowSid' => Values::array_get($payload, 'flow_sid'), 'engagementSid' => Values::array_get($payload, 'engagement_sid'), 'name' => Values::array_get($payload, 'name'), 'context' => Values::array_get($payload, 'context'), 'transitionedFrom' => Values::array_get($payload, 'transitioned_from'), 'transitionedTo' => Values::array_get($payload, 'transitioned_to'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = [ 'flowSid' => $flowSid, 'engagementSid' => $engagementSid, '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 StepContext Context for this StepInstance */ protected function proxy(): StepContext { if (!$this->context) { $this->context = new StepContext( $this->version, $this->solution['flowSid'], $this->solution['engagementSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the StepInstance * * @return StepInstance Fetched StepInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): StepInstance { return $this->proxy()->fetch(); } /** * Access the stepContext */ protected function getStepContext(): StepContextList { return $this->proxy()->stepContext; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V1.StepInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Studio/V1/Flow/Engagement/EngagementContextInstance.php000064400000006356150515725670022101 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'context' => Values::array_get($payload, 'context'), 'engagementSid' => Values::array_get($payload, 'engagement_sid'), 'flowSid' => Values::array_get($payload, 'flow_sid'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['flowSid' => $flowSid, 'engagementSid' => $engagementSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return EngagementContextContext Context for this EngagementContextInstance */ protected function proxy(): EngagementContextContext { if (!$this->context) { $this->context = new EngagementContextContext( $this->version, $this->solution['flowSid'], $this->solution['engagementSid'] ); } return $this->context; } /** * Fetch the EngagementContextInstance * * @return EngagementContextInstance Fetched EngagementContextInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): EngagementContextInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V1.EngagementContextInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Studio/V1/FlowPage.php000064400000002147150515725670013512 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return FlowInstance \Twilio\Rest\Studio\V1\FlowInstance */ public function buildInstance(array $payload): FlowInstance { return new FlowInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V1.FlowPage]'; } }src/Twilio/Rest/Studio/V1/FlowContext.php000064400000007426150515725670014267 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Flows/' . \rawurlencode($sid) . ''; } /** * Fetch the FlowInstance * * @return FlowInstance Fetched FlowInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FlowInstance { $payload = $this->version->fetch('GET', $this->uri); return new FlowInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the FlowInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the engagements */ protected function getEngagements(): EngagementList { if (!$this->_engagements) { $this->_engagements = new EngagementList($this->version, $this->solution['sid']); } return $this->_engagements; } /** * Access the executions */ protected function getExecutions(): ExecutionList { if (!$this->_executions) { $this->_executions = new ExecutionList($this->version, $this->solution['sid']); } return $this->_executions; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V1.FlowContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Studio/V1.php000064400000004174150515725670012010 0ustar00version = 'v1'; } protected function getFlows(): FlowList { if (!$this->_flows) { $this->_flows = new FlowList($this); } return $this->_flows; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Studio.V1]'; } }src/Twilio/Rest/Studio/V2.php000064400000004712150515725670012007 0ustar00version = 'v2'; } protected function getFlows(): FlowList { if (!$this->_flows) { $this->_flows = new FlowList($this); } return $this->_flows; } protected function getFlowValidate(): FlowValidateList { if (!$this->_flowValidate) { $this->_flowValidate = new FlowValidateList($this); } return $this->_flowValidate; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Studio.V2]'; } }src/Twilio/Rest/Studio/V2/FlowList.php000064400000012733150515725670013554 0ustar00solution = []; $this->uri = '/Flows'; } /** * Create the FlowInstance * * @param string $friendlyName The string that you assigned to describe the Flow * @param string $status The status of the Flow * @param array $definition JSON representation of flow definition * @param array|Options $options Optional Arguments * @return FlowInstance Created FlowInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, string $status, array $definition, array $options = []): FlowInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $friendlyName, 'Status' => $status, 'Definition' => Serialize::jsonObject($definition), 'CommitMessage' => $options['commitMessage'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new FlowInstance($this->version, $payload); } /** * Streams FlowInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads FlowInstance 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 FlowInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of FlowInstance 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 FlowPage Page of FlowInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): FlowPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new FlowPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of FlowInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return FlowPage Page of FlowInstance */ public function getPage(string $targetUrl): FlowPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new FlowPage($this->version, $response, $this->solution); } /** * Constructs a FlowContext * * @param string $sid The SID that identifies the resource to fetch */ public function getContext(string $sid): FlowContext { return new FlowContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V2.FlowList]'; } }src/Twilio/Rest/Studio/V2/FlowOptions.php000064400000007570150515725670014277 0ustar00options['commitMessage'] = $commitMessage; } /** * Description of change made in the revision. * * @param string $commitMessage Description of change made in the revision * @return $this Fluent Builder */ public function setCommitMessage(string $commitMessage): self { $this->options['commitMessage'] = $commitMessage; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Studio.V2.CreateFlowOptions ' . $options . ']'; } } class UpdateFlowOptions extends Options { /** * @param string $friendlyName The string that you assigned to describe the Flow * @param array $definition JSON representation of flow definition * @param string $commitMessage Description of change made in the revision */ public function __construct(string $friendlyName = Values::NONE, array $definition = Values::ARRAY_NONE, string $commitMessage = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['definition'] = $definition; $this->options['commitMessage'] = $commitMessage; } /** * The string that you assigned to describe the Flow. * * @param string $friendlyName The string that you assigned to describe the Flow * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * JSON representation of flow definition. * * @param array $definition JSON representation of flow definition * @return $this Fluent Builder */ public function setDefinition(array $definition): self { $this->options['definition'] = $definition; return $this; } /** * Description of change made in the revision. * * @param string $commitMessage Description of change made in the revision * @return $this Fluent Builder */ public function setCommitMessage(string $commitMessage): self { $this->options['commitMessage'] = $commitMessage; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Studio.V2.UpdateFlowOptions ' . $options . ']'; } }src/Twilio/Rest/Studio/V2/FlowInstance.php000064400000012452150515725670014403 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'definition' => Values::array_get($payload, 'definition'), 'status' => Values::array_get($payload, 'status'), 'revision' => Values::array_get($payload, 'revision'), 'commitMessage' => Values::array_get($payload, 'commit_message'), 'valid' => Values::array_get($payload, 'valid'), 'errors' => Values::array_get($payload, 'errors'), 'warnings' => Values::array_get($payload, 'warnings'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'webhookUrl' => Values::array_get($payload, 'webhook_url'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 FlowContext Context for this FlowInstance */ protected function proxy(): FlowContext { if (!$this->context) { $this->context = new FlowContext($this->version, $this->solution['sid']); } return $this->context; } /** * Update the FlowInstance * * @param string $status The status of the Flow * @param array|Options $options Optional Arguments * @return FlowInstance Updated FlowInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $status, array $options = []): FlowInstance { return $this->proxy()->update($status, $options); } /** * Fetch the FlowInstance * * @return FlowInstance Fetched FlowInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FlowInstance { return $this->proxy()->fetch(); } /** * Delete the FlowInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the revisions */ protected function getRevisions(): FlowRevisionList { return $this->proxy()->revisions; } /** * Access the testUsers */ protected function getTestUsers(): FlowTestUserList { return $this->proxy()->testUsers; } /** * Access the executions */ protected function getExecutions(): ExecutionList { return $this->proxy()->executions; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V2.FlowInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Studio/V2/FlowValidateInstance.php000064400000003077150515725670016060 0ustar00properties = ['valid' => Values::array_get($payload, 'valid'), ]; $this->solution = []; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Studio.V2.FlowValidateInstance]'; } }src/Twilio/Rest/Studio/V2/FlowValidateList.php000064400000003552150515725670015225 0ustar00solution = []; $this->uri = '/Flows/Validate'; } /** * Update the FlowValidateInstance * * @param string $friendlyName The string that you assigned to describe the Flow * @param string $status The status of the Flow * @param array $definition JSON representation of flow definition * @param array|Options $options Optional Arguments * @return FlowValidateInstance Updated FlowValidateInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $friendlyName, string $status, array $definition, array $options = []): FlowValidateInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $friendlyName, 'Status' => $status, 'Definition' => Serialize::jsonObject($definition), 'CommitMessage' => $options['commitMessage'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new FlowValidateInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V2.FlowValidateList]'; } }src/Twilio/Rest/Studio/V2/Flow/ExecutionContext.php000064400000011573150515725670016231 0ustar00solution = ['flowSid' => $flowSid, 'sid' => $sid, ]; $this->uri = '/Flows/' . \rawurlencode($flowSid) . '/Executions/' . \rawurlencode($sid) . ''; } /** * Fetch the ExecutionInstance * * @return ExecutionInstance Fetched ExecutionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ExecutionInstance { $payload = $this->version->fetch('GET', $this->uri); return new ExecutionInstance( $this->version, $payload, $this->solution['flowSid'], $this->solution['sid'] ); } /** * Delete the ExecutionInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the ExecutionInstance * * @param string $status The status of the Execution * @return ExecutionInstance Updated ExecutionInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $status): ExecutionInstance { $data = Values::of(['Status' => $status, ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ExecutionInstance( $this->version, $payload, $this->solution['flowSid'], $this->solution['sid'] ); } /** * Access the steps */ protected function getSteps(): ExecutionStepList { if (!$this->_steps) { $this->_steps = new ExecutionStepList( $this->version, $this->solution['flowSid'], $this->solution['sid'] ); } return $this->_steps; } /** * Access the executionContext */ protected function getExecutionContext(): ExecutionContextList { if (!$this->_executionContext) { $this->_executionContext = new ExecutionContextList( $this->version, $this->solution['flowSid'], $this->solution['sid'] ); } return $this->_executionContext; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V2.ExecutionContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Studio/V2/Flow/FlowTestUserInstance.php000064400000006310150515725670017005 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'testUsers' => Values::array_get($payload, 'test_users'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['sid' => $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 FlowTestUserContext Context for this FlowTestUserInstance */ protected function proxy(): FlowTestUserContext { if (!$this->context) { $this->context = new FlowTestUserContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the FlowTestUserInstance * * @return FlowTestUserInstance Fetched FlowTestUserInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FlowTestUserInstance { return $this->proxy()->fetch(); } /** * Update the FlowTestUserInstance * * @param string[] $testUsers List of test user identities that can test draft * versions of the flow. * @return FlowTestUserInstance Updated FlowTestUserInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $testUsers): FlowTestUserInstance { return $this->proxy()->update($testUsers); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V2.FlowTestUserInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Studio/V2/Flow/Execution/ExecutionStepInstance.php000064400000010715150515725670021145 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'flowSid' => Values::array_get($payload, 'flow_sid'), 'executionSid' => Values::array_get($payload, 'execution_sid'), 'name' => Values::array_get($payload, 'name'), 'context' => Values::array_get($payload, 'context'), 'transitionedFrom' => Values::array_get($payload, 'transitioned_from'), 'transitionedTo' => Values::array_get($payload, 'transitioned_to'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = [ 'flowSid' => $flowSid, 'executionSid' => $executionSid, '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 ExecutionStepContext Context for this ExecutionStepInstance */ protected function proxy(): ExecutionStepContext { if (!$this->context) { $this->context = new ExecutionStepContext( $this->version, $this->solution['flowSid'], $this->solution['executionSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the ExecutionStepInstance * * @return ExecutionStepInstance Fetched ExecutionStepInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ExecutionStepInstance { return $this->proxy()->fetch(); } /** * Access the stepContext */ protected function getStepContext(): ExecutionStepContextList { return $this->proxy()->stepContext; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V2.ExecutionStepInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Studio/V2/Flow/Execution/ExecutionContextPage.php000064400000002504150515725670020763 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ExecutionContextInstance \Twilio\Rest\Studio\V2\Flow\Execution\ExecutionContextInstance */ public function buildInstance(array $payload): ExecutionContextInstance { return new ExecutionContextInstance( $this->version, $payload, $this->solution['flowSid'], $this->solution['executionSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V2.ExecutionContextPage]'; } }src/Twilio/Rest/Studio/V2/Flow/Execution/ExecutionContextInstance.php000064400000006357150515725670021665 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'context' => Values::array_get($payload, 'context'), 'flowSid' => Values::array_get($payload, 'flow_sid'), 'executionSid' => Values::array_get($payload, 'execution_sid'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['flowSid' => $flowSid, 'executionSid' => $executionSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return ExecutionContextContext Context for this ExecutionContextInstance */ protected function proxy(): ExecutionContextContext { if (!$this->context) { $this->context = new ExecutionContextContext( $this->version, $this->solution['flowSid'], $this->solution['executionSid'] ); } return $this->context; } /** * Fetch the ExecutionContextInstance * * @return ExecutionContextInstance Fetched ExecutionContextInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ExecutionContextInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V2.ExecutionContextInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Studio/V2/Flow/Execution/ExecutionStepPage.php000064400000002462150515725670020255 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ExecutionStepInstance \Twilio\Rest\Studio\V2\Flow\Execution\ExecutionStepInstance */ public function buildInstance(array $payload): ExecutionStepInstance { return new ExecutionStepInstance( $this->version, $payload, $this->solution['flowSid'], $this->solution['executionSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V2.ExecutionStepPage]'; } }src/Twilio/Rest/Studio/V2/Flow/Execution/ExecutionContextList.php000064400000002370150515725670021023 0ustar00solution = ['flowSid' => $flowSid, 'executionSid' => $executionSid, ]; } /** * Constructs a ExecutionContextContext */ public function getContext(): ExecutionContextContext { return new ExecutionContextContext( $this->version, $this->solution['flowSid'], $this->solution['executionSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V2.ExecutionContextList]'; } }src/Twilio/Rest/Studio/V2/Flow/Execution/ExecutionContextContext.php000064400000003444150515725670021537 0ustar00solution = ['flowSid' => $flowSid, 'executionSid' => $executionSid, ]; $this->uri = '/Flows/' . \rawurlencode($flowSid) . '/Executions/' . \rawurlencode($executionSid) . '/Context'; } /** * Fetch the ExecutionContextInstance * * @return ExecutionContextInstance Fetched ExecutionContextInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ExecutionContextInstance { $payload = $this->version->fetch('GET', $this->uri); return new ExecutionContextInstance( $this->version, $payload, $this->solution['flowSid'], $this->solution['executionSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V2.ExecutionContextContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Studio/V2/Flow/Execution/ExecutionStep/ExecutionStepContextInstance.php000064400000007056150515725670025315 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'context' => Values::array_get($payload, 'context'), 'executionSid' => Values::array_get($payload, 'execution_sid'), 'flowSid' => Values::array_get($payload, 'flow_sid'), 'stepSid' => Values::array_get($payload, 'step_sid'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['flowSid' => $flowSid, 'executionSid' => $executionSid, 'stepSid' => $stepSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return ExecutionStepContextContext Context for this * ExecutionStepContextInstance */ protected function proxy(): ExecutionStepContextContext { if (!$this->context) { $this->context = new ExecutionStepContextContext( $this->version, $this->solution['flowSid'], $this->solution['executionSid'], $this->solution['stepSid'] ); } return $this->context; } /** * Fetch the ExecutionStepContextInstance * * @return ExecutionStepContextInstance Fetched ExecutionStepContextInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ExecutionStepContextInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V2.ExecutionStepContextInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Studio/V2/Flow/Execution/ExecutionStep/ExecutionStepContextPage.php000064400000002640150515725670024417 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ExecutionStepContextInstance \Twilio\Rest\Studio\V2\Flow\Execution\ExecutionStep\ExecutionStepContextInstance */ public function buildInstance(array $payload): ExecutionStepContextInstance { return new ExecutionStepContextInstance( $this->version, $payload, $this->solution['flowSid'], $this->solution['executionSid'], $this->solution['stepSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V2.ExecutionStepContextPage]'; } }src/Twilio/Rest/Studio/V2/Flow/Execution/ExecutionStep/ExecutionStepContextContext.php000064400000003750150515725670025172 0ustar00solution = ['flowSid' => $flowSid, 'executionSid' => $executionSid, 'stepSid' => $stepSid, ]; $this->uri = '/Flows/' . \rawurlencode($flowSid) . '/Executions/' . \rawurlencode($executionSid) . '/Steps/' . \rawurlencode($stepSid) . '/Context'; } /** * Fetch the ExecutionStepContextInstance * * @return ExecutionStepContextInstance Fetched ExecutionStepContextInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ExecutionStepContextInstance { $payload = $this->version->fetch('GET', $this->uri); return new ExecutionStepContextInstance( $this->version, $payload, $this->solution['flowSid'], $this->solution['executionSid'], $this->solution['stepSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V2.ExecutionStepContextContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Studio/V2/Flow/Execution/ExecutionStep/ExecutionStepContextList.php000064400000002625150515725670024461 0ustar00solution = ['flowSid' => $flowSid, 'executionSid' => $executionSid, 'stepSid' => $stepSid, ]; } /** * Constructs a ExecutionStepContextContext */ public function getContext(): ExecutionStepContextContext { return new ExecutionStepContextContext( $this->version, $this->solution['flowSid'], $this->solution['executionSid'], $this->solution['stepSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V2.ExecutionStepContextList]'; } }src/Twilio/Rest/Studio/V2/Flow/Execution/ExecutionStepList.php000064400000012024150515725670020307 0ustar00solution = ['flowSid' => $flowSid, 'executionSid' => $executionSid, ]; $this->uri = '/Flows/' . \rawurlencode($flowSid) . '/Executions/' . \rawurlencode($executionSid) . '/Steps'; } /** * Streams ExecutionStepInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ExecutionStepInstance 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 ExecutionStepInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of ExecutionStepInstance 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 ExecutionStepPage Page of ExecutionStepInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ExecutionStepPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ExecutionStepPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ExecutionStepInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ExecutionStepPage Page of ExecutionStepInstance */ public function getPage(string $targetUrl): ExecutionStepPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ExecutionStepPage($this->version, $response, $this->solution); } /** * Constructs a ExecutionStepContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): ExecutionStepContext { return new ExecutionStepContext( $this->version, $this->solution['flowSid'], $this->solution['executionSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V2.ExecutionStepList]'; } }src/Twilio/Rest/Studio/V2/Flow/Execution/ExecutionStepContext.php000064400000007370150515725670021030 0ustar00solution = ['flowSid' => $flowSid, 'executionSid' => $executionSid, 'sid' => $sid, ]; $this->uri = '/Flows/' . \rawurlencode($flowSid) . '/Executions/' . \rawurlencode($executionSid) . '/Steps/' . \rawurlencode($sid) . ''; } /** * Fetch the ExecutionStepInstance * * @return ExecutionStepInstance Fetched ExecutionStepInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ExecutionStepInstance { $payload = $this->version->fetch('GET', $this->uri); return new ExecutionStepInstance( $this->version, $payload, $this->solution['flowSid'], $this->solution['executionSid'], $this->solution['sid'] ); } /** * Access the stepContext */ protected function getStepContext(): ExecutionStepContextList { if (!$this->_stepContext) { $this->_stepContext = new ExecutionStepContextList( $this->version, $this->solution['flowSid'], $this->solution['executionSid'], $this->solution['sid'] ); } return $this->_stepContext; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V2.ExecutionStepContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Studio/V2/Flow/FlowRevisionInstance.php000064400000010036150515725670017025 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'definition' => Values::array_get($payload, 'definition'), 'status' => Values::array_get($payload, 'status'), 'revision' => Values::array_get($payload, 'revision'), 'commitMessage' => Values::array_get($payload, 'commit_message'), 'valid' => Values::array_get($payload, 'valid'), 'errors' => Values::array_get($payload, 'errors'), '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 = ['sid' => $sid, 'revision' => $revision ?: $this->properties['revision'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return FlowRevisionContext Context for this FlowRevisionInstance */ protected function proxy(): FlowRevisionContext { if (!$this->context) { $this->context = new FlowRevisionContext( $this->version, $this->solution['sid'], $this->solution['revision'] ); } return $this->context; } /** * Fetch the FlowRevisionInstance * * @return FlowRevisionInstance Fetched FlowRevisionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FlowRevisionInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V2.FlowRevisionInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Studio/V2/Flow/ExecutionOptions.php000064400000010533150515725670016233 0ustar00options['dateCreatedFrom'] = $dateCreatedFrom; $this->options['dateCreatedTo'] = $dateCreatedTo; } /** * Only show Execution resources starting on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. * * @param \DateTime $dateCreatedFrom Only show Executions that started on or * after this ISO 8601 date-time * @return $this Fluent Builder */ public function setDateCreatedFrom(\DateTime $dateCreatedFrom): self { $this->options['dateCreatedFrom'] = $dateCreatedFrom; return $this; } /** * Only show Execution resources starting before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time, given as `YYYY-MM-DDThh:mm:ss-hh:mm`. * * @param \DateTime $dateCreatedTo Only show Executions that started before * this ISO 8601 date-time * @return $this Fluent Builder */ public function setDateCreatedTo(\DateTime $dateCreatedTo): self { $this->options['dateCreatedTo'] = $dateCreatedTo; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Studio.V2.ReadExecutionOptions ' . $options . ']'; } } class CreateExecutionOptions extends Options { /** * @param array $parameters JSON data that will be added to the Flow's context */ public function __construct(array $parameters = Values::ARRAY_NONE) { $this->options['parameters'] = $parameters; } /** * JSON data that will be added to the Flow's context and that can be accessed as variables inside your Flow. For example, if you pass in `Parameters={"name":"Zeke"}`, a widget in your Flow can reference the variable `{{flow.data.name}}`, which returns "Zeke". Note: the JSON value must explicitly be passed as a string, not as a hash object. Depending on your particular HTTP library, you may need to add quotes or URL encode the JSON string. * * @param array $parameters JSON data that will be added to the Flow's context * @return $this Fluent Builder */ public function setParameters(array $parameters): self { $this->options['parameters'] = $parameters; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Studio.V2.CreateExecutionOptions ' . $options . ']'; } }src/Twilio/Rest/Studio/V2/Flow/ExecutionList.php000064400000014332150515725670015514 0ustar00solution = ['flowSid' => $flowSid, ]; $this->uri = '/Flows/' . \rawurlencode($flowSid) . '/Executions'; } /** * Streams ExecutionInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ExecutionInstance 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 ExecutionInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of ExecutionInstance 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 ExecutionPage Page of ExecutionInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ExecutionPage { $options = new Values($options); $params = Values::of([ 'DateCreatedFrom' => Serialize::iso8601DateTime($options['dateCreatedFrom']), 'DateCreatedTo' => Serialize::iso8601DateTime($options['dateCreatedTo']), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ExecutionPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ExecutionInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ExecutionPage Page of ExecutionInstance */ public function getPage(string $targetUrl): ExecutionPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ExecutionPage($this->version, $response, $this->solution); } /** * Create the ExecutionInstance * * @param string $to The Contact phone number to start a Studio Flow Execution * @param string $from The Twilio phone number or Messaging Service SID to send * messages or initiate calls from during the Flow Execution * @param array|Options $options Optional Arguments * @return ExecutionInstance Created ExecutionInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $to, string $from, array $options = []): ExecutionInstance { $options = new Values($options); $data = Values::of([ 'To' => $to, 'From' => $from, 'Parameters' => Serialize::jsonObject($options['parameters']), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ExecutionInstance($this->version, $payload, $this->solution['flowSid']); } /** * Constructs a ExecutionContext * * @param string $sid The SID of the Execution resource to fetch */ public function getContext(string $sid): ExecutionContext { return new ExecutionContext($this->version, $this->solution['flowSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V2.ExecutionList]'; } }src/Twilio/Rest/Studio/V2/Flow/FlowTestUserList.php000064400000002013150515725670016150 0ustar00solution = ['sid' => $sid, ]; } /** * Constructs a FlowTestUserContext */ public function getContext(): FlowTestUserContext { return new FlowTestUserContext($this->version, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V2.FlowTestUserList]'; } }src/Twilio/Rest/Studio/V2/Flow/FlowRevisionPage.php000064400000002271150515725670016137 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return FlowRevisionInstance \Twilio\Rest\Studio\V2\Flow\FlowRevisionInstance */ public function buildInstance(array $payload): FlowRevisionInstance { return new FlowRevisionInstance($this->version, $payload, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V2.FlowRevisionPage]'; } }src/Twilio/Rest/Studio/V2/Flow/FlowTestUserContext.php000064400000004255150515725670016673 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Flows/' . \rawurlencode($sid) . '/TestUsers'; } /** * Fetch the FlowTestUserInstance * * @return FlowTestUserInstance Fetched FlowTestUserInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FlowTestUserInstance { $payload = $this->version->fetch('GET', $this->uri); return new FlowTestUserInstance($this->version, $payload, $this->solution['sid']); } /** * Update the FlowTestUserInstance * * @param string[] $testUsers List of test user identities that can test draft * versions of the flow. * @return FlowTestUserInstance Updated FlowTestUserInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $testUsers): FlowTestUserInstance { $data = Values::of(['TestUsers' => Serialize::map($testUsers, function($e) { return $e; }), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new FlowTestUserInstance($this->version, $payload, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V2.FlowTestUserContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Studio/V2/Flow/FlowRevisionContext.php000064400000003453150515725670016712 0ustar00solution = ['sid' => $sid, 'revision' => $revision, ]; $this->uri = '/Flows/' . \rawurlencode($sid) . '/Revisions/' . \rawurlencode($revision) . ''; } /** * Fetch the FlowRevisionInstance * * @return FlowRevisionInstance Fetched FlowRevisionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FlowRevisionInstance { $payload = $this->version->fetch('GET', $this->uri); return new FlowRevisionInstance( $this->version, $payload, $this->solution['sid'], $this->solution['revision'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V2.FlowRevisionContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Studio/V2/Flow/ExecutionInstance.php000064400000011472150515725670016347 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'flowSid' => Values::array_get($payload, 'flow_sid'), 'contactChannelAddress' => Values::array_get($payload, 'contact_channel_address'), 'context' => Values::array_get($payload, 'context'), 'status' => Values::array_get($payload, 'status'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['flowSid' => $flowSid, '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 ExecutionContext Context for this ExecutionInstance */ protected function proxy(): ExecutionContext { if (!$this->context) { $this->context = new ExecutionContext( $this->version, $this->solution['flowSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the ExecutionInstance * * @return ExecutionInstance Fetched ExecutionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ExecutionInstance { return $this->proxy()->fetch(); } /** * Delete the ExecutionInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the ExecutionInstance * * @param string $status The status of the Execution * @return ExecutionInstance Updated ExecutionInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $status): ExecutionInstance { return $this->proxy()->update($status); } /** * Access the steps */ protected function getSteps(): ExecutionStepList { return $this->proxy()->steps; } /** * Access the executionContext */ protected function getExecutionContext(): ExecutionContextList { return $this->proxy()->executionContext; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V2.ExecutionInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Studio/V2/Flow/FlowTestUserPage.php000064400000002271150515725670016117 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return FlowTestUserInstance \Twilio\Rest\Studio\V2\Flow\FlowTestUserInstance */ public function buildInstance(array $payload): FlowTestUserInstance { return new FlowTestUserInstance($this->version, $payload, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V2.FlowTestUserPage]'; } }src/Twilio/Rest/Studio/V2/Flow/ExecutionPage.php000064400000002253150515725670015454 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ExecutionInstance \Twilio\Rest\Studio\V2\Flow\ExecutionInstance */ public function buildInstance(array $payload): ExecutionInstance { return new ExecutionInstance($this->version, $payload, $this->solution['flowSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V2.ExecutionPage]'; } }src/Twilio/Rest/Studio/V2/Flow/FlowRevisionList.php000064400000011511150515725670016173 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Flows/' . \rawurlencode($sid) . '/Revisions'; } /** * Streams FlowRevisionInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads FlowRevisionInstance 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 FlowRevisionInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of FlowRevisionInstance 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 FlowRevisionPage Page of FlowRevisionInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): FlowRevisionPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new FlowRevisionPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of FlowRevisionInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return FlowRevisionPage Page of FlowRevisionInstance */ public function getPage(string $targetUrl): FlowRevisionPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new FlowRevisionPage($this->version, $response, $this->solution); } /** * Constructs a FlowRevisionContext * * @param string $revision Specific Revision number or can be `LatestPublished` * and `LatestRevision` */ public function getContext(string $revision): FlowRevisionContext { return new FlowRevisionContext($this->version, $this->solution['sid'], $revision); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V2.FlowRevisionList]'; } }src/Twilio/Rest/Studio/V2/FlowPage.php000064400000002147150515725670013513 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return FlowInstance \Twilio\Rest\Studio\V2\FlowInstance */ public function buildInstance(array $payload): FlowInstance { return new FlowInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V2.FlowPage]'; } }src/Twilio/Rest/Studio/V2/FlowValidateOptions.php000064400000002735150515725670015747 0ustar00options['commitMessage'] = $commitMessage; } /** * Description of change made in the revision. * * @param string $commitMessage Description of change made in the revision * @return $this Fluent Builder */ public function setCommitMessage(string $commitMessage): self { $this->options['commitMessage'] = $commitMessage; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Studio.V2.UpdateFlowValidateOptions ' . $options . ']'; } }src/Twilio/Rest/Studio/V2/FlowValidatePage.php000064400000002227150515725670015164 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return FlowValidateInstance \Twilio\Rest\Studio\V2\FlowValidateInstance */ public function buildInstance(array $payload): FlowValidateInstance { return new FlowValidateInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio.V2.FlowValidatePage]'; } }src/Twilio/Rest/Studio/V2/FlowContext.php000064400000012111150515725670014253 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Flows/' . \rawurlencode($sid) . ''; } /** * Update the FlowInstance * * @param string $status The status of the Flow * @param array|Options $options Optional Arguments * @return FlowInstance Updated FlowInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $status, array $options = []): FlowInstance { $options = new Values($options); $data = Values::of([ 'Status' => $status, 'FriendlyName' => $options['friendlyName'], 'Definition' => Serialize::jsonObject($options['definition']), 'CommitMessage' => $options['commitMessage'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new FlowInstance($this->version, $payload, $this->solution['sid']); } /** * Fetch the FlowInstance * * @return FlowInstance Fetched FlowInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FlowInstance { $payload = $this->version->fetch('GET', $this->uri); return new FlowInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the FlowInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the revisions */ protected function getRevisions(): FlowRevisionList { if (!$this->_revisions) { $this->_revisions = new FlowRevisionList($this->version, $this->solution['sid']); } return $this->_revisions; } /** * Access the testUsers */ protected function getTestUsers(): FlowTestUserList { if (!$this->_testUsers) { $this->_testUsers = new FlowTestUserList($this->version, $this->solution['sid']); } return $this->_testUsers; } /** * Access the executions */ protected function getExecutions(): ExecutionList { if (!$this->_executions) { $this->_executions = new ExecutionList($this->version, $this->solution['sid']); } return $this->_executions; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Studio.V2.FlowContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trusthub/V1/TrustProductsContext.php000064400000014140150515725670016565 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/TrustProducts/' . \rawurlencode($sid) . ''; } /** * Fetch the TrustProductsInstance * * @return TrustProductsInstance Fetched TrustProductsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TrustProductsInstance { $payload = $this->version->fetch('GET', $this->uri); return new TrustProductsInstance($this->version, $payload, $this->solution['sid']); } /** * Update the TrustProductsInstance * * @param array|Options $options Optional Arguments * @return TrustProductsInstance Updated TrustProductsInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): TrustProductsInstance { $options = new Values($options); $data = Values::of([ 'Status' => $options['status'], 'StatusCallback' => $options['statusCallback'], 'FriendlyName' => $options['friendlyName'], 'Email' => $options['email'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new TrustProductsInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the TrustProductsInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the trustProductsEntityAssignments */ protected function getTrustProductsEntityAssignments(): TrustProductsEntityAssignmentsList { if (!$this->_trustProductsEntityAssignments) { $this->_trustProductsEntityAssignments = new TrustProductsEntityAssignmentsList( $this->version, $this->solution['sid'] ); } return $this->_trustProductsEntityAssignments; } /** * Access the trustProductsEvaluations */ protected function getTrustProductsEvaluations(): TrustProductsEvaluationsList { if (!$this->_trustProductsEvaluations) { $this->_trustProductsEvaluations = new TrustProductsEvaluationsList( $this->version, $this->solution['sid'] ); } return $this->_trustProductsEvaluations; } /** * Access the trustProductsChannelEndpointAssignment */ protected function getTrustProductsChannelEndpointAssignment(): TrustProductsChannelEndpointAssignmentList { if (!$this->_trustProductsChannelEndpointAssignment) { $this->_trustProductsChannelEndpointAssignment = new TrustProductsChannelEndpointAssignmentList( $this->version, $this->solution['sid'] ); } return $this->_trustProductsChannelEndpointAssignment; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trusthub.V1.TrustProductsContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trusthub/V1/CustomerProfilesPage.php000064400000002265150515725670016462 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CustomerProfilesInstance \Twilio\Rest\Trusthub\V1\CustomerProfilesInstance */ public function buildInstance(array $payload): CustomerProfilesInstance { return new CustomerProfilesInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trusthub.V1.CustomerProfilesPage]'; } }src/Twilio/Rest/Trusthub/V1/TrustProductsList.php000064400000014222150515725670016055 0ustar00solution = []; $this->uri = '/TrustProducts'; } /** * Create the TrustProductsInstance * * @param string $friendlyName The string that you assigned to describe the * resource * @param string $email The email address * @param string $policySid The unique string of a policy. * @param array|Options $options Optional Arguments * @return TrustProductsInstance Created TrustProductsInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, string $email, string $policySid, array $options = []): TrustProductsInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $friendlyName, 'Email' => $email, 'PolicySid' => $policySid, 'StatusCallback' => $options['statusCallback'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new TrustProductsInstance($this->version, $payload); } /** * Streams TrustProductsInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads TrustProductsInstance 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 TrustProductsInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of TrustProductsInstance 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 TrustProductsPage Page of TrustProductsInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): TrustProductsPage { $options = new Values($options); $params = Values::of([ 'Status' => $options['status'], 'FriendlyName' => $options['friendlyName'], 'PolicySid' => $options['policySid'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new TrustProductsPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of TrustProductsInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return TrustProductsPage Page of TrustProductsInstance */ public function getPage(string $targetUrl): TrustProductsPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new TrustProductsPage($this->version, $response, $this->solution); } /** * Constructs a TrustProductsContext * * @param string $sid The unique string that identifies the resource. */ public function getContext(string $sid): TrustProductsContext { return new TrustProductsContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trusthub.V1.TrustProductsList]'; } }src/Twilio/Rest/Trusthub/V1/SupportingDocumentOptions.php000064400000007767150515725670017621 0ustar00options['attributes'] = $attributes; } /** * The set of parameters that are the attributes of the Supporting Documents resource which are derived Supporting Document Types. * * @param array $attributes The set of parameters that compose the Supporting * Documents resource * @return $this Fluent Builder */ public function setAttributes(array $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Trusthub.V1.CreateSupportingDocumentOptions ' . $options . ']'; } } class UpdateSupportingDocumentOptions extends Options { /** * @param string $friendlyName The string that you assigned to describe the * resource * @param array $attributes The set of parameters that compose the Supporting * Document resource */ public function __construct(string $friendlyName = Values::NONE, array $attributes = Values::ARRAY_NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['attributes'] = $attributes; } /** * The string that you assigned to describe the resource. * * @param string $friendlyName The string that you assigned to describe the * resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The set of parameters that are the attributes of the Supporting Document resource which are derived Supporting Document Types. * * @param array $attributes The set of parameters that compose the Supporting * Document resource * @return $this Fluent Builder */ public function setAttributes(array $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Trusthub.V1.UpdateSupportingDocumentOptions ' . $options . ']'; } }src/Twilio/Rest/Trusthub/V1/SupportingDocumentList.php000064400000013350150515725670017062 0ustar00solution = []; $this->uri = '/SupportingDocuments'; } /** * Create the SupportingDocumentInstance * * @param string $friendlyName The string that you assigned to describe the * resource * @param string $type The type of the Supporting Document * @param array|Options $options Optional Arguments * @return SupportingDocumentInstance Created SupportingDocumentInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, string $type, array $options = []): SupportingDocumentInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $friendlyName, 'Type' => $type, 'Attributes' => Serialize::jsonObject($options['attributes']), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new SupportingDocumentInstance($this->version, $payload); } /** * Streams SupportingDocumentInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads SupportingDocumentInstance 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 SupportingDocumentInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of SupportingDocumentInstance 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 SupportingDocumentPage Page of SupportingDocumentInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SupportingDocumentPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new SupportingDocumentPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of SupportingDocumentInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return SupportingDocumentPage Page of SupportingDocumentInstance */ public function getPage(string $targetUrl): SupportingDocumentPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new SupportingDocumentPage($this->version, $response, $this->solution); } /** * Constructs a SupportingDocumentContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): SupportingDocumentContext { return new SupportingDocumentContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trusthub.V1.SupportingDocumentList]'; } }src/Twilio/Rest/Trusthub/V1/EndUserTypeList.php000064400000011170150515725670015416 0ustar00solution = []; $this->uri = '/EndUserTypes'; } /** * Streams EndUserTypeInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads EndUserTypeInstance 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 EndUserTypeInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of EndUserTypeInstance 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 EndUserTypePage Page of EndUserTypeInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): EndUserTypePage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new EndUserTypePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of EndUserTypeInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return EndUserTypePage Page of EndUserTypeInstance */ public function getPage(string $targetUrl): EndUserTypePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new EndUserTypePage($this->version, $response, $this->solution); } /** * Constructs a EndUserTypeContext * * @param string $sid The unique string that identifies the End-User Type * resource */ public function getContext(string $sid): EndUserTypeContext { return new EndUserTypeContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trusthub.V1.EndUserTypeList]'; } }src/Twilio/Rest/Trusthub/V1/PoliciesContext.php000064400000002747150515725670015501 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Policies/' . \rawurlencode($sid) . ''; } /** * Fetch the PoliciesInstance * * @return PoliciesInstance Fetched PoliciesInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): PoliciesInstance { $payload = $this->version->fetch('GET', $this->uri); return new PoliciesInstance($this->version, $payload, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trusthub.V1.PoliciesContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trusthub/V1/CustomerProfilesInstance.php000064400000013173150515725670017352 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'policySid' => Values::array_get($payload, 'policy_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'status' => Values::array_get($payload, 'status'), 'validUntil' => Deserialize::dateTime(Values::array_get($payload, 'valid_until')), 'email' => Values::array_get($payload, 'email'), 'statusCallback' => Values::array_get($payload, 'status_callback'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 CustomerProfilesContext Context for this CustomerProfilesInstance */ protected function proxy(): CustomerProfilesContext { if (!$this->context) { $this->context = new CustomerProfilesContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the CustomerProfilesInstance * * @return CustomerProfilesInstance Fetched CustomerProfilesInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CustomerProfilesInstance { return $this->proxy()->fetch(); } /** * Update the CustomerProfilesInstance * * @param array|Options $options Optional Arguments * @return CustomerProfilesInstance Updated CustomerProfilesInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): CustomerProfilesInstance { return $this->proxy()->update($options); } /** * Delete the CustomerProfilesInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the customerProfilesEntityAssignments */ protected function getCustomerProfilesEntityAssignments(): CustomerProfilesEntityAssignmentsList { return $this->proxy()->customerProfilesEntityAssignments; } /** * Access the customerProfilesEvaluations */ protected function getCustomerProfilesEvaluations(): CustomerProfilesEvaluationsList { return $this->proxy()->customerProfilesEvaluations; } /** * Access the customerProfilesChannelEndpointAssignment */ protected function getCustomerProfilesChannelEndpointAssignment(): CustomerProfilesChannelEndpointAssignmentList { return $this->proxy()->customerProfilesChannelEndpointAssignment; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trusthub.V1.CustomerProfilesInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trusthub/V1/TrustProducts/TrustProductsChannelEndpointAssignmentOptions.php000064400000004747150515725670026500 0ustar00options['channelEndpointSid'] = $channelEndpointSid; $this->options['channelEndpointSids'] = $channelEndpointSids; } /** * The SID of an channel endpoint * * @param string $channelEndpointSid The sid of an channel endpoint * @return $this Fluent Builder */ public function setChannelEndpointSid(string $channelEndpointSid): self { $this->options['channelEndpointSid'] = $channelEndpointSid; return $this; } /** * comma separated list of channel endpoint sids * * @param string $channelEndpointSids comma separated list of channel endpoint * sids * @return $this Fluent Builder */ public function setChannelEndpointSids(string $channelEndpointSids): self { $this->options['channelEndpointSids'] = $channelEndpointSids; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Trusthub.V1.ReadTrustProductsChannelEndpointAssignmentOptions ' . $options . ']'; } }src/Twilio/Rest/Trusthub/V1/TrustProducts/TrustProductsEvaluationsList.php000064400000013604150515725670023140 0ustar00solution = ['trustProductSid' => $trustProductSid, ]; $this->uri = '/TrustProducts/' . \rawurlencode($trustProductSid) . '/Evaluations'; } /** * Create the TrustProductsEvaluationsInstance * * @param string $policySid The unique string of a policy * @return TrustProductsEvaluationsInstance Created * TrustProductsEvaluationsInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $policySid): TrustProductsEvaluationsInstance { $data = Values::of(['PolicySid' => $policySid, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new TrustProductsEvaluationsInstance( $this->version, $payload, $this->solution['trustProductSid'] ); } /** * Streams TrustProductsEvaluationsInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads TrustProductsEvaluationsInstance 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 TrustProductsEvaluationsInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of TrustProductsEvaluationsInstance 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 TrustProductsEvaluationsPage Page of TrustProductsEvaluationsInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): TrustProductsEvaluationsPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new TrustProductsEvaluationsPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of TrustProductsEvaluationsInstance records from * the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return TrustProductsEvaluationsPage Page of TrustProductsEvaluationsInstance */ public function getPage(string $targetUrl): TrustProductsEvaluationsPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new TrustProductsEvaluationsPage($this->version, $response, $this->solution); } /** * Constructs a TrustProductsEvaluationsContext * * @param string $sid The unique string that identifies the Evaluation resource */ public function getContext(string $sid): TrustProductsEvaluationsContext { return new TrustProductsEvaluationsContext( $this->version, $this->solution['trustProductSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trusthub.V1.TrustProductsEvaluationsList]'; } }src/Twilio/Rest/Trusthub/V1/TrustProducts/TrustProductsEvaluationsPage.php000064400000002523150515725670023077 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return TrustProductsEvaluationsInstance \Twilio\Rest\Trusthub\V1\TrustProducts\TrustProductsEvaluationsInstance */ public function buildInstance(array $payload): TrustProductsEvaluationsInstance { return new TrustProductsEvaluationsInstance( $this->version, $payload, $this->solution['trustProductSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trusthub.V1.TrustProductsEvaluationsPage]'; } }src/Twilio/Rest/Trusthub/V1/TrustProducts/TrustProductsEntityAssignmentsList.php000064400000014250150515725670024334 0ustar00solution = ['trustProductSid' => $trustProductSid, ]; $this->uri = '/TrustProducts/' . \rawurlencode($trustProductSid) . '/EntityAssignments'; } /** * Create the TrustProductsEntityAssignmentsInstance * * @param string $objectSid The sid of an object bag * @return TrustProductsEntityAssignmentsInstance Created * TrustProductsEntityAssignmentsInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $objectSid): TrustProductsEntityAssignmentsInstance { $data = Values::of(['ObjectSid' => $objectSid, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new TrustProductsEntityAssignmentsInstance( $this->version, $payload, $this->solution['trustProductSid'] ); } /** * Streams TrustProductsEntityAssignmentsInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads TrustProductsEntityAssignmentsInstance 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 TrustProductsEntityAssignmentsInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of TrustProductsEntityAssignmentsInstance 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 TrustProductsEntityAssignmentsPage Page of * TrustProductsEntityAssignmentsInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): TrustProductsEntityAssignmentsPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new TrustProductsEntityAssignmentsPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of TrustProductsEntityAssignmentsInstance records * from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return TrustProductsEntityAssignmentsPage Page of * TrustProductsEntityAssignmentsInstance */ public function getPage(string $targetUrl): TrustProductsEntityAssignmentsPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new TrustProductsEntityAssignmentsPage($this->version, $response, $this->solution); } /** * Constructs a TrustProductsEntityAssignmentsContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): TrustProductsEntityAssignmentsContext { return new TrustProductsEntityAssignmentsContext( $this->version, $this->solution['trustProductSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trusthub.V1.TrustProductsEntityAssignmentsList]'; } }src/Twilio/Rest/Trusthub/V1/TrustProducts/TrustProductsChannelEndpointAssignmentPage.php000064400000002647150515725670025716 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return TrustProductsChannelEndpointAssignmentInstance \Twilio\Rest\Trusthub\V1\TrustProducts\TrustProductsChannelEndpointAssignmentInstance */ public function buildInstance(array $payload): TrustProductsChannelEndpointAssignmentInstance { return new TrustProductsChannelEndpointAssignmentInstance( $this->version, $payload, $this->solution['trustProductSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trusthub.V1.TrustProductsChannelEndpointAssignmentPage]'; } }src/Twilio/Rest/Trusthub/V1/TrustProducts/TrustProductsChannelEndpointAssignmentContext.php000064400000004657150515725670026471 0ustar00solution = ['trustProductSid' => $trustProductSid, 'sid' => $sid, ]; $this->uri = '/TrustProducts/' . \rawurlencode($trustProductSid) . '/ChannelEndpointAssignments/' . \rawurlencode($sid) . ''; } /** * Fetch the TrustProductsChannelEndpointAssignmentInstance * * @return TrustProductsChannelEndpointAssignmentInstance Fetched * TrustProductsChannelEndpointAssignmentInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TrustProductsChannelEndpointAssignmentInstance { $payload = $this->version->fetch('GET', $this->uri); return new TrustProductsChannelEndpointAssignmentInstance( $this->version, $payload, $this->solution['trustProductSid'], $this->solution['sid'] ); } /** * Delete the TrustProductsChannelEndpointAssignmentInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trusthub.V1.TrustProductsChannelEndpointAssignmentContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trusthub/V1/TrustProducts/TrustProductsEntityAssignmentsPage.php000064400000002567150515725670024305 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return TrustProductsEntityAssignmentsInstance \Twilio\Rest\Trusthub\V1\TrustProducts\TrustProductsEntityAssignmentsInstance */ public function buildInstance(array $payload): TrustProductsEntityAssignmentsInstance { return new TrustProductsEntityAssignmentsInstance( $this->version, $payload, $this->solution['trustProductSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trusthub.V1.TrustProductsEntityAssignmentsPage]'; } }src/Twilio/Rest/Trusthub/V1/TrustProducts/TrustProductsEntityAssignmentsContext.php000064400000004526150515725670025052 0ustar00solution = ['trustProductSid' => $trustProductSid, 'sid' => $sid, ]; $this->uri = '/TrustProducts/' . \rawurlencode($trustProductSid) . '/EntityAssignments/' . \rawurlencode($sid) . ''; } /** * Fetch the TrustProductsEntityAssignmentsInstance * * @return TrustProductsEntityAssignmentsInstance Fetched * TrustProductsEntityAssignmentsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TrustProductsEntityAssignmentsInstance { $payload = $this->version->fetch('GET', $this->uri); return new TrustProductsEntityAssignmentsInstance( $this->version, $payload, $this->solution['trustProductSid'], $this->solution['sid'] ); } /** * Delete the TrustProductsEntityAssignmentsInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trusthub.V1.TrustProductsEntityAssignmentsContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trusthub/V1/TrustProducts/TrustProductsEvaluationsContext.php000064400000003716150515725670023654 0ustar00solution = ['trustProductSid' => $trustProductSid, 'sid' => $sid, ]; $this->uri = '/TrustProducts/' . \rawurlencode($trustProductSid) . '/Evaluations/' . \rawurlencode($sid) . ''; } /** * Fetch the TrustProductsEvaluationsInstance * * @return TrustProductsEvaluationsInstance Fetched * TrustProductsEvaluationsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TrustProductsEvaluationsInstance { $payload = $this->version->fetch('GET', $this->uri); return new TrustProductsEvaluationsInstance( $this->version, $payload, $this->solution['trustProductSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trusthub.V1.TrustProductsEvaluationsContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trusthub/V1/TrustProducts/TrustProductsChannelEndpointAssignmentInstance.php000064400000010554150515725670026602 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'trustProductSid' => Values::array_get($payload, 'trust_product_sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'channelEndpointType' => Values::array_get($payload, 'channel_endpoint_type'), 'channelEndpointSid' => Values::array_get($payload, 'channel_endpoint_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'trustProductSid' => $trustProductSid, '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 TrustProductsChannelEndpointAssignmentContext Context for this * TrustProductsChannelEndpointAssignmentInstance */ protected function proxy(): TrustProductsChannelEndpointAssignmentContext { if (!$this->context) { $this->context = new TrustProductsChannelEndpointAssignmentContext( $this->version, $this->solution['trustProductSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the TrustProductsChannelEndpointAssignmentInstance * * @return TrustProductsChannelEndpointAssignmentInstance Fetched * TrustProductsChannelEndpointAssignmentInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TrustProductsChannelEndpointAssignmentInstance { return $this->proxy()->fetch(); } /** * Delete the TrustProductsChannelEndpointAssignmentInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trusthub.V1.TrustProductsChannelEndpointAssignmentInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trusthub/V1/TrustProducts/TrustProductsEntityAssignmentsInstance.php000064400000010131150515725670025157 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'trustProductSid' => Values::array_get($payload, 'trust_product_sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'objectSid' => Values::array_get($payload, 'object_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'trustProductSid' => $trustProductSid, '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 TrustProductsEntityAssignmentsContext Context for this * TrustProductsEntityAssignmentsInstance */ protected function proxy(): TrustProductsEntityAssignmentsContext { if (!$this->context) { $this->context = new TrustProductsEntityAssignmentsContext( $this->version, $this->solution['trustProductSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the TrustProductsEntityAssignmentsInstance * * @return TrustProductsEntityAssignmentsInstance Fetched * TrustProductsEntityAssignmentsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TrustProductsEntityAssignmentsInstance { return $this->proxy()->fetch(); } /** * Delete the TrustProductsEntityAssignmentsInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trusthub.V1.TrustProductsEntityAssignmentsInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trusthub/V1/TrustProducts/TrustProductsChannelEndpointAssignmentList.php000064400000016141150515725670025747 0ustar00solution = ['trustProductSid' => $trustProductSid, ]; $this->uri = '/TrustProducts/' . \rawurlencode($trustProductSid) . '/ChannelEndpointAssignments'; } /** * Create the TrustProductsChannelEndpointAssignmentInstance * * @param string $channelEndpointType The type of channel endpoint * @param string $channelEndpointSid The sid of an channel endpoint * @return TrustProductsChannelEndpointAssignmentInstance Created * TrustProductsChannelEndpointAssignmentInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $channelEndpointType, string $channelEndpointSid): TrustProductsChannelEndpointAssignmentInstance { $data = Values::of([ 'ChannelEndpointType' => $channelEndpointType, 'ChannelEndpointSid' => $channelEndpointSid, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new TrustProductsChannelEndpointAssignmentInstance( $this->version, $payload, $this->solution['trustProductSid'] ); } /** * Streams TrustProductsChannelEndpointAssignmentInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads TrustProductsChannelEndpointAssignmentInstance 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 TrustProductsChannelEndpointAssignmentInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of TrustProductsChannelEndpointAssignmentInstance * 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 TrustProductsChannelEndpointAssignmentPage Page of * TrustProductsChannelEndpointAssignmentInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): TrustProductsChannelEndpointAssignmentPage { $options = new Values($options); $params = Values::of([ 'ChannelEndpointSid' => $options['channelEndpointSid'], 'ChannelEndpointSids' => $options['channelEndpointSids'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new TrustProductsChannelEndpointAssignmentPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of TrustProductsChannelEndpointAssignmentInstance * records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return TrustProductsChannelEndpointAssignmentPage Page of * TrustProductsChannelEndpointAssignmentInstance */ public function getPage(string $targetUrl): TrustProductsChannelEndpointAssignmentPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new TrustProductsChannelEndpointAssignmentPage($this->version, $response, $this->solution); } /** * Constructs a TrustProductsChannelEndpointAssignmentContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): TrustProductsChannelEndpointAssignmentContext { return new TrustProductsChannelEndpointAssignmentContext( $this->version, $this->solution['trustProductSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trusthub.V1.TrustProductsChannelEndpointAssignmentList]'; } }src/Twilio/Rest/Trusthub/V1/TrustProducts/TrustProductsEvaluationsInstance.php000064400000007600150515725670023770 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'policySid' => Values::array_get($payload, 'policy_sid'), 'trustProductSid' => Values::array_get($payload, 'trust_product_sid'), 'status' => Values::array_get($payload, 'status'), 'results' => Values::array_get($payload, 'results'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'trustProductSid' => $trustProductSid, '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 TrustProductsEvaluationsContext Context for this * TrustProductsEvaluationsInstance */ protected function proxy(): TrustProductsEvaluationsContext { if (!$this->context) { $this->context = new TrustProductsEvaluationsContext( $this->version, $this->solution['trustProductSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the TrustProductsEvaluationsInstance * * @return TrustProductsEvaluationsInstance Fetched * TrustProductsEvaluationsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TrustProductsEvaluationsInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trusthub.V1.TrustProductsEvaluationsInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trusthub/V1/PoliciesPage.php000064400000002205150515725670014716 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return PoliciesInstance \Twilio\Rest\Trusthub\V1\PoliciesInstance */ public function buildInstance(array $payload): PoliciesInstance { return new PoliciesInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trusthub.V1.PoliciesPage]'; } }src/Twilio/Rest/Trusthub/V1/SupportingDocumentTypeContext.php000064400000003222150515725670020432 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/SupportingDocumentTypes/' . \rawurlencode($sid) . ''; } /** * Fetch the SupportingDocumentTypeInstance * * @return SupportingDocumentTypeInstance Fetched SupportingDocumentTypeInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SupportingDocumentTypeInstance { $payload = $this->version->fetch('GET', $this->uri); return new SupportingDocumentTypeInstance($this->version, $payload, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trusthub.V1.SupportingDocumentTypeContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trusthub/V1/SupportingDocumentPage.php000064400000002301150515725670017015 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SupportingDocumentInstance \Twilio\Rest\Trusthub\V1\SupportingDocumentInstance */ public function buildInstance(array $payload): SupportingDocumentInstance { return new SupportingDocumentInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trusthub.V1.SupportingDocumentPage]'; } }src/Twilio/Rest/Trusthub/V1/EndUserContext.php000064400000004677150515725670015303 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/EndUsers/' . \rawurlencode($sid) . ''; } /** * Fetch the EndUserInstance * * @return EndUserInstance Fetched EndUserInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): EndUserInstance { $payload = $this->version->fetch('GET', $this->uri); return new EndUserInstance($this->version, $payload, $this->solution['sid']); } /** * Update the EndUserInstance * * @param array|Options $options Optional Arguments * @return EndUserInstance Updated EndUserInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): EndUserInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'Attributes' => Serialize::jsonObject($options['attributes']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new EndUserInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the EndUserInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trusthub.V1.EndUserContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trusthub/V1/TrustProductsPage.php000064400000002243150515725670016016 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return TrustProductsInstance \Twilio\Rest\Trusthub\V1\TrustProductsInstance */ public function buildInstance(array $payload): TrustProductsInstance { return new TrustProductsInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trusthub.V1.TrustProductsPage]'; } }src/Twilio/Rest/Trusthub/V1/SupportingDocumentTypePage.php000064400000002331150515725670017662 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SupportingDocumentTypeInstance \Twilio\Rest\Trusthub\V1\SupportingDocumentTypeInstance */ public function buildInstance(array $payload): SupportingDocumentTypeInstance { return new SupportingDocumentTypeInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trusthub.V1.SupportingDocumentTypePage]'; } }src/Twilio/Rest/Trusthub/V1/CustomerProfiles/CustomerProfilesEntityAssignmentsContext.php000064400000004617150515725670026153 0ustar00solution = ['customerProfileSid' => $customerProfileSid, 'sid' => $sid, ]; $this->uri = '/CustomerProfiles/' . \rawurlencode($customerProfileSid) . '/EntityAssignments/' . \rawurlencode($sid) . ''; } /** * Fetch the CustomerProfilesEntityAssignmentsInstance * * @return CustomerProfilesEntityAssignmentsInstance Fetched * CustomerProfilesEntityAssignmentsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CustomerProfilesEntityAssignmentsInstance { $payload = $this->version->fetch('GET', $this->uri); return new CustomerProfilesEntityAssignmentsInstance( $this->version, $payload, $this->solution['customerProfileSid'], $this->solution['sid'] ); } /** * Delete the CustomerProfilesEntityAssignmentsInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trusthub.V1.CustomerProfilesEntityAssignmentsContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trusthub/V1/CustomerProfiles/CustomerProfilesEntityAssignmentsPage.php000064400000002622150515725670025375 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CustomerProfilesEntityAssignmentsInstance \Twilio\Rest\Trusthub\V1\CustomerProfiles\CustomerProfilesEntityAssignmentsInstance */ public function buildInstance(array $payload): CustomerProfilesEntityAssignmentsInstance { return new CustomerProfilesEntityAssignmentsInstance( $this->version, $payload, $this->solution['customerProfileSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trusthub.V1.CustomerProfilesEntityAssignmentsPage]'; } }src/Twilio/Rest/Trusthub/V1/CustomerProfiles/CustomerProfilesEntityAssignmentsInstance.php000064400000010244150515725670026264 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'customerProfileSid' => Values::array_get($payload, 'customer_profile_sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'objectSid' => Values::array_get($payload, 'object_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'customerProfileSid' => $customerProfileSid, '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 CustomerProfilesEntityAssignmentsContext Context for this * CustomerProfilesEntityAssignmentsInstance */ protected function proxy(): CustomerProfilesEntityAssignmentsContext { if (!$this->context) { $this->context = new CustomerProfilesEntityAssignmentsContext( $this->version, $this->solution['customerProfileSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the CustomerProfilesEntityAssignmentsInstance * * @return CustomerProfilesEntityAssignmentsInstance Fetched * CustomerProfilesEntityAssignmentsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CustomerProfilesEntityAssignmentsInstance { return $this->proxy()->fetch(); } /** * Delete the CustomerProfilesEntityAssignmentsInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trusthub.V1.CustomerProfilesEntityAssignmentsInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trusthub/V1/CustomerProfiles/CustomerProfilesEvaluationsList.php000064400000014161150515725670024237 0ustar00solution = ['customerProfileSid' => $customerProfileSid, ]; $this->uri = '/CustomerProfiles/' . \rawurlencode($customerProfileSid) . '/Evaluations'; } /** * Create the CustomerProfilesEvaluationsInstance * * @param string $policySid The unique string of a policy * @return CustomerProfilesEvaluationsInstance Created * CustomerProfilesEvaluationsInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $policySid): CustomerProfilesEvaluationsInstance { $data = Values::of(['PolicySid' => $policySid, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new CustomerProfilesEvaluationsInstance( $this->version, $payload, $this->solution['customerProfileSid'] ); } /** * Streams CustomerProfilesEvaluationsInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads CustomerProfilesEvaluationsInstance 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 CustomerProfilesEvaluationsInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of CustomerProfilesEvaluationsInstance 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 CustomerProfilesEvaluationsPage Page of * CustomerProfilesEvaluationsInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): CustomerProfilesEvaluationsPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new CustomerProfilesEvaluationsPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of CustomerProfilesEvaluationsInstance records from * the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return CustomerProfilesEvaluationsPage Page of * CustomerProfilesEvaluationsInstance */ public function getPage(string $targetUrl): CustomerProfilesEvaluationsPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new CustomerProfilesEvaluationsPage($this->version, $response, $this->solution); } /** * Constructs a CustomerProfilesEvaluationsContext * * @param string $sid The unique string that identifies the Evaluation resource */ public function getContext(string $sid): CustomerProfilesEvaluationsContext { return new CustomerProfilesEvaluationsContext( $this->version, $this->solution['customerProfileSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trusthub.V1.CustomerProfilesEvaluationsList]'; } }src/Twilio/Rest/Trusthub/V1/CustomerProfiles/CustomerProfilesEvaluationsContext.php000064400000004052150515725670024746 0ustar00solution = ['customerProfileSid' => $customerProfileSid, 'sid' => $sid, ]; $this->uri = '/CustomerProfiles/' . \rawurlencode($customerProfileSid) . '/Evaluations/' . \rawurlencode($sid) . ''; } /** * Fetch the CustomerProfilesEvaluationsInstance * * @return CustomerProfilesEvaluationsInstance Fetched * CustomerProfilesEvaluationsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CustomerProfilesEvaluationsInstance { $payload = $this->version->fetch('GET', $this->uri); return new CustomerProfilesEvaluationsInstance( $this->version, $payload, $this->solution['customerProfileSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trusthub.V1.CustomerProfilesEvaluationsContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trusthub/V1/CustomerProfiles/CustomerProfilesChannelEndpointAssignmentPage.php000064400000002702150515725670027006 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CustomerProfilesChannelEndpointAssignmentInstance \Twilio\Rest\Trusthub\V1\CustomerProfiles\CustomerProfilesChannelEndpointAssignmentInstance */ public function buildInstance(array $payload): CustomerProfilesChannelEndpointAssignmentInstance { return new CustomerProfilesChannelEndpointAssignmentInstance( $this->version, $payload, $this->solution['customerProfileSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trusthub.V1.CustomerProfilesChannelEndpointAssignmentPage]'; } }src/Twilio/Rest/Trusthub/V1/CustomerProfiles/CustomerProfilesChannelEndpointAssignmentInstance.php000064400000010664150515725670027704 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'customerProfileSid' => Values::array_get($payload, 'customer_profile_sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'channelEndpointType' => Values::array_get($payload, 'channel_endpoint_type'), 'channelEndpointSid' => Values::array_get($payload, 'channel_endpoint_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'customerProfileSid' => $customerProfileSid, '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 CustomerProfilesChannelEndpointAssignmentContext Context for this * CustomerProfilesChannelEndpointAssignmentInstance */ protected function proxy(): CustomerProfilesChannelEndpointAssignmentContext { if (!$this->context) { $this->context = new CustomerProfilesChannelEndpointAssignmentContext( $this->version, $this->solution['customerProfileSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the CustomerProfilesChannelEndpointAssignmentInstance * * @return CustomerProfilesChannelEndpointAssignmentInstance Fetched * CustomerProfilesChannelEndpointAssignmentInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CustomerProfilesChannelEndpointAssignmentInstance { return $this->proxy()->fetch(); } /** * Delete the CustomerProfilesChannelEndpointAssignmentInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trusthub.V1.CustomerProfilesChannelEndpointAssignmentInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trusthub/V1/CustomerProfiles/CustomerProfilesEvaluationsInstance.php000064400000007753150515725670025101 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'policySid' => Values::array_get($payload, 'policy_sid'), 'customerProfileSid' => Values::array_get($payload, 'customer_profile_sid'), 'status' => Values::array_get($payload, 'status'), 'results' => Values::array_get($payload, 'results'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'customerProfileSid' => $customerProfileSid, '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 CustomerProfilesEvaluationsContext Context for this * CustomerProfilesEvaluationsInstance */ protected function proxy(): CustomerProfilesEvaluationsContext { if (!$this->context) { $this->context = new CustomerProfilesEvaluationsContext( $this->version, $this->solution['customerProfileSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the CustomerProfilesEvaluationsInstance * * @return CustomerProfilesEvaluationsInstance Fetched * CustomerProfilesEvaluationsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CustomerProfilesEvaluationsInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trusthub.V1.CustomerProfilesEvaluationsInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trusthub/V1/CustomerProfiles/CustomerProfilesChannelEndpointAssignmentOptions.php000064400000004774150515725670027600 0ustar00options['channelEndpointSid'] = $channelEndpointSid; $this->options['channelEndpointSids'] = $channelEndpointSids; } /** * The SID of an channel endpoint * * @param string $channelEndpointSid The sid of an channel endpoint * @return $this Fluent Builder */ public function setChannelEndpointSid(string $channelEndpointSid): self { $this->options['channelEndpointSid'] = $channelEndpointSid; return $this; } /** * comma separated list of channel endpoint sids * * @param string $channelEndpointSids comma separated list of channel endpoint * sids * @return $this Fluent Builder */ public function setChannelEndpointSids(string $channelEndpointSids): self { $this->options['channelEndpointSids'] = $channelEndpointSids; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Trusthub.V1.ReadCustomerProfilesChannelEndpointAssignmentOptions ' . $options . ']'; } }src/Twilio/Rest/Trusthub/V1/CustomerProfiles/CustomerProfilesEvaluationsPage.php000064400000002556150515725670024205 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CustomerProfilesEvaluationsInstance \Twilio\Rest\Trusthub\V1\CustomerProfiles\CustomerProfilesEvaluationsInstance */ public function buildInstance(array $payload): CustomerProfilesEvaluationsInstance { return new CustomerProfilesEvaluationsInstance( $this->version, $payload, $this->solution['customerProfileSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trusthub.V1.CustomerProfilesEvaluationsPage]'; } }src/Twilio/Rest/Trusthub/V1/CustomerProfiles/CustomerProfilesEntityAssignmentsList.php000064400000014441150515725670025436 0ustar00solution = ['customerProfileSid' => $customerProfileSid, ]; $this->uri = '/CustomerProfiles/' . \rawurlencode($customerProfileSid) . '/EntityAssignments'; } /** * Create the CustomerProfilesEntityAssignmentsInstance * * @param string $objectSid The sid of an object bag * @return CustomerProfilesEntityAssignmentsInstance Created * CustomerProfilesEntityAssignmentsInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $objectSid): CustomerProfilesEntityAssignmentsInstance { $data = Values::of(['ObjectSid' => $objectSid, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new CustomerProfilesEntityAssignmentsInstance( $this->version, $payload, $this->solution['customerProfileSid'] ); } /** * Streams CustomerProfilesEntityAssignmentsInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads CustomerProfilesEntityAssignmentsInstance 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 CustomerProfilesEntityAssignmentsInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of CustomerProfilesEntityAssignmentsInstance 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 CustomerProfilesEntityAssignmentsPage Page of * CustomerProfilesEntityAssignmentsInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): CustomerProfilesEntityAssignmentsPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new CustomerProfilesEntityAssignmentsPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of CustomerProfilesEntityAssignmentsInstance * records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return CustomerProfilesEntityAssignmentsPage Page of * CustomerProfilesEntityAssignmentsInstance */ public function getPage(string $targetUrl): CustomerProfilesEntityAssignmentsPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new CustomerProfilesEntityAssignmentsPage($this->version, $response, $this->solution); } /** * Constructs a CustomerProfilesEntityAssignmentsContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): CustomerProfilesEntityAssignmentsContext { return new CustomerProfilesEntityAssignmentsContext( $this->version, $this->solution['customerProfileSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trusthub.V1.CustomerProfilesEntityAssignmentsList]'; } }src/Twilio/Rest/Trusthub/V1/CustomerProfiles/CustomerProfilesChannelEndpointAssignmentContext.php000064400000004750150515725670027563 0ustar00solution = ['customerProfileSid' => $customerProfileSid, 'sid' => $sid, ]; $this->uri = '/CustomerProfiles/' . \rawurlencode($customerProfileSid) . '/ChannelEndpointAssignments/' . \rawurlencode($sid) . ''; } /** * Fetch the CustomerProfilesChannelEndpointAssignmentInstance * * @return CustomerProfilesChannelEndpointAssignmentInstance Fetched * CustomerProfilesChannelEndpointAssignmentInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CustomerProfilesChannelEndpointAssignmentInstance { $payload = $this->version->fetch('GET', $this->uri); return new CustomerProfilesChannelEndpointAssignmentInstance( $this->version, $payload, $this->solution['customerProfileSid'], $this->solution['sid'] ); } /** * Delete the CustomerProfilesChannelEndpointAssignmentInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trusthub.V1.CustomerProfilesChannelEndpointAssignmentContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trusthub/V1/CustomerProfiles/CustomerProfilesChannelEndpointAssignmentList.php000064400000016320150515725670027046 0ustar00solution = ['customerProfileSid' => $customerProfileSid, ]; $this->uri = '/CustomerProfiles/' . \rawurlencode($customerProfileSid) . '/ChannelEndpointAssignments'; } /** * Create the CustomerProfilesChannelEndpointAssignmentInstance * * @param string $channelEndpointType The type of channel endpoint * @param string $channelEndpointSid The sid of an channel endpoint * @return CustomerProfilesChannelEndpointAssignmentInstance Created * CustomerProfilesChannelEndpointAssignmentInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $channelEndpointType, string $channelEndpointSid): CustomerProfilesChannelEndpointAssignmentInstance { $data = Values::of([ 'ChannelEndpointType' => $channelEndpointType, 'ChannelEndpointSid' => $channelEndpointSid, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new CustomerProfilesChannelEndpointAssignmentInstance( $this->version, $payload, $this->solution['customerProfileSid'] ); } /** * Streams CustomerProfilesChannelEndpointAssignmentInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads CustomerProfilesChannelEndpointAssignmentInstance 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 CustomerProfilesChannelEndpointAssignmentInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of CustomerProfilesChannelEndpointAssignmentInstance * 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 CustomerProfilesChannelEndpointAssignmentPage Page of * CustomerProfilesChannelEndpointAssignmentInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): CustomerProfilesChannelEndpointAssignmentPage { $options = new Values($options); $params = Values::of([ 'ChannelEndpointSid' => $options['channelEndpointSid'], 'ChannelEndpointSids' => $options['channelEndpointSids'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new CustomerProfilesChannelEndpointAssignmentPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of * CustomerProfilesChannelEndpointAssignmentInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return CustomerProfilesChannelEndpointAssignmentPage Page of * CustomerProfilesChannelEndpointAssignmentInstance */ public function getPage(string $targetUrl): CustomerProfilesChannelEndpointAssignmentPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new CustomerProfilesChannelEndpointAssignmentPage($this->version, $response, $this->solution); } /** * Constructs a CustomerProfilesChannelEndpointAssignmentContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): CustomerProfilesChannelEndpointAssignmentContext { return new CustomerProfilesChannelEndpointAssignmentContext( $this->version, $this->solution['customerProfileSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trusthub.V1.CustomerProfilesChannelEndpointAssignmentList]'; } }src/Twilio/Rest/Trusthub/V1/EndUserTypePage.php000064400000002227150515725670015362 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return EndUserTypeInstance \Twilio\Rest\Trusthub\V1\EndUserTypeInstance */ public function buildInstance(array $payload): EndUserTypeInstance { return new EndUserTypeInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trusthub.V1.EndUserTypePage]'; } }src/Twilio/Rest/Trusthub/V1/EndUserTypeContext.php000064400000003044150515725670016130 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/EndUserTypes/' . \rawurlencode($sid) . ''; } /** * Fetch the EndUserTypeInstance * * @return EndUserTypeInstance Fetched EndUserTypeInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): EndUserTypeInstance { $payload = $this->version->fetch('GET', $this->uri); return new EndUserTypeInstance($this->version, $payload, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trusthub.V1.EndUserTypeContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trusthub/V1/EndUserOptions.php000064400000007414150515725670015302 0ustar00options['attributes'] = $attributes; } /** * The set of parameters that are the attributes of the End User resource which are derived End User Types. * * @param array $attributes The set of parameters that compose the End User * resource * @return $this Fluent Builder */ public function setAttributes(array $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Trusthub.V1.CreateEndUserOptions ' . $options . ']'; } } class UpdateEndUserOptions extends Options { /** * @param string $friendlyName The string that you assigned to describe the * resource * @param array $attributes The set of parameters that compose the End User * resource */ public function __construct(string $friendlyName = Values::NONE, array $attributes = Values::ARRAY_NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['attributes'] = $attributes; } /** * The string that you assigned to describe the resource. * * @param string $friendlyName The string that you assigned to describe the * resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The set of parameters that are the attributes of the End User resource which are derived End User Types. * * @param array $attributes The set of parameters that compose the End User * resource * @return $this Fluent Builder */ public function setAttributes(array $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Trusthub.V1.UpdateEndUserOptions ' . $options . ']'; } }src/Twilio/Rest/Trusthub/V1/PoliciesInstance.php000064400000005605150515725670015615 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'requirements' => Values::array_get($payload, 'requirements'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['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 PoliciesContext Context for this PoliciesInstance */ protected function proxy(): PoliciesContext { if (!$this->context) { $this->context = new PoliciesContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the PoliciesInstance * * @return PoliciesInstance Fetched PoliciesInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): PoliciesInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trusthub.V1.PoliciesInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trusthub/V1/EndUserInstance.php000064400000007702150515725670015413 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'type' => Values::array_get($payload, 'type'), 'attributes' => Values::array_get($payload, 'attributes'), '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 = ['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 EndUserContext Context for this EndUserInstance */ protected function proxy(): EndUserContext { if (!$this->context) { $this->context = new EndUserContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the EndUserInstance * * @return EndUserInstance Fetched EndUserInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): EndUserInstance { return $this->proxy()->fetch(); } /** * Update the EndUserInstance * * @param array|Options $options Optional Arguments * @return EndUserInstance Updated EndUserInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): EndUserInstance { return $this->proxy()->update($options); } /** * Delete the EndUserInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trusthub.V1.EndUserInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trusthub/V1/EndUserList.php000064400000012726150515725670014564 0ustar00solution = []; $this->uri = '/EndUsers'; } /** * Create the EndUserInstance * * @param string $friendlyName The string that you assigned to describe the * resource * @param string $type The type of end user of the Bundle resource * @param array|Options $options Optional Arguments * @return EndUserInstance Created EndUserInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, string $type, array $options = []): EndUserInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $friendlyName, 'Type' => $type, 'Attributes' => Serialize::jsonObject($options['attributes']), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new EndUserInstance($this->version, $payload); } /** * Streams EndUserInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads EndUserInstance 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 EndUserInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of EndUserInstance 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 EndUserPage Page of EndUserInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): EndUserPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new EndUserPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of EndUserInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return EndUserPage Page of EndUserInstance */ public function getPage(string $targetUrl): EndUserPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new EndUserPage($this->version, $response, $this->solution); } /** * Constructs a EndUserContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): EndUserContext { return new EndUserContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trusthub.V1.EndUserList]'; } }src/Twilio/Rest/Trusthub/V1/CustomerProfilesOptions.php000064400000017466150515725670017252 0ustar00options['statusCallback'] = $statusCallback; } /** * The URL we call to inform your application of status changes. * * @param string $statusCallback The URL we call to inform your application of * status changes. * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Trusthub.V1.CreateCustomerProfilesOptions ' . $options . ']'; } } class ReadCustomerProfilesOptions extends Options { /** * @param string $status The verification status of the Customer-Profile * resource * @param string $friendlyName The string that you assigned to describe the * resource * @param string $policySid The unique string of a policy. */ public function __construct(string $status = Values::NONE, string $friendlyName = Values::NONE, string $policySid = Values::NONE) { $this->options['status'] = $status; $this->options['friendlyName'] = $friendlyName; $this->options['policySid'] = $policySid; } /** * The verification status of the Customer-Profile resource. * * @param string $status The verification status of the Customer-Profile * resource * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * The string that you assigned to describe the resource. * * @param string $friendlyName The string that you assigned to describe the * resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The unique string of a policy that is associated to the Customer-Profile resource. * * @param string $policySid The unique string of a policy. * @return $this Fluent Builder */ public function setPolicySid(string $policySid): self { $this->options['policySid'] = $policySid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Trusthub.V1.ReadCustomerProfilesOptions ' . $options . ']'; } } class UpdateCustomerProfilesOptions extends Options { /** * @param string $status The verification status of the Customer-Profile * resource * @param string $statusCallback The URL we call to inform your application of * status changes. * @param string $friendlyName The string that you assigned to describe the * resource * @param string $email The email address */ public function __construct(string $status = Values::NONE, string $statusCallback = Values::NONE, string $friendlyName = Values::NONE, string $email = Values::NONE) { $this->options['status'] = $status; $this->options['statusCallback'] = $statusCallback; $this->options['friendlyName'] = $friendlyName; $this->options['email'] = $email; } /** * The verification status of the Customer-Profile resource. * * @param string $status The verification status of the Customer-Profile * resource * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * The URL we call to inform your application of status changes. * * @param string $statusCallback The URL we call to inform your application of * status changes. * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * The string that you assigned to describe the resource. * * @param string $friendlyName The string that you assigned to describe the * resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The email address that will receive updates when the Customer-Profile resource changes status. * * @param string $email The email address * @return $this Fluent Builder */ public function setEmail(string $email): self { $this->options['email'] = $email; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Trusthub.V1.UpdateCustomerProfilesOptions ' . $options . ']'; } }src/Twilio/Rest/Trusthub/V1/TrustProductsInstance.php000064400000013014150515725670016704 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'policySid' => Values::array_get($payload, 'policy_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'status' => Values::array_get($payload, 'status'), 'validUntil' => Deserialize::dateTime(Values::array_get($payload, 'valid_until')), 'email' => Values::array_get($payload, 'email'), 'statusCallback' => Values::array_get($payload, 'status_callback'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 TrustProductsContext Context for this TrustProductsInstance */ protected function proxy(): TrustProductsContext { if (!$this->context) { $this->context = new TrustProductsContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the TrustProductsInstance * * @return TrustProductsInstance Fetched TrustProductsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TrustProductsInstance { return $this->proxy()->fetch(); } /** * Update the TrustProductsInstance * * @param array|Options $options Optional Arguments * @return TrustProductsInstance Updated TrustProductsInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): TrustProductsInstance { return $this->proxy()->update($options); } /** * Delete the TrustProductsInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the trustProductsEntityAssignments */ protected function getTrustProductsEntityAssignments(): TrustProductsEntityAssignmentsList { return $this->proxy()->trustProductsEntityAssignments; } /** * Access the trustProductsEvaluations */ protected function getTrustProductsEvaluations(): TrustProductsEvaluationsList { return $this->proxy()->trustProductsEvaluations; } /** * Access the trustProductsChannelEndpointAssignment */ protected function getTrustProductsChannelEndpointAssignment(): TrustProductsChannelEndpointAssignmentList { return $this->proxy()->trustProductsChannelEndpointAssignment; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trusthub.V1.TrustProductsInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trusthub/V1/EndUserPage.php000064400000002177150515725670014524 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return EndUserInstance \Twilio\Rest\Trusthub\V1\EndUserInstance */ public function buildInstance(array $payload): EndUserInstance { return new EndUserInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trusthub.V1.EndUserPage]'; } }src/Twilio/Rest/Trusthub/V1/CustomerProfilesList.php000064400000014335150515725670016522 0ustar00solution = []; $this->uri = '/CustomerProfiles'; } /** * Create the CustomerProfilesInstance * * @param string $friendlyName The string that you assigned to describe the * resource * @param string $email The email address * @param string $policySid The unique string of a policy. * @param array|Options $options Optional Arguments * @return CustomerProfilesInstance Created CustomerProfilesInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, string $email, string $policySid, array $options = []): CustomerProfilesInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $friendlyName, 'Email' => $email, 'PolicySid' => $policySid, 'StatusCallback' => $options['statusCallback'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new CustomerProfilesInstance($this->version, $payload); } /** * Streams CustomerProfilesInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads CustomerProfilesInstance 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 CustomerProfilesInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of CustomerProfilesInstance 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 CustomerProfilesPage Page of CustomerProfilesInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): CustomerProfilesPage { $options = new Values($options); $params = Values::of([ 'Status' => $options['status'], 'FriendlyName' => $options['friendlyName'], 'PolicySid' => $options['policySid'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new CustomerProfilesPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of CustomerProfilesInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return CustomerProfilesPage Page of CustomerProfilesInstance */ public function getPage(string $targetUrl): CustomerProfilesPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new CustomerProfilesPage($this->version, $response, $this->solution); } /** * Constructs a CustomerProfilesContext * * @param string $sid The unique string that identifies the resource. */ public function getContext(string $sid): CustomerProfilesContext { return new CustomerProfilesContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trusthub.V1.CustomerProfilesList]'; } }src/Twilio/Rest/Trusthub/V1/TrustProductsOptions.php000064400000017406150515725670016604 0ustar00options['statusCallback'] = $statusCallback; } /** * The URL we call to inform your application of status changes. * * @param string $statusCallback The URL we call to inform your application of * status changes. * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Trusthub.V1.CreateTrustProductsOptions ' . $options . ']'; } } class ReadTrustProductsOptions extends Options { /** * @param string $status The verification status of the Customer-Profile * resource * @param string $friendlyName The string that you assigned to describe the * resource * @param string $policySid The unique string of a policy. */ public function __construct(string $status = Values::NONE, string $friendlyName = Values::NONE, string $policySid = Values::NONE) { $this->options['status'] = $status; $this->options['friendlyName'] = $friendlyName; $this->options['policySid'] = $policySid; } /** * The verification status of the Customer-Profile resource. * * @param string $status The verification status of the Customer-Profile * resource * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * The string that you assigned to describe the resource. * * @param string $friendlyName The string that you assigned to describe the * resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The unique string of a policy that is associated to the Customer-Profile resource. * * @param string $policySid The unique string of a policy. * @return $this Fluent Builder */ public function setPolicySid(string $policySid): self { $this->options['policySid'] = $policySid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Trusthub.V1.ReadTrustProductsOptions ' . $options . ']'; } } class UpdateTrustProductsOptions extends Options { /** * @param string $status The verification status of the Customer-Profile * resource * @param string $statusCallback The URL we call to inform your application of * status changes. * @param string $friendlyName The string that you assigned to describe the * resource * @param string $email The email address */ public function __construct(string $status = Values::NONE, string $statusCallback = Values::NONE, string $friendlyName = Values::NONE, string $email = Values::NONE) { $this->options['status'] = $status; $this->options['statusCallback'] = $statusCallback; $this->options['friendlyName'] = $friendlyName; $this->options['email'] = $email; } /** * The verification status of the Customer-Profile resource. * * @param string $status The verification status of the Customer-Profile * resource * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * The URL we call to inform your application of status changes. * * @param string $statusCallback The URL we call to inform your application of * status changes. * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * The string that you assigned to describe the resource. * * @param string $friendlyName The string that you assigned to describe the * resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The email address that will receive updates when the Customer-Profile resource changes status. * * @param string $email The email address * @return $this Fluent Builder */ public function setEmail(string $email): self { $this->options['email'] = $email; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Trusthub.V1.UpdateTrustProductsOptions ' . $options . ']'; } }src/Twilio/Rest/Trusthub/V1/EndUserTypeInstance.php000064400000006042150515725670016251 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'machineName' => Values::array_get($payload, 'machine_name'), 'fields' => Values::array_get($payload, 'fields'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['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 EndUserTypeContext Context for this EndUserTypeInstance */ protected function proxy(): EndUserTypeContext { if (!$this->context) { $this->context = new EndUserTypeContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the EndUserTypeInstance * * @return EndUserTypeInstance Fetched EndUserTypeInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): EndUserTypeInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trusthub.V1.EndUserTypeInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trusthub/V1/SupportingDocumentContext.php000064400000005144150515725670017575 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/SupportingDocuments/' . \rawurlencode($sid) . ''; } /** * Fetch the SupportingDocumentInstance * * @return SupportingDocumentInstance Fetched SupportingDocumentInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SupportingDocumentInstance { $payload = $this->version->fetch('GET', $this->uri); return new SupportingDocumentInstance($this->version, $payload, $this->solution['sid']); } /** * Update the SupportingDocumentInstance * * @param array|Options $options Optional Arguments * @return SupportingDocumentInstance Updated SupportingDocumentInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SupportingDocumentInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'Attributes' => Serialize::jsonObject($options['attributes']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new SupportingDocumentInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the SupportingDocumentInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trusthub.V1.SupportingDocumentContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trusthub/V1/SupportingDocumentTypeList.php000064400000011564150515725670017731 0ustar00solution = []; $this->uri = '/SupportingDocumentTypes'; } /** * Streams SupportingDocumentTypeInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads SupportingDocumentTypeInstance 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 SupportingDocumentTypeInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of SupportingDocumentTypeInstance 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 SupportingDocumentTypePage Page of SupportingDocumentTypeInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SupportingDocumentTypePage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new SupportingDocumentTypePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of SupportingDocumentTypeInstance records from the * API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return SupportingDocumentTypePage Page of SupportingDocumentTypeInstance */ public function getPage(string $targetUrl): SupportingDocumentTypePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new SupportingDocumentTypePage($this->version, $response, $this->solution); } /** * Constructs a SupportingDocumentTypeContext * * @param string $sid The unique string that identifies the Supporting Document * Type resource */ public function getContext(string $sid): SupportingDocumentTypeContext { return new SupportingDocumentTypeContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trusthub.V1.SupportingDocumentTypeList]'; } }src/Twilio/Rest/Trusthub/V1/CustomerProfilesContext.php000064400000014424150515725670017232 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/CustomerProfiles/' . \rawurlencode($sid) . ''; } /** * Fetch the CustomerProfilesInstance * * @return CustomerProfilesInstance Fetched CustomerProfilesInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CustomerProfilesInstance { $payload = $this->version->fetch('GET', $this->uri); return new CustomerProfilesInstance($this->version, $payload, $this->solution['sid']); } /** * Update the CustomerProfilesInstance * * @param array|Options $options Optional Arguments * @return CustomerProfilesInstance Updated CustomerProfilesInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): CustomerProfilesInstance { $options = new Values($options); $data = Values::of([ 'Status' => $options['status'], 'StatusCallback' => $options['statusCallback'], 'FriendlyName' => $options['friendlyName'], 'Email' => $options['email'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new CustomerProfilesInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the CustomerProfilesInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the customerProfilesEntityAssignments */ protected function getCustomerProfilesEntityAssignments(): CustomerProfilesEntityAssignmentsList { if (!$this->_customerProfilesEntityAssignments) { $this->_customerProfilesEntityAssignments = new CustomerProfilesEntityAssignmentsList( $this->version, $this->solution['sid'] ); } return $this->_customerProfilesEntityAssignments; } /** * Access the customerProfilesEvaluations */ protected function getCustomerProfilesEvaluations(): CustomerProfilesEvaluationsList { if (!$this->_customerProfilesEvaluations) { $this->_customerProfilesEvaluations = new CustomerProfilesEvaluationsList( $this->version, $this->solution['sid'] ); } return $this->_customerProfilesEvaluations; } /** * Access the customerProfilesChannelEndpointAssignment */ protected function getCustomerProfilesChannelEndpointAssignment(): CustomerProfilesChannelEndpointAssignmentList { if (!$this->_customerProfilesChannelEndpointAssignment) { $this->_customerProfilesChannelEndpointAssignment = new CustomerProfilesChannelEndpointAssignmentList( $this->version, $this->solution['sid'] ); } return $this->_customerProfilesChannelEndpointAssignment; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trusthub.V1.CustomerProfilesContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trusthub/V1/PoliciesList.php000064400000011032150515725670014753 0ustar00solution = []; $this->uri = '/Policies'; } /** * Streams PoliciesInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads PoliciesInstance 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 PoliciesInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of PoliciesInstance 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 PoliciesPage Page of PoliciesInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): PoliciesPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new PoliciesPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of PoliciesInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return PoliciesPage Page of PoliciesInstance */ public function getPage(string $targetUrl): PoliciesPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new PoliciesPage($this->version, $response, $this->solution); } /** * Constructs a PoliciesContext * * @param string $sid The unique string that identifies the Policy resource */ public function getContext(string $sid): PoliciesContext { return new PoliciesContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trusthub.V1.PoliciesList]'; } }src/Twilio/Rest/Trusthub/V1/SupportingDocumentTypeInstance.php000064400000006323150515725670020557 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'machineName' => Values::array_get($payload, 'machine_name'), 'fields' => Values::array_get($payload, 'fields'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['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 SupportingDocumentTypeContext Context for this * SupportingDocumentTypeInstance */ protected function proxy(): SupportingDocumentTypeContext { if (!$this->context) { $this->context = new SupportingDocumentTypeContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the SupportingDocumentTypeInstance * * @return SupportingDocumentTypeInstance Fetched SupportingDocumentTypeInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SupportingDocumentTypeInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trusthub.V1.SupportingDocumentTypeInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trusthub/V1/SupportingDocumentInstance.php000064400000010457150515725670017720 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'mimeType' => Values::array_get($payload, 'mime_type'), 'status' => Values::array_get($payload, 'status'), 'type' => Values::array_get($payload, 'type'), 'attributes' => Values::array_get($payload, 'attributes'), '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 = ['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 SupportingDocumentContext Context for this SupportingDocumentInstance */ protected function proxy(): SupportingDocumentContext { if (!$this->context) { $this->context = new SupportingDocumentContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the SupportingDocumentInstance * * @return SupportingDocumentInstance Fetched SupportingDocumentInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SupportingDocumentInstance { return $this->proxy()->fetch(); } /** * Update the SupportingDocumentInstance * * @param array|Options $options Optional Arguments * @return SupportingDocumentInstance Updated SupportingDocumentInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SupportingDocumentInstance { return $this->proxy()->update($options); } /** * Delete the SupportingDocumentInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trusthub.V1.SupportingDocumentInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trusthub/V1.php000064400000011513150515725670012354 0ustar00version = 'v1'; } protected function getCustomerProfiles(): CustomerProfilesList { if (!$this->_customerProfiles) { $this->_customerProfiles = new CustomerProfilesList($this); } return $this->_customerProfiles; } protected function getEndUsers(): EndUserList { if (!$this->_endUsers) { $this->_endUsers = new EndUserList($this); } return $this->_endUsers; } protected function getEndUserTypes(): EndUserTypeList { if (!$this->_endUserTypes) { $this->_endUserTypes = new EndUserTypeList($this); } return $this->_endUserTypes; } protected function getPolicies(): PoliciesList { if (!$this->_policies) { $this->_policies = new PoliciesList($this); } return $this->_policies; } protected function getSupportingDocuments(): SupportingDocumentList { if (!$this->_supportingDocuments) { $this->_supportingDocuments = new SupportingDocumentList($this); } return $this->_supportingDocuments; } protected function getSupportingDocumentTypes(): SupportingDocumentTypeList { if (!$this->_supportingDocumentTypes) { $this->_supportingDocumentTypes = new SupportingDocumentTypeList($this); } return $this->_supportingDocumentTypes; } protected function getTrustProducts(): TrustProductsList { if (!$this->_trustProducts) { $this->_trustProducts = new TrustProductsList($this); } return $this->_trustProducts; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Trusthub.V1]'; } }src/Twilio/Rest/FlexApi.php000064400000007633150515725670011606 0ustar00baseUrl = 'https://flex-api.twilio.com'; } /** * @return V1 Version v1 of flex_api */ protected function getV1(): V1 { 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 TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } protected function getChannel(): \Twilio\Rest\FlexApi\V1\ChannelList { return $this->v1->channel; } /** * @param string $sid The SID that identifies the Flex chat channel resource to * fetch */ protected function contextChannel(string $sid): \Twilio\Rest\FlexApi\V1\ChannelContext { return $this->v1->channel($sid); } protected function getConfiguration(): \Twilio\Rest\FlexApi\V1\ConfigurationList { return $this->v1->configuration; } protected function contextConfiguration(): \Twilio\Rest\FlexApi\V1\ConfigurationContext { return $this->v1->configuration(); } protected function getFlexFlow(): \Twilio\Rest\FlexApi\V1\FlexFlowList { return $this->v1->flexFlow; } /** * @param string $sid The SID that identifies the resource to fetch */ protected function contextFlexFlow(string $sid): \Twilio\Rest\FlexApi\V1\FlexFlowContext { return $this->v1->flexFlow($sid); } protected function getWebChannel(): \Twilio\Rest\FlexApi\V1\WebChannelList { return $this->v1->webChannel; } /** * @param string $sid The SID of the WebChannel resource to fetch */ protected function contextWebChannel(string $sid): \Twilio\Rest\FlexApi\V1\WebChannelContext { return $this->v1->webChannel($sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.FlexApi]'; } }src/Twilio/Rest/Voice/V1/SourceIpMappingInstance.php000064400000007622150515725670016341 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'ipRecordSid' => Values::array_get($payload, 'ip_record_sid'), 'sipDomainSid' => Values::array_get($payload, 'sip_domain_sid'), '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 = ['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 SourceIpMappingContext Context for this SourceIpMappingInstance */ protected function proxy(): SourceIpMappingContext { if (!$this->context) { $this->context = new SourceIpMappingContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the SourceIpMappingInstance * * @return SourceIpMappingInstance Fetched SourceIpMappingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SourceIpMappingInstance { return $this->proxy()->fetch(); } /** * Update the SourceIpMappingInstance * * @param string $sipDomainSid The unique string that identifies a SIP Domain * @return SourceIpMappingInstance Updated SourceIpMappingInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $sipDomainSid): SourceIpMappingInstance { return $this->proxy()->update($sipDomainSid); } /** * Delete the SourceIpMappingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Voice.V1.SourceIpMappingInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Voice/V1/DialingPermissions/BulkCountryUpdatePage.php000064400000002643150515725670021631 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return BulkCountryUpdateInstance \Twilio\Rest\Voice\V1\DialingPermissions\BulkCountryUpdateInstance */ public function buildInstance(array $payload): BulkCountryUpdateInstance { return new BulkCountryUpdateInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Voice.V1.BulkCountryUpdatePage]'; } }src/Twilio/Rest/Voice/V1/DialingPermissions/SettingsOptions.php000064400000005027150515725670020563 0ustar00options['dialingPermissionsInheritance'] = $dialingPermissionsInheritance; } /** * `true` for the sub-account to inherit voice dialing permissions from the Master Project; otherwise `false`. * * @param bool $dialingPermissionsInheritance `true` for the sub-account to * inherit voice dialing permissions * from the Master Project; * otherwise `false` * @return $this Fluent Builder */ public function setDialingPermissionsInheritance(bool $dialingPermissionsInheritance): self { $this->options['dialingPermissionsInheritance'] = $dialingPermissionsInheritance; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Voice.V1.UpdateSettingsOptions ' . $options . ']'; } }src/Twilio/Rest/Voice/V1/DialingPermissions/SettingsInstance.php000064400000006232150515725670020673 0ustar00properties = [ 'dialingPermissionsInheritance' => Values::array_get($payload, 'dialing_permissions_inheritance'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = []; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return SettingsContext Context for this SettingsInstance */ protected function proxy(): SettingsContext { if (!$this->context) { $this->context = new SettingsContext($this->version); } return $this->context; } /** * Fetch the SettingsInstance * * @return SettingsInstance Fetched SettingsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SettingsInstance { return $this->proxy()->fetch(); } /** * Update the SettingsInstance * * @param array|Options $options Optional Arguments * @return SettingsInstance Updated SettingsInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SettingsInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Voice.V1.SettingsInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Voice/V1/DialingPermissions/SettingsContext.php000064400000004324150515725670020553 0ustar00solution = []; $this->uri = '/Settings'; } /** * Fetch the SettingsInstance * * @return SettingsInstance Fetched SettingsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SettingsInstance { $payload = $this->version->fetch('GET', $this->uri); return new SettingsInstance($this->version, $payload); } /** * Update the SettingsInstance * * @param array|Options $options Optional Arguments * @return SettingsInstance Updated SettingsInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SettingsInstance { $options = new Values($options); $data = Values::of([ 'DialingPermissionsInheritance' => Serialize::booleanToString($options['dialingPermissionsInheritance']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new SettingsInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Voice.V1.SettingsContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Voice/V1/DialingPermissions/CountryContext.php000064400000006640150515725670020421 0ustar00solution = ['isoCode' => $isoCode, ]; $this->uri = '/DialingPermissions/Countries/' . \rawurlencode($isoCode) . ''; } /** * Fetch the CountryInstance * * @return CountryInstance Fetched CountryInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CountryInstance { $payload = $this->version->fetch('GET', $this->uri); return new CountryInstance($this->version, $payload, $this->solution['isoCode']); } /** * Access the highriskSpecialPrefixes */ protected function getHighriskSpecialPrefixes(): HighriskSpecialPrefixList { if (!$this->_highriskSpecialPrefixes) { $this->_highriskSpecialPrefixes = new HighriskSpecialPrefixList( $this->version, $this->solution['isoCode'] ); } return $this->_highriskSpecialPrefixes; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Voice.V1.CountryContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Voice/V1/DialingPermissions/CountryOptions.php000064400000016760150515725670020434 0ustar00options['isoCode'] = $isoCode; $this->options['continent'] = $continent; $this->options['countryCode'] = $countryCode; $this->options['lowRiskNumbersEnabled'] = $lowRiskNumbersEnabled; $this->options['highRiskSpecialNumbersEnabled'] = $highRiskSpecialNumbersEnabled; $this->options['highRiskTollfraudNumbersEnabled'] = $highRiskTollfraudNumbersEnabled; } /** * Filter to retrieve the country permissions by specifying the [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) * * @param string $isoCode Filter to retrieve the country permissions by * specifying the ISO country code * @return $this Fluent Builder */ public function setIsoCode(string $isoCode): self { $this->options['isoCode'] = $isoCode; return $this; } /** * Filter to retrieve the country permissions by specifying the continent * * @param string $continent Filter to retrieve the country permissions by * specifying the continent * @return $this Fluent Builder */ public function setContinent(string $continent): self { $this->options['continent'] = $continent; return $this; } /** * Filter the results by specified [country codes](https://www.itu.int/itudoc/itu-t/ob-lists/icc/e164_763.html) * * @param string $countryCode Country code filter * @return $this Fluent Builder */ public function setCountryCode(string $countryCode): self { $this->options['countryCode'] = $countryCode; return $this; } /** * Filter to retrieve the country permissions with dialing to low-risk numbers enabled. Can be: `true` or `false`. * * @param bool $lowRiskNumbersEnabled Filter to retrieve the country * permissions with dialing to low-risk * numbers enabled * @return $this Fluent Builder */ public function setLowRiskNumbersEnabled(bool $lowRiskNumbersEnabled): self { $this->options['lowRiskNumbersEnabled'] = $lowRiskNumbersEnabled; return $this; } /** * Filter to retrieve the country permissions with dialing to high-risk special service numbers enabled. Can be: `true` or `false` * * @param bool $highRiskSpecialNumbersEnabled Filter to retrieve the country * permissions with dialing to * high-risk special service numbers * enabled * @return $this Fluent Builder */ public function setHighRiskSpecialNumbersEnabled(bool $highRiskSpecialNumbersEnabled): self { $this->options['highRiskSpecialNumbersEnabled'] = $highRiskSpecialNumbersEnabled; return $this; } /** * Filter to retrieve the country permissions with dialing to high-risk [toll fraud](https://www.twilio.com/learn/voice-and-video/toll-fraud) numbers enabled. Can be: `true` or `false`. * * @param bool $highRiskTollfraudNumbersEnabled Filter to retrieve the country * permissions with dialing to * high-risk toll fraud numbers * enabled * @return $this Fluent Builder */ public function setHighRiskTollfraudNumbersEnabled(bool $highRiskTollfraudNumbersEnabled): self { $this->options['highRiskTollfraudNumbersEnabled'] = $highRiskTollfraudNumbersEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Voice.V1.ReadCountryOptions ' . $options . ']'; } }src/Twilio/Rest/Voice/V1/DialingPermissions/CountryList.php000064400000013106150515725670017703 0ustar00solution = []; $this->uri = '/DialingPermissions/Countries'; } /** * Streams CountryInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads CountryInstance 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 CountryInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of CountryInstance 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 CountryPage Page of CountryInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): CountryPage { $options = new Values($options); $params = Values::of([ 'IsoCode' => $options['isoCode'], 'Continent' => $options['continent'], 'CountryCode' => $options['countryCode'], 'LowRiskNumbersEnabled' => Serialize::booleanToString($options['lowRiskNumbersEnabled']), 'HighRiskSpecialNumbersEnabled' => Serialize::booleanToString($options['highRiskSpecialNumbersEnabled']), 'HighRiskTollfraudNumbersEnabled' => Serialize::booleanToString($options['highRiskTollfraudNumbersEnabled']), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new CountryPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of CountryInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return CountryPage Page of CountryInstance */ public function getPage(string $targetUrl): CountryPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new CountryPage($this->version, $response, $this->solution); } /** * Constructs a CountryContext * * @param string $isoCode The ISO country code */ public function getContext(string $isoCode): CountryContext { return new CountryContext($this->version, $isoCode); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Voice.V1.CountryList]'; } }src/Twilio/Rest/Voice/V1/DialingPermissions/BulkCountryUpdateInstance.php000064400000003675150515725670022527 0ustar00properties = [ 'updateCount' => Values::array_get($payload, 'update_count'), 'updateRequest' => Values::array_get($payload, 'update_request'), ]; $this->solution = []; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Voice.V1.BulkCountryUpdateInstance]'; } }src/Twilio/Rest/Voice/V1/DialingPermissions/Country/HighriskSpecialPrefixPage.php000064400000002747150515725670024104 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return HighriskSpecialPrefixInstance \Twilio\Rest\Voice\V1\DialingPermissions\Country\HighriskSpecialPrefixInstance */ public function buildInstance(array $payload): HighriskSpecialPrefixInstance { return new HighriskSpecialPrefixInstance($this->version, $payload, $this->solution['isoCode']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Voice.V1.HighriskSpecialPrefixPage]'; } }src/Twilio/Rest/Voice/V1/DialingPermissions/Country/HighriskSpecialPrefixInstance.php000064400000003631150515725670024765 0ustar00properties = ['prefix' => Values::array_get($payload, 'prefix'), ]; $this->solution = ['isoCode' => $isoCode, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Voice.V1.HighriskSpecialPrefixInstance]'; } }src/Twilio/Rest/Voice/V1/DialingPermissions/Country/HighriskSpecialPrefixList.php000064400000011564150515725670024140 0ustar00solution = ['isoCode' => $isoCode, ]; $this->uri = '/DialingPermissions/Countries/' . \rawurlencode($isoCode) . '/HighRiskSpecialPrefixes'; } /** * Streams HighriskSpecialPrefixInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads HighriskSpecialPrefixInstance 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 HighriskSpecialPrefixInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of HighriskSpecialPrefixInstance 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 HighriskSpecialPrefixPage Page of HighriskSpecialPrefixInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): HighriskSpecialPrefixPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new HighriskSpecialPrefixPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of HighriskSpecialPrefixInstance records from the * API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return HighriskSpecialPrefixPage Page of HighriskSpecialPrefixInstance */ public function getPage(string $targetUrl): HighriskSpecialPrefixPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new HighriskSpecialPrefixPage($this->version, $response, $this->solution); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Voice.V1.HighriskSpecialPrefixList]'; } }src/Twilio/Rest/Voice/V1/DialingPermissions/SettingsPage.php000064400000002555150515725670020007 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SettingsInstance \Twilio\Rest\Voice\V1\DialingPermissions\SettingsInstance */ public function buildInstance(array $payload): SettingsInstance { return new SettingsInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Voice.V1.SettingsPage]'; } }src/Twilio/Rest/Voice/V1/DialingPermissions/CountryPage.php000064400000002547150515725670017653 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CountryInstance \Twilio\Rest\Voice\V1\DialingPermissions\CountryInstance */ public function buildInstance(array $payload): CountryInstance { return new CountryInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Voice.V1.CountryPage]'; } }src/Twilio/Rest/Voice/V1/DialingPermissions/BulkCountryUpdateList.php000064400000003221150515725670021661 0ustar00solution = []; $this->uri = '/DialingPermissions/BulkCountryUpdates'; } /** * Create the BulkCountryUpdateInstance * * @param string $updateRequest URL encoded JSON array of update objects * @return BulkCountryUpdateInstance Created BulkCountryUpdateInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $updateRequest): BulkCountryUpdateInstance { $data = Values::of(['UpdateRequest' => $updateRequest, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new BulkCountryUpdateInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Voice.V1.BulkCountryUpdateList]'; } }src/Twilio/Rest/Voice/V1/DialingPermissions/SettingsList.php000064400000002135150515725670020040 0ustar00solution = []; } /** * Constructs a SettingsContext */ public function getContext(): SettingsContext { return new SettingsContext($this->version); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Voice.V1.SettingsList]'; } }src/Twilio/Rest/Voice/V1/DialingPermissions/CountryInstance.php000064400000010015150515725670020530 0ustar00properties = [ 'isoCode' => Values::array_get($payload, 'iso_code'), 'name' => Values::array_get($payload, 'name'), 'continent' => Values::array_get($payload, 'continent'), 'countryCodes' => Values::array_get($payload, 'country_codes'), 'lowRiskNumbersEnabled' => Values::array_get($payload, 'low_risk_numbers_enabled'), 'highRiskSpecialNumbersEnabled' => Values::array_get($payload, 'high_risk_special_numbers_enabled'), 'highRiskTollfraudNumbersEnabled' => Values::array_get($payload, 'high_risk_tollfraud_numbers_enabled'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['isoCode' => $isoCode ?: $this->properties['isoCode'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return CountryContext Context for this CountryInstance */ protected function proxy(): CountryContext { if (!$this->context) { $this->context = new CountryContext($this->version, $this->solution['isoCode']); } return $this->context; } /** * Fetch the CountryInstance * * @return CountryInstance Fetched CountryInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CountryInstance { return $this->proxy()->fetch(); } /** * Access the highriskSpecialPrefixes */ protected function getHighriskSpecialPrefixes(): HighriskSpecialPrefixList { return $this->proxy()->highriskSpecialPrefixes; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Voice.V1.CountryInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Voice/V1/ArchivedCallInstance.php000064400000006246150515725670015616 0ustar00properties = [ 'date' => Deserialize::dateTime(Values::array_get($payload, 'date')), 'sid' => Values::array_get($payload, 'sid'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'date' => $date ?: $this->properties['date'], '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 ArchivedCallContext Context for this ArchivedCallInstance */ protected function proxy(): ArchivedCallContext { if (!$this->context) { $this->context = new ArchivedCallContext( $this->version, $this->solution['date'], $this->solution['sid'] ); } return $this->context; } /** * Delete the ArchivedCallInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Voice.V1.ArchivedCallInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Voice/V1/IpRecordContext.php000064400000004522150515725670014657 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/IpRecords/' . \rawurlencode($sid) . ''; } /** * Fetch the IpRecordInstance * * @return IpRecordInstance Fetched IpRecordInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): IpRecordInstance { $payload = $this->version->fetch('GET', $this->uri); return new IpRecordInstance($this->version, $payload, $this->solution['sid']); } /** * Update the IpRecordInstance * * @param array|Options $options Optional Arguments * @return IpRecordInstance Updated IpRecordInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): IpRecordInstance { $options = new Values($options); $data = Values::of(['FriendlyName' => $options['friendlyName'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new IpRecordInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the IpRecordInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Voice.V1.IpRecordContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Voice/V1/ByocTrunkOptions.php000064400000045475150515725670015113 0ustar00options['friendlyName'] = $friendlyName; $this->options['voiceUrl'] = $voiceUrl; $this->options['voiceMethod'] = $voiceMethod; $this->options['voiceFallbackUrl'] = $voiceFallbackUrl; $this->options['voiceFallbackMethod'] = $voiceFallbackMethod; $this->options['statusCallbackUrl'] = $statusCallbackUrl; $this->options['statusCallbackMethod'] = $statusCallbackMethod; $this->options['cnamLookupEnabled'] = $cnamLookupEnabled; $this->options['connectionPolicySid'] = $connectionPolicySid; $this->options['fromDomainSid'] = $fromDomainSid; } /** * A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The URL we should call when the BYOC Trunk receives a call. * * @param string $voiceUrl The URL we should call when receiving a call * @return $this Fluent Builder */ public function setVoiceUrl(string $voiceUrl): self { $this->options['voiceUrl'] = $voiceUrl; return $this; } /** * The HTTP method we should use to call `voice_url`. Can be: `GET` or `POST`. * * @param string $voiceMethod The HTTP method to use with voice_url * @return $this Fluent Builder */ public function setVoiceMethod(string $voiceMethod): self { $this->options['voiceMethod'] = $voiceMethod; return $this; } /** * The URL that we should call when an error occurs while retrieving or executing the TwiML from `voice_url`. * * @param string $voiceFallbackUrl The URL we should call when an error occurs * in executing TwiML * @return $this Fluent Builder */ public function setVoiceFallbackUrl(string $voiceFallbackUrl): self { $this->options['voiceFallbackUrl'] = $voiceFallbackUrl; return $this; } /** * The HTTP method we should use to call `voice_fallback_url`. Can be: `GET` or `POST`. * * @param string $voiceFallbackMethod The HTTP method to use with * voice_fallback_url * @return $this Fluent Builder */ public function setVoiceFallbackMethod(string $voiceFallbackMethod): self { $this->options['voiceFallbackMethod'] = $voiceFallbackMethod; return $this; } /** * The URL that we should call to pass status parameters (such as call ended) to your application. * * @param string $statusCallbackUrl The URL that we should call to pass status * updates * @return $this Fluent Builder */ public function setStatusCallbackUrl(string $statusCallbackUrl): self { $this->options['statusCallbackUrl'] = $statusCallbackUrl; return $this; } /** * The HTTP method we should use to call `status_callback_url`. Can be: `GET` or `POST`. * * @param string $statusCallbackMethod The HTTP method we should use to call * `status_callback_url` * @return $this Fluent Builder */ public function setStatusCallbackMethod(string $statusCallbackMethod): self { $this->options['statusCallbackMethod'] = $statusCallbackMethod; return $this; } /** * Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the BYOC Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information. * * @param bool $cnamLookupEnabled Whether Caller ID Name (CNAM) lookup is * enabled for the trunk * @return $this Fluent Builder */ public function setCnamLookupEnabled(bool $cnamLookupEnabled): self { $this->options['cnamLookupEnabled'] = $cnamLookupEnabled; return $this; } /** * The SID of the Connection Policy that Twilio will use when routing traffic to your communications infrastructure. * * @param string $connectionPolicySid Origination Connection Policy (to your * Carrier) * @return $this Fluent Builder */ public function setConnectionPolicySid(string $connectionPolicySid): self { $this->options['connectionPolicySid'] = $connectionPolicySid; return $this; } /** * The SID of the SIP Domain that should be used in the `From` header of originating calls sent to your SIP infrastructure. If your SIP infrastructure allows users to "call back" an incoming call, configure this with a [SIP Domain](https://www.twilio.com/docs/voice/api/sending-sip) to ensure proper routing. If not configured, the from domain will default to "sip.twilio.com". * * @param string $fromDomainSid The SID of the SIP Domain that should be used * in the `From` header of originating calls * @return $this Fluent Builder */ public function setFromDomainSid(string $fromDomainSid): self { $this->options['fromDomainSid'] = $fromDomainSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Voice.V1.CreateByocTrunkOptions ' . $options . ']'; } } class UpdateByocTrunkOptions extends Options { /** * @param string $friendlyName A string to describe the resource * @param string $voiceUrl The URL we should call when receiving a call * @param string $voiceMethod The HTTP method we should use with voice_url * @param string $voiceFallbackUrl The URL we should call when an error occurs * in executing TwiML * @param string $voiceFallbackMethod The HTTP method used with * voice_fallback_url * @param string $statusCallbackUrl The URL that we should call to pass status * updates * @param string $statusCallbackMethod The HTTP method we should use to call * status_callback_url * @param bool $cnamLookupEnabled Whether Caller ID Name (CNAM) lookup is * enabled for the trunk * @param string $connectionPolicySid Origination Connection Policy (to your * Carrier) * @param string $fromDomainSid The SID of the SIP Domain that should be used * in the `From` header of originating calls */ public function __construct(string $friendlyName = Values::NONE, string $voiceUrl = Values::NONE, string $voiceMethod = Values::NONE, string $voiceFallbackUrl = Values::NONE, string $voiceFallbackMethod = Values::NONE, string $statusCallbackUrl = Values::NONE, string $statusCallbackMethod = Values::NONE, bool $cnamLookupEnabled = Values::NONE, string $connectionPolicySid = Values::NONE, string $fromDomainSid = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['voiceUrl'] = $voiceUrl; $this->options['voiceMethod'] = $voiceMethod; $this->options['voiceFallbackUrl'] = $voiceFallbackUrl; $this->options['voiceFallbackMethod'] = $voiceFallbackMethod; $this->options['statusCallbackUrl'] = $statusCallbackUrl; $this->options['statusCallbackMethod'] = $statusCallbackMethod; $this->options['cnamLookupEnabled'] = $cnamLookupEnabled; $this->options['connectionPolicySid'] = $connectionPolicySid; $this->options['fromDomainSid'] = $fromDomainSid; } /** * A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The URL we should call when the BYOC Trunk receives a call. * * @param string $voiceUrl The URL we should call when receiving a call * @return $this Fluent Builder */ public function setVoiceUrl(string $voiceUrl): self { $this->options['voiceUrl'] = $voiceUrl; return $this; } /** * The HTTP method we should use to call `voice_url` * * @param string $voiceMethod The HTTP method we should use with voice_url * @return $this Fluent Builder */ public function setVoiceMethod(string $voiceMethod): self { $this->options['voiceMethod'] = $voiceMethod; return $this; } /** * The URL that we should call when an error occurs while retrieving or executing the TwiML requested by `voice_url`. * * @param string $voiceFallbackUrl The URL we should call when an error occurs * in executing TwiML * @return $this Fluent Builder */ public function setVoiceFallbackUrl(string $voiceFallbackUrl): self { $this->options['voiceFallbackUrl'] = $voiceFallbackUrl; return $this; } /** * The HTTP method we should use to call `voice_fallback_url`. Can be: `GET` or `POST`. * * @param string $voiceFallbackMethod The HTTP method used with * voice_fallback_url * @return $this Fluent Builder */ public function setVoiceFallbackMethod(string $voiceFallbackMethod): self { $this->options['voiceFallbackMethod'] = $voiceFallbackMethod; return $this; } /** * The URL that we should call to pass status parameters (such as call ended) to your application. * * @param string $statusCallbackUrl The URL that we should call to pass status * updates * @return $this Fluent Builder */ public function setStatusCallbackUrl(string $statusCallbackUrl): self { $this->options['statusCallbackUrl'] = $statusCallbackUrl; return $this; } /** * The HTTP method we should use to call `status_callback_url`. Can be: `GET` or `POST`. * * @param string $statusCallbackMethod The HTTP method we should use to call * status_callback_url * @return $this Fluent Builder */ public function setStatusCallbackMethod(string $statusCallbackMethod): self { $this->options['statusCallbackMethod'] = $statusCallbackMethod; return $this; } /** * Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the BYOC Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information. * * @param bool $cnamLookupEnabled Whether Caller ID Name (CNAM) lookup is * enabled for the trunk * @return $this Fluent Builder */ public function setCnamLookupEnabled(bool $cnamLookupEnabled): self { $this->options['cnamLookupEnabled'] = $cnamLookupEnabled; return $this; } /** * The SID of the Connection Policy that Twilio will use when routing traffic to your communications infrastructure. * * @param string $connectionPolicySid Origination Connection Policy (to your * Carrier) * @return $this Fluent Builder */ public function setConnectionPolicySid(string $connectionPolicySid): self { $this->options['connectionPolicySid'] = $connectionPolicySid; return $this; } /** * The SID of the SIP Domain that should be used in the `From` header of originating calls sent to your SIP infrastructure. If your SIP infrastructure allows users to "call back" an incoming call, configure this with a [SIP Domain](https://www.twilio.com/docs/voice/api/sending-sip) to ensure proper routing. If not configured, the from domain will default to "sip.twilio.com". * * @param string $fromDomainSid The SID of the SIP Domain that should be used * in the `From` header of originating calls * @return $this Fluent Builder */ public function setFromDomainSid(string $fromDomainSid): self { $this->options['fromDomainSid'] = $fromDomainSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Voice.V1.UpdateByocTrunkOptions ' . $options . ']'; } }src/Twilio/Rest/Voice/V1/ByocTrunkPage.php000064400000002202150515725670014311 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ByocTrunkInstance \Twilio\Rest\Voice\V1\ByocTrunkInstance */ public function buildInstance(array $payload): ByocTrunkInstance { return new ByocTrunkInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Voice.V1.ByocTrunkPage]'; } }src/Twilio/Rest/Voice/V1/SourceIpMappingList.php000064400000012600150515725670015500 0ustar00solution = []; $this->uri = '/SourceIpMappings'; } /** * Create the SourceIpMappingInstance * * @param string $ipRecordSid The unique string that identifies an IP Record * @param string $sipDomainSid The unique string that identifies a SIP Domain * @return SourceIpMappingInstance Created SourceIpMappingInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $ipRecordSid, string $sipDomainSid): SourceIpMappingInstance { $data = Values::of(['IpRecordSid' => $ipRecordSid, 'SipDomainSid' => $sipDomainSid, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new SourceIpMappingInstance($this->version, $payload); } /** * Streams SourceIpMappingInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads SourceIpMappingInstance 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 SourceIpMappingInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of SourceIpMappingInstance 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 SourceIpMappingPage Page of SourceIpMappingInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SourceIpMappingPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new SourceIpMappingPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of SourceIpMappingInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return SourceIpMappingPage Page of SourceIpMappingInstance */ public function getPage(string $targetUrl): SourceIpMappingPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new SourceIpMappingPage($this->version, $response, $this->solution); } /** * Constructs a SourceIpMappingContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): SourceIpMappingContext { return new SourceIpMappingContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Voice.V1.SourceIpMappingList]'; } }src/Twilio/Rest/Voice/V1/DialingPermissionsPage.php000064400000002603150515725670016201 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return DialingPermissionsInstance \Twilio\Rest\Voice\V1\DialingPermissionsInstance */ public function buildInstance(array $payload): DialingPermissionsInstance { return new DialingPermissionsInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Voice.V1.DialingPermissionsPage]'; } }src/Twilio/Rest/Voice/V1/ByocTrunkInstance.php000064400000011544150515725670015212 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'sid' => Values::array_get($payload, 'sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'voiceUrl' => Values::array_get($payload, 'voice_url'), 'voiceMethod' => Values::array_get($payload, 'voice_method'), 'voiceFallbackUrl' => Values::array_get($payload, 'voice_fallback_url'), 'voiceFallbackMethod' => Values::array_get($payload, 'voice_fallback_method'), 'statusCallbackUrl' => Values::array_get($payload, 'status_callback_url'), 'statusCallbackMethod' => Values::array_get($payload, 'status_callback_method'), 'cnamLookupEnabled' => Values::array_get($payload, 'cnam_lookup_enabled'), 'connectionPolicySid' => Values::array_get($payload, 'connection_policy_sid'), 'fromDomainSid' => Values::array_get($payload, 'from_domain_sid'), '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 = ['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 ByocTrunkContext Context for this ByocTrunkInstance */ protected function proxy(): ByocTrunkContext { if (!$this->context) { $this->context = new ByocTrunkContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the ByocTrunkInstance * * @return ByocTrunkInstance Fetched ByocTrunkInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ByocTrunkInstance { return $this->proxy()->fetch(); } /** * Update the ByocTrunkInstance * * @param array|Options $options Optional Arguments * @return ByocTrunkInstance Updated ByocTrunkInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ByocTrunkInstance { return $this->proxy()->update($options); } /** * Delete the ByocTrunkInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Voice.V1.ByocTrunkInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Voice/V1/IpRecordPage.php000064400000002174150515725670014110 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return IpRecordInstance \Twilio\Rest\Voice\V1\IpRecordInstance */ public function buildInstance(array $payload): IpRecordInstance { return new IpRecordInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Voice.V1.IpRecordPage]'; } }src/Twilio/Rest/Voice/V1/ByocTrunkList.php000064400000013422150515725670014356 0ustar00solution = []; $this->uri = '/ByocTrunks'; } /** * Create the ByocTrunkInstance * * @param array|Options $options Optional Arguments * @return ByocTrunkInstance Created ByocTrunkInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): ByocTrunkInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'VoiceUrl' => $options['voiceUrl'], 'VoiceMethod' => $options['voiceMethod'], 'VoiceFallbackUrl' => $options['voiceFallbackUrl'], 'VoiceFallbackMethod' => $options['voiceFallbackMethod'], 'StatusCallbackUrl' => $options['statusCallbackUrl'], 'StatusCallbackMethod' => $options['statusCallbackMethod'], 'CnamLookupEnabled' => Serialize::booleanToString($options['cnamLookupEnabled']), 'ConnectionPolicySid' => $options['connectionPolicySid'], 'FromDomainSid' => $options['fromDomainSid'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ByocTrunkInstance($this->version, $payload); } /** * Streams ByocTrunkInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ByocTrunkInstance 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 ByocTrunkInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of ByocTrunkInstance 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 ByocTrunkPage Page of ByocTrunkInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ByocTrunkPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ByocTrunkPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ByocTrunkInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ByocTrunkPage Page of ByocTrunkInstance */ public function getPage(string $targetUrl): ByocTrunkPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ByocTrunkPage($this->version, $response, $this->solution); } /** * Constructs a ByocTrunkContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): ByocTrunkContext { return new ByocTrunkContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Voice.V1.ByocTrunkList]'; } }src/Twilio/Rest/Voice/V1/ArchivedCallList.php000064400000002275150515725670014763 0ustar00solution = []; } /** * Constructs a ArchivedCallContext * * @param \DateTime $date The date of the Call in UTC. * @param string $sid The unique string that identifies this resource */ public function getContext(\DateTime $date, string $sid): ArchivedCallContext { return new ArchivedCallContext($this->version, $date, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Voice.V1.ArchivedCallList]'; } }src/Twilio/Rest/Voice/V1/ConnectionPolicyPage.php000064400000002254150515725670015657 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ConnectionPolicyInstance \Twilio\Rest\Voice\V1\ConnectionPolicyInstance */ public function buildInstance(array $payload): ConnectionPolicyInstance { return new ConnectionPolicyInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Voice.V1.ConnectionPolicyPage]'; } }src/Twilio/Rest/Voice/V1/ConnectionPolicyList.php000064400000012503150515725670015714 0ustar00solution = []; $this->uri = '/ConnectionPolicies'; } /** * Create the ConnectionPolicyInstance * * @param array|Options $options Optional Arguments * @return ConnectionPolicyInstance Created ConnectionPolicyInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): ConnectionPolicyInstance { $options = new Values($options); $data = Values::of(['FriendlyName' => $options['friendlyName'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ConnectionPolicyInstance($this->version, $payload); } /** * Streams ConnectionPolicyInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ConnectionPolicyInstance 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 ConnectionPolicyInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of ConnectionPolicyInstance 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 ConnectionPolicyPage Page of ConnectionPolicyInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ConnectionPolicyPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ConnectionPolicyPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ConnectionPolicyInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ConnectionPolicyPage Page of ConnectionPolicyInstance */ public function getPage(string $targetUrl): ConnectionPolicyPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ConnectionPolicyPage($this->version, $response, $this->solution); } /** * Constructs a ConnectionPolicyContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): ConnectionPolicyContext { return new ConnectionPolicyContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Voice.V1.ConnectionPolicyList]'; } }src/Twilio/Rest/Voice/V1/ConnectionPolicyContext.php000064400000010153150515725670016424 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/ConnectionPolicies/' . \rawurlencode($sid) . ''; } /** * Fetch the ConnectionPolicyInstance * * @return ConnectionPolicyInstance Fetched ConnectionPolicyInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ConnectionPolicyInstance { $payload = $this->version->fetch('GET', $this->uri); return new ConnectionPolicyInstance($this->version, $payload, $this->solution['sid']); } /** * Update the ConnectionPolicyInstance * * @param array|Options $options Optional Arguments * @return ConnectionPolicyInstance Updated ConnectionPolicyInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ConnectionPolicyInstance { $options = new Values($options); $data = Values::of(['FriendlyName' => $options['friendlyName'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ConnectionPolicyInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the ConnectionPolicyInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the targets */ protected function getTargets(): ConnectionPolicyTargetList { if (!$this->_targets) { $this->_targets = new ConnectionPolicyTargetList($this->version, $this->solution['sid']); } return $this->_targets; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Voice.V1.ConnectionPolicyContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Voice/V1/IpRecordInstance.php000064400000007756150515725670015013 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'sid' => Values::array_get($payload, 'sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'ipAddress' => Values::array_get($payload, 'ip_address'), 'cidrPrefixLength' => Values::array_get($payload, 'cidr_prefix_length'), '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 = ['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 IpRecordContext Context for this IpRecordInstance */ protected function proxy(): IpRecordContext { if (!$this->context) { $this->context = new IpRecordContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the IpRecordInstance * * @return IpRecordInstance Fetched IpRecordInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): IpRecordInstance { return $this->proxy()->fetch(); } /** * Update the IpRecordInstance * * @param array|Options $options Optional Arguments * @return IpRecordInstance Updated IpRecordInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): IpRecordInstance { return $this->proxy()->update($options); } /** * Delete the IpRecordInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Voice.V1.IpRecordInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Voice/V1/DialingPermissionsInstance.php000064400000003207150515725670017072 0ustar00solution = []; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Voice.V1.DialingPermissionsInstance]'; } }src/Twilio/Rest/Voice/V1/ConnectionPolicyOptions.php000064400000005505150515725670016440 0ustar00options['friendlyName'] = $friendlyName; } /** * A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Voice.V1.CreateConnectionPolicyOptions ' . $options . ']'; } } class UpdateConnectionPolicyOptions extends Options { /** * @param string $friendlyName A string to describe the resource */ public function __construct(string $friendlyName = Values::NONE) { $this->options['friendlyName'] = $friendlyName; } /** * A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Voice.V1.UpdateConnectionPolicyOptions ' . $options . ']'; } }src/Twilio/Rest/Voice/V1/ByocTrunkContext.php000064400000005740150515725670015073 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/ByocTrunks/' . \rawurlencode($sid) . ''; } /** * Fetch the ByocTrunkInstance * * @return ByocTrunkInstance Fetched ByocTrunkInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ByocTrunkInstance { $payload = $this->version->fetch('GET', $this->uri); return new ByocTrunkInstance($this->version, $payload, $this->solution['sid']); } /** * Update the ByocTrunkInstance * * @param array|Options $options Optional Arguments * @return ByocTrunkInstance Updated ByocTrunkInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ByocTrunkInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'VoiceUrl' => $options['voiceUrl'], 'VoiceMethod' => $options['voiceMethod'], 'VoiceFallbackUrl' => $options['voiceFallbackUrl'], 'VoiceFallbackMethod' => $options['voiceFallbackMethod'], 'StatusCallbackUrl' => $options['statusCallbackUrl'], 'StatusCallbackMethod' => $options['statusCallbackMethod'], 'CnamLookupEnabled' => Serialize::booleanToString($options['cnamLookupEnabled']), 'ConnectionPolicySid' => $options['connectionPolicySid'], 'FromDomainSid' => $options['fromDomainSid'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ByocTrunkInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the ByocTrunkInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Voice.V1.ByocTrunkContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Voice/V1/ArchivedCallPage.php000064400000002405150515725670014717 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ArchivedCallInstance \Twilio\Rest\Voice\V1\ArchivedCallInstance */ public function buildInstance(array $payload): ArchivedCallInstance { return new ArchivedCallInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Voice.V1.ArchivedCallPage]'; } }src/Twilio/Rest/Voice/V1/ConnectionPolicy/ConnectionPolicyTargetContext.php000064400000006364150515725670023063 0ustar00solution = ['connectionPolicySid' => $connectionPolicySid, 'sid' => $sid, ]; $this->uri = '/ConnectionPolicies/' . \rawurlencode($connectionPolicySid) . '/Targets/' . \rawurlencode($sid) . ''; } /** * Fetch the ConnectionPolicyTargetInstance * * @return ConnectionPolicyTargetInstance Fetched ConnectionPolicyTargetInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ConnectionPolicyTargetInstance { $payload = $this->version->fetch('GET', $this->uri); return new ConnectionPolicyTargetInstance( $this->version, $payload, $this->solution['connectionPolicySid'], $this->solution['sid'] ); } /** * Update the ConnectionPolicyTargetInstance * * @param array|Options $options Optional Arguments * @return ConnectionPolicyTargetInstance Updated ConnectionPolicyTargetInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ConnectionPolicyTargetInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'Target' => $options['target'], 'Priority' => $options['priority'], 'Weight' => $options['weight'], 'Enabled' => Serialize::booleanToString($options['enabled']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ConnectionPolicyTargetInstance( $this->version, $payload, $this->solution['connectionPolicySid'], $this->solution['sid'] ); } /** * Delete the ConnectionPolicyTargetInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Voice.V1.ConnectionPolicyTargetContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Voice/V1/ConnectionPolicy/ConnectionPolicyTargetInstance.php000064400000011575150515725670023203 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'connectionPolicySid' => Values::array_get($payload, 'connection_policy_sid'), 'sid' => Values::array_get($payload, 'sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'target' => Values::array_get($payload, 'target'), 'priority' => Values::array_get($payload, 'priority'), 'weight' => Values::array_get($payload, 'weight'), 'enabled' => Values::array_get($payload, 'enabled'), '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 = [ 'connectionPolicySid' => $connectionPolicySid, '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 ConnectionPolicyTargetContext Context for this * ConnectionPolicyTargetInstance */ protected function proxy(): ConnectionPolicyTargetContext { if (!$this->context) { $this->context = new ConnectionPolicyTargetContext( $this->version, $this->solution['connectionPolicySid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the ConnectionPolicyTargetInstance * * @return ConnectionPolicyTargetInstance Fetched ConnectionPolicyTargetInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ConnectionPolicyTargetInstance { return $this->proxy()->fetch(); } /** * Update the ConnectionPolicyTargetInstance * * @param array|Options $options Optional Arguments * @return ConnectionPolicyTargetInstance Updated ConnectionPolicyTargetInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ConnectionPolicyTargetInstance { return $this->proxy()->update($options); } /** * Delete the ConnectionPolicyTargetInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Voice.V1.ConnectionPolicyTargetInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Voice/V1/ConnectionPolicy/ConnectionPolicyTargetList.php000064400000014405150515725670022345 0ustar00solution = ['connectionPolicySid' => $connectionPolicySid, ]; $this->uri = '/ConnectionPolicies/' . \rawurlencode($connectionPolicySid) . '/Targets'; } /** * Create the ConnectionPolicyTargetInstance * * @param string $target The SIP address you want Twilio to route your calls to * @param array|Options $options Optional Arguments * @return ConnectionPolicyTargetInstance Created ConnectionPolicyTargetInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $target, array $options = []): ConnectionPolicyTargetInstance { $options = new Values($options); $data = Values::of([ 'Target' => $target, 'FriendlyName' => $options['friendlyName'], 'Priority' => $options['priority'], 'Weight' => $options['weight'], 'Enabled' => Serialize::booleanToString($options['enabled']), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ConnectionPolicyTargetInstance( $this->version, $payload, $this->solution['connectionPolicySid'] ); } /** * Streams ConnectionPolicyTargetInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ConnectionPolicyTargetInstance 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 ConnectionPolicyTargetInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of ConnectionPolicyTargetInstance 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 ConnectionPolicyTargetPage Page of ConnectionPolicyTargetInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ConnectionPolicyTargetPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ConnectionPolicyTargetPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ConnectionPolicyTargetInstance records from the * API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ConnectionPolicyTargetPage Page of ConnectionPolicyTargetInstance */ public function getPage(string $targetUrl): ConnectionPolicyTargetPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ConnectionPolicyTargetPage($this->version, $response, $this->solution); } /** * Constructs a ConnectionPolicyTargetContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): ConnectionPolicyTargetContext { return new ConnectionPolicyTargetContext( $this->version, $this->solution['connectionPolicySid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Voice.V1.ConnectionPolicyTargetList]'; } }src/Twilio/Rest/Voice/V1/ConnectionPolicy/ConnectionPolicyTargetPage.php000064400000002510150515725670022300 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ConnectionPolicyTargetInstance \Twilio\Rest\Voice\V1\ConnectionPolicy\ConnectionPolicyTargetInstance */ public function buildInstance(array $payload): ConnectionPolicyTargetInstance { return new ConnectionPolicyTargetInstance( $this->version, $payload, $this->solution['connectionPolicySid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Voice.V1.ConnectionPolicyTargetPage]'; } }src/Twilio/Rest/Voice/V1/ConnectionPolicy/ConnectionPolicyTargetOptions.php000064400000017770150515725670023075 0ustar00options['friendlyName'] = $friendlyName; $this->options['priority'] = $priority; $this->options['weight'] = $weight; $this->options['enabled'] = $enabled; } /** * A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The relative importance of the target. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important target. * * @param int $priority The relative importance of the target * @return $this Fluent Builder */ public function setPriority(int $priority): self { $this->options['priority'] = $priority; return $this; } /** * The value that determines the relative share of the load the Target should receive compared to other Targets with the same priority. Can be an integer from 1 to 65535, inclusive, and the default is 10. Targets with higher values receive more load than those with lower ones with the same priority. * * @param int $weight The value that determines the relative load the Target * should receive compared to others with the same priority * @return $this Fluent Builder */ public function setWeight(int $weight): self { $this->options['weight'] = $weight; return $this; } /** * Whether the Target is enabled. The default is `true`. * * @param bool $enabled Whether the Target is enabled * @return $this Fluent Builder */ public function setEnabled(bool $enabled): self { $this->options['enabled'] = $enabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Voice.V1.CreateConnectionPolicyTargetOptions ' . $options . ']'; } } class UpdateConnectionPolicyTargetOptions extends Options { /** * @param string $friendlyName A string to describe the resource * @param string $target The SIP address you want Twilio to route your calls to * @param int $priority The relative importance of the target * @param int $weight The value that determines the relative load the Target * should receive compared to others with the same priority * @param bool $enabled Whether the Target is enabled */ public function __construct(string $friendlyName = Values::NONE, string $target = Values::NONE, int $priority = Values::NONE, int $weight = Values::NONE, bool $enabled = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['target'] = $target; $this->options['priority'] = $priority; $this->options['weight'] = $weight; $this->options['enabled'] = $enabled; } /** * A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The SIP address you want Twilio to route your calls to. This must be a `sip:` schema. `sips` is NOT supported. * * @param string $target The SIP address you want Twilio to route your calls to * @return $this Fluent Builder */ public function setTarget(string $target): self { $this->options['target'] = $target; return $this; } /** * The relative importance of the target. Can be an integer from 0 to 65535, inclusive. The lowest number represents the most important target. * * @param int $priority The relative importance of the target * @return $this Fluent Builder */ public function setPriority(int $priority): self { $this->options['priority'] = $priority; return $this; } /** * The value that determines the relative share of the load the Target should receive compared to other Targets with the same priority. Can be an integer from 1 to 65535, inclusive. Targets with higher values receive more load than those with lower ones with the same priority. * * @param int $weight The value that determines the relative load the Target * should receive compared to others with the same priority * @return $this Fluent Builder */ public function setWeight(int $weight): self { $this->options['weight'] = $weight; return $this; } /** * Whether the Target is enabled. * * @param bool $enabled Whether the Target is enabled * @return $this Fluent Builder */ public function setEnabled(bool $enabled): self { $this->options['enabled'] = $enabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Voice.V1.UpdateConnectionPolicyTargetOptions ' . $options . ']'; } }src/Twilio/Rest/Voice/V1/IpRecordOptions.php000064400000010616150515725670014667 0ustar00options['friendlyName'] = $friendlyName; $this->options['cidrPrefixLength'] = $cidrPrefixLength; } /** * A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * An integer representing the length of the [CIDR](https://tools.ietf.org/html/rfc4632) prefix to use with this IP address. By default the entire IP address is used, which for IPv4 is value 32. * * @param int $cidrPrefixLength An integer representing the length of the * [CIDR](https://tools.ietf.org/html/rfc4632) * prefix to use with this IP address. By default * the entire IP address is used, which for IPv4 * is value 32. * @return $this Fluent Builder */ public function setCidrPrefixLength(int $cidrPrefixLength): self { $this->options['cidrPrefixLength'] = $cidrPrefixLength; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Voice.V1.CreateIpRecordOptions ' . $options . ']'; } } class UpdateIpRecordOptions extends Options { /** * @param string $friendlyName A string to describe the resource */ public function __construct(string $friendlyName = Values::NONE) { $this->options['friendlyName'] = $friendlyName; } /** * A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Voice.V1.UpdateIpRecordOptions ' . $options . ']'; } }src/Twilio/Rest/Voice/V1/SourceIpMappingPage.php000064400000002246150515725670015446 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SourceIpMappingInstance \Twilio\Rest\Voice\V1\SourceIpMappingInstance */ public function buildInstance(array $payload): SourceIpMappingInstance { return new SourceIpMappingInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Voice.V1.SourceIpMappingPage]'; } }src/Twilio/Rest/Voice/V1/DialingPermissionsList.php000064400000006741150515725670016247 0ustar00solution = []; } /** * Access the countries */ protected function getCountries(): CountryList { if (!$this->_countries) { $this->_countries = new CountryList($this->version); } return $this->_countries; } /** * Access the settings */ protected function getSettings(): SettingsList { if (!$this->_settings) { $this->_settings = new SettingsList($this->version); } return $this->_settings; } /** * Access the bulkCountryUpdates */ protected function getBulkCountryUpdates(): BulkCountryUpdateList { if (!$this->_bulkCountryUpdates) { $this->_bulkCountryUpdates = new BulkCountryUpdateList($this->version); } return $this->_bulkCountryUpdates; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return \Twilio\ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Voice.V1.DialingPermissionsList]'; } }src/Twilio/Rest/Voice/V1/ArchivedCallContext.php000064400000003162150515725670015470 0ustar00solution = ['date' => $date, 'sid' => $sid, ]; $this->uri = '/Archives/' . \rawurlencode($date->format('Y-m-d')) . '/Calls/' . \rawurlencode($sid) . ''; } /** * Delete the ArchivedCallInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Voice.V1.ArchivedCallContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Voice/V1/ConnectionPolicyInstance.php000064400000010343150515725670016545 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'sid' => Values::array_get($payload, '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'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 ConnectionPolicyContext Context for this ConnectionPolicyInstance */ protected function proxy(): ConnectionPolicyContext { if (!$this->context) { $this->context = new ConnectionPolicyContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the ConnectionPolicyInstance * * @return ConnectionPolicyInstance Fetched ConnectionPolicyInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ConnectionPolicyInstance { return $this->proxy()->fetch(); } /** * Update the ConnectionPolicyInstance * * @param array|Options $options Optional Arguments * @return ConnectionPolicyInstance Updated ConnectionPolicyInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ConnectionPolicyInstance { return $this->proxy()->update($options); } /** * Delete the ConnectionPolicyInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the targets */ protected function getTargets(): ConnectionPolicyTargetList { return $this->proxy()->targets; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Voice.V1.ConnectionPolicyInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Voice/V1/SourceIpMappingContext.php000064400000004615150515725670016220 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/SourceIpMappings/' . \rawurlencode($sid) . ''; } /** * Fetch the SourceIpMappingInstance * * @return SourceIpMappingInstance Fetched SourceIpMappingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SourceIpMappingInstance { $payload = $this->version->fetch('GET', $this->uri); return new SourceIpMappingInstance($this->version, $payload, $this->solution['sid']); } /** * Update the SourceIpMappingInstance * * @param string $sipDomainSid The unique string that identifies a SIP Domain * @return SourceIpMappingInstance Updated SourceIpMappingInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $sipDomainSid): SourceIpMappingInstance { $data = Values::of(['SipDomainSid' => $sipDomainSid, ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new SourceIpMappingInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the SourceIpMappingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Voice.V1.SourceIpMappingContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Voice/V1/IpRecordList.php000064400000012536150515725670014152 0ustar00solution = []; $this->uri = '/IpRecords'; } /** * Create the IpRecordInstance * * @param string $ipAddress An IP address in dotted decimal notation, IPv4 only. * @param array|Options $options Optional Arguments * @return IpRecordInstance Created IpRecordInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $ipAddress, array $options = []): IpRecordInstance { $options = new Values($options); $data = Values::of([ 'IpAddress' => $ipAddress, 'FriendlyName' => $options['friendlyName'], 'CidrPrefixLength' => $options['cidrPrefixLength'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new IpRecordInstance($this->version, $payload); } /** * Streams IpRecordInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads IpRecordInstance 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 IpRecordInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of IpRecordInstance 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 IpRecordPage Page of IpRecordInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): IpRecordPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new IpRecordPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of IpRecordInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return IpRecordPage Page of IpRecordInstance */ public function getPage(string $targetUrl): IpRecordPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new IpRecordPage($this->version, $response, $this->solution); } /** * Constructs a IpRecordContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): IpRecordContext { return new IpRecordContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Voice.V1.IpRecordList]'; } }src/Twilio/Rest/Voice/V1.php000064400000010404150515725670011577 0ustar00version = 'v1'; } protected function getArchivedCalls(): ArchivedCallList { if (!$this->_archivedCalls) { $this->_archivedCalls = new ArchivedCallList($this); } return $this->_archivedCalls; } protected function getByocTrunks(): ByocTrunkList { if (!$this->_byocTrunks) { $this->_byocTrunks = new ByocTrunkList($this); } return $this->_byocTrunks; } protected function getConnectionPolicies(): ConnectionPolicyList { if (!$this->_connectionPolicies) { $this->_connectionPolicies = new ConnectionPolicyList($this); } return $this->_connectionPolicies; } protected function getDialingPermissions(): DialingPermissionsList { if (!$this->_dialingPermissions) { $this->_dialingPermissions = new DialingPermissionsList($this); } return $this->_dialingPermissions; } protected function getIpRecords(): IpRecordList { if (!$this->_ipRecords) { $this->_ipRecords = new IpRecordList($this); } return $this->_ipRecords; } protected function getSourceIpMappings(): SourceIpMappingList { if (!$this->_sourceIpMappings) { $this->_sourceIpMappings = new SourceIpMappingList($this); } return $this->_sourceIpMappings; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Voice.V1]'; } }src/Twilio/Rest/Autopilot/V1/AssistantPage.php000064400000002531150515725670015262 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return AssistantInstance \Twilio\Rest\Autopilot\V1\AssistantInstance */ public function buildInstance(array $payload): AssistantInstance { return new AssistantInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Autopilot.V1.AssistantPage]'; } }src/Twilio/Rest/Autopilot/V1/AssistantList.php000064400000013431150515725670015322 0ustar00solution = []; $this->uri = '/Assistants'; } /** * Streams AssistantInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads AssistantInstance 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 AssistantInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of AssistantInstance 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 AssistantPage Page of AssistantInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): AssistantPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new AssistantPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of AssistantInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return AssistantPage Page of AssistantInstance */ public function getPage(string $targetUrl): AssistantPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new AssistantPage($this->version, $response, $this->solution); } /** * Create the AssistantInstance * * @param array|Options $options Optional Arguments * @return AssistantInstance Created AssistantInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): AssistantInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'LogQueries' => Serialize::booleanToString($options['logQueries']), 'UniqueName' => $options['uniqueName'], 'CallbackUrl' => $options['callbackUrl'], 'CallbackEvents' => $options['callbackEvents'], 'StyleSheet' => Serialize::jsonObject($options['styleSheet']), 'Defaults' => Serialize::jsonObject($options['defaults']), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new AssistantInstance($this->version, $payload); } /** * Constructs a AssistantContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): AssistantContext { return new AssistantContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Autopilot.V1.AssistantList]'; } }src/Twilio/Rest/Autopilot/V1/RestoreAssistantInstance.php000064400000006102150515725670017514 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'sid' => Values::array_get($payload, 'sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'needsModelBuild' => Values::array_get($payload, 'needs_model_build'), 'latestModelBuildSid' => Values::array_get($payload, 'latest_model_build_sid'), 'logQueries' => Values::array_get($payload, 'log_queries'), 'developmentStage' => Values::array_get($payload, 'development_stage'), 'callbackUrl' => Values::array_get($payload, 'callback_url'), 'callbackEvents' => Values::array_get($payload, 'callback_events'), ]; $this->solution = []; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Autopilot.V1.RestoreAssistantInstance]'; } }src/Twilio/Rest/Autopilot/V1/AssistantInstance.php000064400000015153150515725670016156 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), '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'), 'latestModelBuildSid' => Values::array_get($payload, 'latest_model_build_sid'), 'links' => Values::array_get($payload, 'links'), 'logQueries' => Values::array_get($payload, 'log_queries'), 'developmentStage' => Values::array_get($payload, 'development_stage'), 'needsModelBuild' => Values::array_get($payload, 'needs_model_build'), 'sid' => Values::array_get($payload, 'sid'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'url' => Values::array_get($payload, 'url'), 'callbackUrl' => Values::array_get($payload, 'callback_url'), 'callbackEvents' => Values::array_get($payload, 'callback_events'), ]; $this->solution = ['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 AssistantContext Context for this AssistantInstance */ protected function proxy(): AssistantContext { if (!$this->context) { $this->context = new AssistantContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the AssistantInstance * * @return AssistantInstance Fetched AssistantInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AssistantInstance { return $this->proxy()->fetch(); } /** * Update the AssistantInstance * * @param array|Options $options Optional Arguments * @return AssistantInstance Updated AssistantInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): AssistantInstance { return $this->proxy()->update($options); } /** * Delete the AssistantInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the fieldTypes */ protected function getFieldTypes(): FieldTypeList { return $this->proxy()->fieldTypes; } /** * Access the tasks */ protected function getTasks(): TaskList { return $this->proxy()->tasks; } /** * Access the modelBuilds */ protected function getModelBuilds(): ModelBuildList { return $this->proxy()->modelBuilds; } /** * Access the queries */ protected function getQueries(): QueryList { return $this->proxy()->queries; } /** * Access the styleSheet */ protected function getStyleSheet(): StyleSheetList { return $this->proxy()->styleSheet; } /** * Access the defaults */ protected function getDefaults(): DefaultsList { return $this->proxy()->defaults; } /** * Access the dialogues */ protected function getDialogues(): DialogueList { return $this->proxy()->dialogues; } /** * Access the webhooks */ protected function getWebhooks(): WebhookList { return $this->proxy()->webhooks; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Autopilot.V1.AssistantInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Autopilot/V1/AssistantOptions.php000064400000032045150515725670016044 0ustar00options['friendlyName'] = $friendlyName; $this->options['logQueries'] = $logQueries; $this->options['uniqueName'] = $uniqueName; $this->options['callbackUrl'] = $callbackUrl; $this->options['callbackEvents'] = $callbackEvents; $this->options['styleSheet'] = $styleSheet; $this->options['defaults'] = $defaults; } /** * A descriptive string that you create to describe the new resource. It is not unique and can be up to 255 characters long. * * @param string $friendlyName A string to describe the new resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Whether queries should be logged and kept after training. Can be: `true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored. * * @param bool $logQueries Whether queries should be logged and kept after * training * @return $this Fluent Builder */ public function setLogQueries(bool $logQueries): self { $this->options['logQueries'] = $logQueries; return $this; } /** * An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. * * @param string $uniqueName An application-defined string that uniquely * identifies the new resource * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * Reserved. * * @param string $callbackUrl Reserved * @return $this Fluent Builder */ public function setCallbackUrl(string $callbackUrl): self { $this->options['callbackUrl'] = $callbackUrl; return $this; } /** * Reserved. * * @param string $callbackEvents Reserved * @return $this Fluent Builder */ public function setCallbackEvents(string $callbackEvents): self { $this->options['callbackEvents'] = $callbackEvents; return $this; } /** * The JSON string that defines the Assistant's [style sheet](https://www.twilio.com/docs/autopilot/api/assistant/stylesheet) * * @param array $styleSheet A JSON string that defines the Assistant's style * sheet * @return $this Fluent Builder */ public function setStyleSheet(array $styleSheet): self { $this->options['styleSheet'] = $styleSheet; return $this; } /** * A JSON object that defines the Assistant's [default tasks](https://www.twilio.com/docs/autopilot/api/assistant/defaults) for various scenarios, including initiation actions and fallback tasks. * * @param array $defaults A JSON object that defines the Assistant's default * tasks for various scenarios * @return $this Fluent Builder */ public function setDefaults(array $defaults): self { $this->options['defaults'] = $defaults; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Autopilot.V1.CreateAssistantOptions ' . $options . ']'; } } class UpdateAssistantOptions extends Options { /** * @param string $friendlyName A string to describe the resource * @param bool $logQueries Whether queries should be logged and kept after * training * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @param string $callbackUrl Reserved * @param string $callbackEvents Reserved * @param array $styleSheet A JSON string that defines the Assistant's style * sheet * @param array $defaults A JSON object that defines the Assistant's [default * tasks](https://www.twilio.com/docs/autopilot/api/assistant/defaults) for various scenarios * @param string $developmentStage A string describing the state of the * assistant. */ public function __construct(string $friendlyName = Values::NONE, bool $logQueries = Values::NONE, string $uniqueName = Values::NONE, string $callbackUrl = Values::NONE, string $callbackEvents = Values::NONE, array $styleSheet = Values::ARRAY_NONE, array $defaults = Values::ARRAY_NONE, string $developmentStage = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['logQueries'] = $logQueries; $this->options['uniqueName'] = $uniqueName; $this->options['callbackUrl'] = $callbackUrl; $this->options['callbackEvents'] = $callbackEvents; $this->options['styleSheet'] = $styleSheet; $this->options['defaults'] = $defaults; $this->options['developmentStage'] = $developmentStage; } /** * A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Whether queries should be logged and kept after training. Can be: `true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored. * * @param bool $logQueries Whether queries should be logged and kept after * training * @return $this Fluent Builder */ public function setLogQueries(bool $logQueries): self { $this->options['logQueries'] = $logQueries; return $this; } /** * An application-defined string that uniquely identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. * * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * Reserved. * * @param string $callbackUrl Reserved * @return $this Fluent Builder */ public function setCallbackUrl(string $callbackUrl): self { $this->options['callbackUrl'] = $callbackUrl; return $this; } /** * Reserved. * * @param string $callbackEvents Reserved * @return $this Fluent Builder */ public function setCallbackEvents(string $callbackEvents): self { $this->options['callbackEvents'] = $callbackEvents; return $this; } /** * The JSON string that defines the Assistant's [style sheet](https://www.twilio.com/docs/autopilot/api/assistant/stylesheet) * * @param array $styleSheet A JSON string that defines the Assistant's style * sheet * @return $this Fluent Builder */ public function setStyleSheet(array $styleSheet): self { $this->options['styleSheet'] = $styleSheet; return $this; } /** * A JSON object that defines the Assistant's [default tasks](https://www.twilio.com/docs/autopilot/api/assistant/defaults) for various scenarios, including initiation actions and fallback tasks. * * @param array $defaults A JSON object that defines the Assistant's [default * tasks](https://www.twilio.com/docs/autopilot/api/assistant/defaults) for various scenarios * @return $this Fluent Builder */ public function setDefaults(array $defaults): self { $this->options['defaults'] = $defaults; return $this; } /** * A string describing the state of the assistant. * * @param string $developmentStage A string describing the state of the * assistant. * @return $this Fluent Builder */ public function setDevelopmentStage(string $developmentStage): self { $this->options['developmentStage'] = $developmentStage; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Autopilot.V1.UpdateAssistantOptions ' . $options . ']'; } }src/Twilio/Rest/Autopilot/V1/RestoreAssistantPage.php000064400000002603150515725670016626 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return RestoreAssistantInstance \Twilio\Rest\Autopilot\V1\RestoreAssistantInstance */ public function buildInstance(array $payload): RestoreAssistantInstance { return new RestoreAssistantInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Autopilot.V1.RestoreAssistantPage]'; } }src/Twilio/Rest/Autopilot/V1/Assistant/DialogueList.php000064400000002627150515725670017060 0ustar00solution = ['assistantSid' => $assistantSid, ]; } /** * Constructs a DialogueContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): DialogueContext { return new DialogueContext($this->version, $this->solution['assistantSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Autopilot.V1.DialogueList]'; } }src/Twilio/Rest/Autopilot/V1/Assistant/ModelBuildContext.php000064400000005752150515725670020062 0ustar00solution = ['assistantSid' => $assistantSid, 'sid' => $sid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/ModelBuilds/' . \rawurlencode($sid) . ''; } /** * Fetch the ModelBuildInstance * * @return ModelBuildInstance Fetched ModelBuildInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ModelBuildInstance { $payload = $this->version->fetch('GET', $this->uri); return new ModelBuildInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['sid'] ); } /** * Update the ModelBuildInstance * * @param array|Options $options Optional Arguments * @return ModelBuildInstance Updated ModelBuildInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ModelBuildInstance { $options = new Values($options); $data = Values::of(['UniqueName' => $options['uniqueName'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ModelBuildInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['sid'] ); } /** * Delete the ModelBuildInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Autopilot.V1.ModelBuildContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/DialogueContext.php000064400000003776150515725670017577 0ustar00solution = ['assistantSid' => $assistantSid, 'sid' => $sid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/Dialogues/' . \rawurlencode($sid) . ''; } /** * Fetch the DialogueInstance * * @return DialogueInstance Fetched DialogueInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): DialogueInstance { $payload = $this->version->fetch('GET', $this->uri); return new DialogueInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Autopilot.V1.DialogueContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/ModelBuildOptions.php000064400000010751150515725670020064 0ustar00options['statusCallback'] = $statusCallback; $this->options['uniqueName'] = $uniqueName; } /** * The URL we should call using a POST method to send status information to your application. * * @param string $statusCallback The URL we should call using a POST method to * send status information to your application * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * An application-defined string that uniquely identifies the new resource. This value must be a unique string of no more than 64 characters. It can be used as an alternative to the `sid` in the URL path to address the resource. * * @param string $uniqueName An application-defined string that uniquely * identifies the new resource * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Autopilot.V1.CreateModelBuildOptions ' . $options . ']'; } } class UpdateModelBuildOptions extends Options { /** * @param string $uniqueName An application-defined string that uniquely * identifies the resource */ public function __construct(string $uniqueName = Values::NONE) { $this->options['uniqueName'] = $uniqueName; } /** * An application-defined string that uniquely identifies the resource. This value must be a unique string of no more than 64 characters. It can be used as an alternative to the `sid` in the URL path to address the resource. * * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Autopilot.V1.UpdateModelBuildOptions ' . $options . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/DefaultsInstance.php000064400000006775150515725670017737 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'assistantSid' => Values::array_get($payload, 'assistant_sid'), 'url' => Values::array_get($payload, 'url'), 'data' => Values::array_get($payload, 'data'), ]; $this->solution = ['assistantSid' => $assistantSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return DefaultsContext Context for this DefaultsInstance */ protected function proxy(): DefaultsContext { if (!$this->context) { $this->context = new DefaultsContext($this->version, $this->solution['assistantSid']); } return $this->context; } /** * Fetch the DefaultsInstance * * @return DefaultsInstance Fetched DefaultsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): DefaultsInstance { return $this->proxy()->fetch(); } /** * Update the DefaultsInstance * * @param array|Options $options Optional Arguments * @return DefaultsInstance Updated DefaultsInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): DefaultsInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Autopilot.V1.DefaultsInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/QueryInstance.php000064400000011765150515725670017270 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'results' => Values::array_get($payload, 'results'), 'language' => Values::array_get($payload, 'language'), 'modelBuildSid' => Values::array_get($payload, 'model_build_sid'), 'query' => Values::array_get($payload, 'query'), 'sampleSid' => Values::array_get($payload, 'sample_sid'), 'assistantSid' => Values::array_get($payload, 'assistant_sid'), 'sid' => Values::array_get($payload, 'sid'), 'status' => Values::array_get($payload, 'status'), 'url' => Values::array_get($payload, 'url'), 'sourceChannel' => Values::array_get($payload, 'source_channel'), 'dialogueSid' => Values::array_get($payload, 'dialogue_sid'), ]; $this->solution = ['assistantSid' => $assistantSid, '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 QueryContext Context for this QueryInstance */ protected function proxy(): QueryContext { if (!$this->context) { $this->context = new QueryContext( $this->version, $this->solution['assistantSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the QueryInstance * * @return QueryInstance Fetched QueryInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): QueryInstance { return $this->proxy()->fetch(); } /** * Update the QueryInstance * * @param array|Options $options Optional Arguments * @return QueryInstance Updated QueryInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): QueryInstance { return $this->proxy()->update($options); } /** * Delete the QueryInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Autopilot.V1.QueryInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/TaskContext.php000064400000014775150515725670016751 0ustar00solution = ['assistantSid' => $assistantSid, 'sid' => $sid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/Tasks/' . \rawurlencode($sid) . ''; } /** * Fetch the TaskInstance * * @return TaskInstance Fetched TaskInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TaskInstance { $payload = $this->version->fetch('GET', $this->uri); return new TaskInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['sid'] ); } /** * Update the TaskInstance * * @param array|Options $options Optional Arguments * @return TaskInstance Updated TaskInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): TaskInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'UniqueName' => $options['uniqueName'], 'Actions' => Serialize::jsonObject($options['actions']), 'ActionsUrl' => $options['actionsUrl'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new TaskInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['sid'] ); } /** * Delete the TaskInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the fields */ protected function getFields(): FieldList { if (!$this->_fields) { $this->_fields = new FieldList( $this->version, $this->solution['assistantSid'], $this->solution['sid'] ); } return $this->_fields; } /** * Access the samples */ protected function getSamples(): SampleList { if (!$this->_samples) { $this->_samples = new SampleList( $this->version, $this->solution['assistantSid'], $this->solution['sid'] ); } return $this->_samples; } /** * Access the taskActions */ protected function getTaskActions(): TaskActionsList { if (!$this->_taskActions) { $this->_taskActions = new TaskActionsList( $this->version, $this->solution['assistantSid'], $this->solution['sid'] ); } return $this->_taskActions; } /** * Access the statistics */ protected function getStatistics(): TaskStatisticsList { if (!$this->_statistics) { $this->_statistics = new TaskStatisticsList( $this->version, $this->solution['assistantSid'], $this->solution['sid'] ); } return $this->_statistics; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Autopilot.V1.TaskContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/StyleSheetInstance.php000064400000007033150515725670020245 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'assistantSid' => Values::array_get($payload, 'assistant_sid'), 'url' => Values::array_get($payload, 'url'), 'data' => Values::array_get($payload, 'data'), ]; $this->solution = ['assistantSid' => $assistantSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return StyleSheetContext Context for this StyleSheetInstance */ protected function proxy(): StyleSheetContext { if (!$this->context) { $this->context = new StyleSheetContext($this->version, $this->solution['assistantSid']); } return $this->context; } /** * Fetch the StyleSheetInstance * * @return StyleSheetInstance Fetched StyleSheetInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): StyleSheetInstance { return $this->proxy()->fetch(); } /** * Update the StyleSheetInstance * * @param array|Options $options Optional Arguments * @return StyleSheetInstance Updated StyleSheetInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): StyleSheetInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Autopilot.V1.StyleSheetInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/FieldTypeList.php000064400000013526150515725670017214 0ustar00solution = ['assistantSid' => $assistantSid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/FieldTypes'; } /** * Streams FieldTypeInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads FieldTypeInstance 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 FieldTypeInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of FieldTypeInstance 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 FieldTypePage Page of FieldTypeInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): FieldTypePage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new FieldTypePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of FieldTypeInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return FieldTypePage Page of FieldTypeInstance */ public function getPage(string $targetUrl): FieldTypePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new FieldTypePage($this->version, $response, $this->solution); } /** * Create the FieldTypeInstance * * @param string $uniqueName An application-defined string that uniquely * identifies the new resource * @param array|Options $options Optional Arguments * @return FieldTypeInstance Created FieldTypeInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $uniqueName, array $options = []): FieldTypeInstance { $options = new Values($options); $data = Values::of(['UniqueName' => $uniqueName, 'FriendlyName' => $options['friendlyName'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new FieldTypeInstance($this->version, $payload, $this->solution['assistantSid']); } /** * Constructs a FieldTypeContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): FieldTypeContext { return new FieldTypeContext($this->version, $this->solution['assistantSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Autopilot.V1.FieldTypeList]'; } }src/Twilio/Rest/Autopilot/V1/Assistant/DefaultsList.php000064400000002466150515725670017077 0ustar00solution = ['assistantSid' => $assistantSid, ]; } /** * Constructs a DefaultsContext */ public function getContext(): DefaultsContext { return new DefaultsContext($this->version, $this->solution['assistantSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Autopilot.V1.DefaultsList]'; } }src/Twilio/Rest/Autopilot/V1/Assistant/DefaultsPage.php000064400000002610150515725670017027 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return DefaultsInstance \Twilio\Rest\Autopilot\V1\Assistant\DefaultsInstance */ public function buildInstance(array $payload): DefaultsInstance { return new DefaultsInstance($this->version, $payload, $this->solution['assistantSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Autopilot.V1.DefaultsPage]'; } }src/Twilio/Rest/Autopilot/V1/Assistant/StyleSheetList.php000064400000002502150515725670017410 0ustar00solution = ['assistantSid' => $assistantSid, ]; } /** * Constructs a StyleSheetContext */ public function getContext(): StyleSheetContext { return new StyleSheetContext($this->version, $this->solution['assistantSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Autopilot.V1.StyleSheetList]'; } }src/Twilio/Rest/Autopilot/V1/Assistant/TaskInstance.php000064400000013000150515725670017045 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), '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'), 'links' => Values::array_get($payload, 'links'), 'assistantSid' => Values::array_get($payload, 'assistant_sid'), 'sid' => Values::array_get($payload, 'sid'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'actionsUrl' => Values::array_get($payload, 'actions_url'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['assistantSid' => $assistantSid, '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 TaskContext Context for this TaskInstance */ protected function proxy(): TaskContext { if (!$this->context) { $this->context = new TaskContext( $this->version, $this->solution['assistantSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the TaskInstance * * @return TaskInstance Fetched TaskInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TaskInstance { return $this->proxy()->fetch(); } /** * Update the TaskInstance * * @param array|Options $options Optional Arguments * @return TaskInstance Updated TaskInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): TaskInstance { return $this->proxy()->update($options); } /** * Delete the TaskInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the fields */ protected function getFields(): FieldList { return $this->proxy()->fields; } /** * Access the samples */ protected function getSamples(): SampleList { return $this->proxy()->samples; } /** * Access the taskActions */ protected function getTaskActions(): TaskActionsList { return $this->proxy()->taskActions; } /** * Access the statistics */ protected function getStatistics(): TaskStatisticsList { return $this->proxy()->statistics; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Autopilot.V1.TaskInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/StyleSheetOptions.php000064400000003432150515725670020133 0ustar00options['styleSheet'] = $styleSheet; } /** * The JSON string that describes the style sheet object. * * @param array $styleSheet The JSON string that describes the style sheet * object * @return $this Fluent Builder */ public function setStyleSheet(array $styleSheet): self { $this->options['styleSheet'] = $styleSheet; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Autopilot.V1.UpdateStyleSheetOptions ' . $options . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/ModelBuildPage.php000064400000002624150515725670017305 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ModelBuildInstance \Twilio\Rest\Autopilot\V1\Assistant\ModelBuildInstance */ public function buildInstance(array $payload): ModelBuildInstance { return new ModelBuildInstance($this->version, $payload, $this->solution['assistantSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Autopilot.V1.ModelBuildPage]'; } }src/Twilio/Rest/Autopilot/V1/Assistant/WebhookInstance.php000064400000011226150515725670017551 0ustar00properties = [ 'url' => Values::array_get($payload, 'url'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'assistantSid' => Values::array_get($payload, 'assistant_sid'), 'sid' => Values::array_get($payload, 'sid'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'events' => Values::array_get($payload, 'events'), 'webhookUrl' => Values::array_get($payload, 'webhook_url'), 'webhookMethod' => Values::array_get($payload, 'webhook_method'), ]; $this->solution = ['assistantSid' => $assistantSid, '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 WebhookContext Context for this WebhookInstance */ protected function proxy(): WebhookContext { if (!$this->context) { $this->context = new WebhookContext( $this->version, $this->solution['assistantSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the WebhookInstance * * @return WebhookInstance Fetched WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): WebhookInstance { return $this->proxy()->fetch(); } /** * Update the WebhookInstance * * @param array|Options $options Optional Arguments * @return WebhookInstance Updated WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): WebhookInstance { return $this->proxy()->update($options); } /** * Delete the WebhookInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Autopilot.V1.WebhookInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/DefaultsOptions.php000064400000003326150515725670017613 0ustar00options['defaults'] = $defaults; } /** * A JSON string that describes the default task links for the `assistant_initiation`, `collect`, and `fallback` situations. * * @param array $defaults A JSON string that describes the default task links. * @return $this Fluent Builder */ public function setDefaults(array $defaults): self { $this->options['defaults'] = $defaults; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Autopilot.V1.UpdateDefaultsOptions ' . $options . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/DefaultsContext.php000064400000004674150515725670017613 0ustar00solution = ['assistantSid' => $assistantSid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/Defaults'; } /** * Fetch the DefaultsInstance * * @return DefaultsInstance Fetched DefaultsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): DefaultsInstance { $payload = $this->version->fetch('GET', $this->uri); return new DefaultsInstance($this->version, $payload, $this->solution['assistantSid']); } /** * Update the DefaultsInstance * * @param array|Options $options Optional Arguments * @return DefaultsInstance Updated DefaultsInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): DefaultsInstance { $options = new Values($options); $data = Values::of(['Defaults' => Serialize::jsonObject($options['defaults']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new DefaultsInstance($this->version, $payload, $this->solution['assistantSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Autopilot.V1.DefaultsContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/WebhookOptions.php000064400000012711150515725670017440 0ustar00options['webhookMethod'] = $webhookMethod; } /** * The method to be used when calling the webhook's URL. * * @param string $webhookMethod The method to be used when calling the * webhook's URL. * @return $this Fluent Builder */ public function setWebhookMethod(string $webhookMethod): self { $this->options['webhookMethod'] = $webhookMethod; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Autopilot.V1.CreateWebhookOptions ' . $options . ']'; } } class UpdateWebhookOptions extends Options { /** * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @param string $events The list of space-separated events that this Webhook * will subscribe to. * @param string $webhookUrl The URL associated with this Webhook. * @param string $webhookMethod The method to be used when calling the * webhook's URL. */ public function __construct(string $uniqueName = Values::NONE, string $events = Values::NONE, string $webhookUrl = Values::NONE, string $webhookMethod = Values::NONE) { $this->options['uniqueName'] = $uniqueName; $this->options['events'] = $events; $this->options['webhookUrl'] = $webhookUrl; $this->options['webhookMethod'] = $webhookMethod; } /** * An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. This value must be unique and 64 characters or less in length. * * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * The list of space-separated events that this Webhook will subscribe to. * * @param string $events The list of space-separated events that this Webhook * will subscribe to. * @return $this Fluent Builder */ public function setEvents(string $events): self { $this->options['events'] = $events; return $this; } /** * The URL associated with this Webhook. * * @param string $webhookUrl The URL associated with this Webhook. * @return $this Fluent Builder */ public function setWebhookUrl(string $webhookUrl): self { $this->options['webhookUrl'] = $webhookUrl; return $this; } /** * The method to be used when calling the webhook's URL. * * @param string $webhookMethod The method to be used when calling the * webhook's URL. * @return $this Fluent Builder */ public function setWebhookMethod(string $webhookMethod): self { $this->options['webhookMethod'] = $webhookMethod; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Autopilot.V1.UpdateWebhookOptions ' . $options . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/Task/FieldInstance.php000064400000010731150515725670020100 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'fieldType' => Values::array_get($payload, 'field_type'), 'taskSid' => Values::array_get($payload, 'task_sid'), 'assistantSid' => Values::array_get($payload, 'assistant_sid'), 'sid' => Values::array_get($payload, 'sid'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'assistantSid' => $assistantSid, 'taskSid' => $taskSid, '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 FieldContext Context for this FieldInstance */ protected function proxy(): FieldContext { if (!$this->context) { $this->context = new FieldContext( $this->version, $this->solution['assistantSid'], $this->solution['taskSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the FieldInstance * * @return FieldInstance Fetched FieldInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FieldInstance { return $this->proxy()->fetch(); } /** * Delete the FieldInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Autopilot.V1.FieldInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/Task/SampleList.php000064400000015321150515725670017445 0ustar00solution = ['assistantSid' => $assistantSid, 'taskSid' => $taskSid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/Tasks/' . \rawurlencode($taskSid) . '/Samples'; } /** * Streams SampleInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads SampleInstance 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 SampleInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of SampleInstance 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 SamplePage Page of SampleInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SamplePage { $options = new Values($options); $params = Values::of([ 'Language' => $options['language'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new SamplePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of SampleInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return SamplePage Page of SampleInstance */ public function getPage(string $targetUrl): SamplePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new SamplePage($this->version, $response, $this->solution); } /** * Create the SampleInstance * * @param string $language The ISO language-country string that specifies the * language used for the new sample * @param string $taggedText The text example of how end users might express * the task * @param array|Options $options Optional Arguments * @return SampleInstance Created SampleInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $language, string $taggedText, array $options = []): SampleInstance { $options = new Values($options); $data = Values::of([ 'Language' => $language, 'TaggedText' => $taggedText, 'SourceChannel' => $options['sourceChannel'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new SampleInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['taskSid'] ); } /** * Constructs a SampleContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): SampleContext { return new SampleContext( $this->version, $this->solution['assistantSid'], $this->solution['taskSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Autopilot.V1.SampleList]'; } }src/Twilio/Rest/Autopilot/V1/Assistant/Task/TaskActionsOptions.php000064400000003731150515725670021171 0ustar00options['actions'] = $actions; } /** * The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. * * @param array $actions The JSON string that specifies the actions that * instruct the Assistant on how to perform the task * @return $this Fluent Builder */ public function setActions(array $actions): self { $this->options['actions'] = $actions; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Autopilot.V1.UpdateTaskActionsOptions ' . $options . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/Task/FieldContext.php000064400000005076150515725670017766 0ustar00solution = ['assistantSid' => $assistantSid, 'taskSid' => $taskSid, 'sid' => $sid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/Tasks/' . \rawurlencode($taskSid) . '/Fields/' . \rawurlencode($sid) . ''; } /** * Fetch the FieldInstance * * @return FieldInstance Fetched FieldInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FieldInstance { $payload = $this->version->fetch('GET', $this->uri); return new FieldInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['taskSid'], $this->solution['sid'] ); } /** * Delete the FieldInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Autopilot.V1.FieldContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/Task/SampleContext.php000064400000006540150515725670020161 0ustar00solution = ['assistantSid' => $assistantSid, 'taskSid' => $taskSid, 'sid' => $sid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/Tasks/' . \rawurlencode($taskSid) . '/Samples/' . \rawurlencode($sid) . ''; } /** * Fetch the SampleInstance * * @return SampleInstance Fetched SampleInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SampleInstance { $payload = $this->version->fetch('GET', $this->uri); return new SampleInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['taskSid'], $this->solution['sid'] ); } /** * Update the SampleInstance * * @param array|Options $options Optional Arguments * @return SampleInstance Updated SampleInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SampleInstance { $options = new Values($options); $data = Values::of([ 'Language' => $options['language'], 'TaggedText' => $options['taggedText'], 'SourceChannel' => $options['sourceChannel'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new SampleInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['taskSid'], $this->solution['sid'] ); } /** * Delete the SampleInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Autopilot.V1.SampleContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/Task/SampleOptions.php000064400000015244150515725670020171 0ustar00options['language'] = $language; } /** * The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. * * @param string $language The ISO language-country string that specifies the * language used for the sample * @return $this Fluent Builder */ public function setLanguage(string $language): self { $this->options['language'] = $language; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Autopilot.V1.ReadSampleOptions ' . $options . ']'; } } class CreateSampleOptions extends Options { /** * @param string $sourceChannel The communication channel from which the new * sample was captured */ public function __construct(string $sourceChannel = Values::NONE) { $this->options['sourceChannel'] = $sourceChannel; } /** * The communication channel from which the new sample was captured. Can be: `voice`, `sms`, `chat`, `alexa`, `google-assistant`, `slack`, or null if not included. * * @param string $sourceChannel The communication channel from which the new * sample was captured * @return $this Fluent Builder */ public function setSourceChannel(string $sourceChannel): self { $this->options['sourceChannel'] = $sourceChannel; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Autopilot.V1.CreateSampleOptions ' . $options . ']'; } } class UpdateSampleOptions extends Options { /** * @param string $language The ISO language-country string that specifies the * language used for the sample * @param string $taggedText The text example of how end users might express * the task * @param string $sourceChannel The communication channel from which the sample * was captured */ public function __construct(string $language = Values::NONE, string $taggedText = Values::NONE, string $sourceChannel = Values::NONE) { $this->options['language'] = $language; $this->options['taggedText'] = $taggedText; $this->options['sourceChannel'] = $sourceChannel; } /** * The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. * * @param string $language The ISO language-country string that specifies the * language used for the sample * @return $this Fluent Builder */ public function setLanguage(string $language): self { $this->options['language'] = $language; return $this; } /** * The text example of how end users might express the task. The sample can contain [Field tag blocks](https://www.twilio.com/docs/autopilot/api/task-sample#field-tagging). * * @param string $taggedText The text example of how end users might express * the task * @return $this Fluent Builder */ public function setTaggedText(string $taggedText): self { $this->options['taggedText'] = $taggedText; return $this; } /** * The communication channel from which the sample was captured. Can be: `voice`, `sms`, `chat`, `alexa`, `google-assistant`, `slack`, or null if not included. * * @param string $sourceChannel The communication channel from which the sample * was captured * @return $this Fluent Builder */ public function setSourceChannel(string $sourceChannel): self { $this->options['sourceChannel'] = $sourceChannel; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Autopilot.V1.UpdateSampleOptions ' . $options . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/Task/SampleInstance.php000064400000011550150515725670020276 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'taskSid' => Values::array_get($payload, 'task_sid'), 'language' => Values::array_get($payload, 'language'), 'assistantSid' => Values::array_get($payload, 'assistant_sid'), 'sid' => Values::array_get($payload, 'sid'), 'taggedText' => Values::array_get($payload, 'tagged_text'), 'url' => Values::array_get($payload, 'url'), 'sourceChannel' => Values::array_get($payload, 'source_channel'), ]; $this->solution = [ 'assistantSid' => $assistantSid, 'taskSid' => $taskSid, '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 SampleContext Context for this SampleInstance */ protected function proxy(): SampleContext { if (!$this->context) { $this->context = new SampleContext( $this->version, $this->solution['assistantSid'], $this->solution['taskSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the SampleInstance * * @return SampleInstance Fetched SampleInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SampleInstance { return $this->proxy()->fetch(); } /** * Update the SampleInstance * * @param array|Options $options Optional Arguments * @return SampleInstance Updated SampleInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SampleInstance { return $this->proxy()->update($options); } /** * Delete the SampleInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Autopilot.V1.SampleInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/Task/TaskActionsList.php000064400000003047150515725670020451 0ustar00solution = ['assistantSid' => $assistantSid, 'taskSid' => $taskSid, ]; } /** * Constructs a TaskActionsContext */ public function getContext(): TaskActionsContext { return new TaskActionsContext( $this->version, $this->solution['assistantSid'], $this->solution['taskSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Autopilot.V1.TaskActionsList]'; } }src/Twilio/Rest/Autopilot/V1/Assistant/Task/FieldList.php000064400000014144150515725670017251 0ustar00solution = ['assistantSid' => $assistantSid, 'taskSid' => $taskSid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/Tasks/' . \rawurlencode($taskSid) . '/Fields'; } /** * Streams FieldInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads FieldInstance 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 FieldInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of FieldInstance 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 FieldPage Page of FieldInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): FieldPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new FieldPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of FieldInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return FieldPage Page of FieldInstance */ public function getPage(string $targetUrl): FieldPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new FieldPage($this->version, $response, $this->solution); } /** * Create the FieldInstance * * @param string $fieldType The Field Type of this field * @param string $uniqueName An application-defined string that uniquely * identifies the new resource * @return FieldInstance Created FieldInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $fieldType, string $uniqueName): FieldInstance { $data = Values::of(['FieldType' => $fieldType, 'UniqueName' => $uniqueName, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new FieldInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['taskSid'] ); } /** * Constructs a FieldContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): FieldContext { return new FieldContext( $this->version, $this->solution['assistantSid'], $this->solution['taskSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Autopilot.V1.FieldList]'; } }src/Twilio/Rest/Autopilot/V1/Assistant/Task/TaskActionsContext.php000064400000005640150515725670021163 0ustar00solution = ['assistantSid' => $assistantSid, 'taskSid' => $taskSid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/Tasks/' . \rawurlencode($taskSid) . '/Actions'; } /** * Fetch the TaskActionsInstance * * @return TaskActionsInstance Fetched TaskActionsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TaskActionsInstance { $payload = $this->version->fetch('GET', $this->uri); return new TaskActionsInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['taskSid'] ); } /** * Update the TaskActionsInstance * * @param array|Options $options Optional Arguments * @return TaskActionsInstance Updated TaskActionsInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): TaskActionsInstance { $options = new Values($options); $data = Values::of(['Actions' => Serialize::jsonObject($options['actions']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new TaskActionsInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['taskSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Autopilot.V1.TaskActionsContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/Task/FieldPage.php000064400000002726150515725670017215 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return FieldInstance \Twilio\Rest\Autopilot\V1\Assistant\Task\FieldInstance */ public function buildInstance(array $payload): FieldInstance { return new FieldInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['taskSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Autopilot.V1.FieldPage]'; } }src/Twilio/Rest/Autopilot/V1/Assistant/Task/TaskActionsInstance.php000064400000007570150515725670021307 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'assistantSid' => Values::array_get($payload, 'assistant_sid'), 'taskSid' => Values::array_get($payload, 'task_sid'), 'url' => Values::array_get($payload, 'url'), 'data' => Values::array_get($payload, 'data'), ]; $this->solution = ['assistantSid' => $assistantSid, 'taskSid' => $taskSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return TaskActionsContext Context for this TaskActionsInstance */ protected function proxy(): TaskActionsContext { if (!$this->context) { $this->context = new TaskActionsContext( $this->version, $this->solution['assistantSid'], $this->solution['taskSid'] ); } return $this->context; } /** * Fetch the TaskActionsInstance * * @return TaskActionsInstance Fetched TaskActionsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TaskActionsInstance { return $this->proxy()->fetch(); } /** * Update the TaskActionsInstance * * @param array|Options $options Optional Arguments * @return TaskActionsInstance Updated TaskActionsInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): TaskActionsInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Autopilot.V1.TaskActionsInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/Task/TaskStatisticsList.php000064400000003142150515725670021177 0ustar00solution = ['assistantSid' => $assistantSid, 'taskSid' => $taskSid, ]; } /** * Constructs a TaskStatisticsContext */ public function getContext(): TaskStatisticsContext { return new TaskStatisticsContext( $this->version, $this->solution['assistantSid'], $this->solution['taskSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Autopilot.V1.TaskStatisticsList]'; } }src/Twilio/Rest/Autopilot/V1/Assistant/Task/SamplePage.php000064400000002734150515725670017412 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SampleInstance \Twilio\Rest\Autopilot\V1\Assistant\Task\SampleInstance */ public function buildInstance(array $payload): SampleInstance { return new SampleInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['taskSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Autopilot.V1.SamplePage]'; } }src/Twilio/Rest/Autopilot/V1/Assistant/Task/TaskStatisticsContext.php000064400000004203150515725670021707 0ustar00solution = ['assistantSid' => $assistantSid, 'taskSid' => $taskSid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/Tasks/' . \rawurlencode($taskSid) . '/Statistics'; } /** * Fetch the TaskStatisticsInstance * * @return TaskStatisticsInstance Fetched TaskStatisticsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TaskStatisticsInstance { $payload = $this->version->fetch('GET', $this->uri); return new TaskStatisticsInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['taskSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Autopilot.V1.TaskStatisticsContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/Task/TaskActionsPage.php000064400000002772150515725670020416 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return TaskActionsInstance \Twilio\Rest\Autopilot\V1\Assistant\Task\TaskActionsInstance */ public function buildInstance(array $payload): TaskActionsInstance { return new TaskActionsInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['taskSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Autopilot.V1.TaskActionsPage]'; } }src/Twilio/Rest/Autopilot/V1/Assistant/Task/TaskStatisticsInstance.php000064400000007300150515725670022030 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'assistantSid' => Values::array_get($payload, 'assistant_sid'), 'taskSid' => Values::array_get($payload, 'task_sid'), 'samplesCount' => Values::array_get($payload, 'samples_count'), 'fieldsCount' => Values::array_get($payload, 'fields_count'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['assistantSid' => $assistantSid, 'taskSid' => $taskSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return TaskStatisticsContext Context for this TaskStatisticsInstance */ protected function proxy(): TaskStatisticsContext { if (!$this->context) { $this->context = new TaskStatisticsContext( $this->version, $this->solution['assistantSid'], $this->solution['taskSid'] ); } return $this->context; } /** * Fetch the TaskStatisticsInstance * * @return TaskStatisticsInstance Fetched TaskStatisticsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TaskStatisticsInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Autopilot.V1.TaskStatisticsInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/Task/TaskStatisticsPage.php000064400000003014150515725670021136 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return TaskStatisticsInstance \Twilio\Rest\Autopilot\V1\Assistant\Task\TaskStatisticsInstance */ public function buildInstance(array $payload): TaskStatisticsInstance { return new TaskStatisticsInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['taskSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Autopilot.V1.TaskStatisticsPage]'; } }src/Twilio/Rest/Autopilot/V1/Assistant/ModelBuildList.php000064400000013401150515725670017337 0ustar00solution = ['assistantSid' => $assistantSid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/ModelBuilds'; } /** * Streams ModelBuildInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ModelBuildInstance 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 ModelBuildInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of ModelBuildInstance 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 ModelBuildPage Page of ModelBuildInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ModelBuildPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ModelBuildPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ModelBuildInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ModelBuildPage Page of ModelBuildInstance */ public function getPage(string $targetUrl): ModelBuildPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ModelBuildPage($this->version, $response, $this->solution); } /** * Create the ModelBuildInstance * * @param array|Options $options Optional Arguments * @return ModelBuildInstance Created ModelBuildInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): ModelBuildInstance { $options = new Values($options); $data = Values::of([ 'StatusCallback' => $options['statusCallback'], 'UniqueName' => $options['uniqueName'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ModelBuildInstance($this->version, $payload, $this->solution['assistantSid']); } /** * Constructs a ModelBuildContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): ModelBuildContext { return new ModelBuildContext($this->version, $this->solution['assistantSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Autopilot.V1.ModelBuildList]'; } }src/Twilio/Rest/Autopilot/V1/Assistant/FieldType/FieldValueInstance.php000064400000011156150515725670022062 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'fieldTypeSid' => Values::array_get($payload, 'field_type_sid'), 'language' => Values::array_get($payload, 'language'), 'assistantSid' => Values::array_get($payload, 'assistant_sid'), 'sid' => Values::array_get($payload, 'sid'), 'value' => Values::array_get($payload, 'value'), 'url' => Values::array_get($payload, 'url'), 'synonymOf' => Values::array_get($payload, 'synonym_of'), ]; $this->solution = [ 'assistantSid' => $assistantSid, 'fieldTypeSid' => $fieldTypeSid, '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 FieldValueContext Context for this FieldValueInstance */ protected function proxy(): FieldValueContext { if (!$this->context) { $this->context = new FieldValueContext( $this->version, $this->solution['assistantSid'], $this->solution['fieldTypeSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the FieldValueInstance * * @return FieldValueInstance Fetched FieldValueInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FieldValueInstance { return $this->proxy()->fetch(); } /** * Delete the FieldValueInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Autopilot.V1.FieldValueInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/FieldType/FieldValueList.php000064400000015445150515725670021236 0ustar00solution = ['assistantSid' => $assistantSid, 'fieldTypeSid' => $fieldTypeSid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/FieldTypes/' . \rawurlencode($fieldTypeSid) . '/FieldValues'; } /** * Streams FieldValueInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads FieldValueInstance 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 FieldValueInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of FieldValueInstance 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 FieldValuePage Page of FieldValueInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): FieldValuePage { $options = new Values($options); $params = Values::of([ 'Language' => $options['language'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new FieldValuePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of FieldValueInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return FieldValuePage Page of FieldValueInstance */ public function getPage(string $targetUrl): FieldValuePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new FieldValuePage($this->version, $response, $this->solution); } /** * Create the FieldValueInstance * * @param string $language The ISO language-country tag that identifies the * language of the value * @param string $value The Field Value data * @param array|Options $options Optional Arguments * @return FieldValueInstance Created FieldValueInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $language, string $value, array $options = []): FieldValueInstance { $options = new Values($options); $data = Values::of([ 'Language' => $language, 'Value' => $value, 'SynonymOf' => $options['synonymOf'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new FieldValueInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['fieldTypeSid'] ); } /** * Constructs a FieldValueContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): FieldValueContext { return new FieldValueContext( $this->version, $this->solution['assistantSid'], $this->solution['fieldTypeSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Autopilot.V1.FieldValueList]'; } }src/Twilio/Rest/Autopilot/V1/Assistant/FieldType/FieldValuePage.php000064400000003003150515725670021162 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return FieldValueInstance \Twilio\Rest\Autopilot\V1\Assistant\FieldType\FieldValueInstance */ public function buildInstance(array $payload): FieldValueInstance { return new FieldValueInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['fieldTypeSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Autopilot.V1.FieldValuePage]'; } }src/Twilio/Rest/Autopilot/V1/Assistant/FieldType/FieldValueOptions.php000064400000006506150515725670021754 0ustar00options['language'] = $language; } /** * The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US` * * @param string $language The ISO language-country tag that identifies the * language of the value * @return $this Fluent Builder */ public function setLanguage(string $language): self { $this->options['language'] = $language; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Autopilot.V1.ReadFieldValueOptions ' . $options . ']'; } } class CreateFieldValueOptions extends Options { /** * @param string $synonymOf The string value that indicates which word the * field value is a synonym of */ public function __construct(string $synonymOf = Values::NONE) { $this->options['synonymOf'] = $synonymOf; } /** * The string value that indicates which word the field value is a synonym of. * * @param string $synonymOf The string value that indicates which word the * field value is a synonym of * @return $this Fluent Builder */ public function setSynonymOf(string $synonymOf): self { $this->options['synonymOf'] = $synonymOf; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Autopilot.V1.CreateFieldValueOptions ' . $options . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/FieldType/FieldValueContext.php000064400000005216150515725670021742 0ustar00solution = ['assistantSid' => $assistantSid, 'fieldTypeSid' => $fieldTypeSid, 'sid' => $sid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/FieldTypes/' . \rawurlencode($fieldTypeSid) . '/FieldValues/' . \rawurlencode($sid) . ''; } /** * Fetch the FieldValueInstance * * @return FieldValueInstance Fetched FieldValueInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FieldValueInstance { $payload = $this->version->fetch('GET', $this->uri); return new FieldValueInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['fieldTypeSid'], $this->solution['sid'] ); } /** * Delete the FieldValueInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Autopilot.V1.FieldValueContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/DialogueInstance.php000064400000006670150515725670017713 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'assistantSid' => Values::array_get($payload, 'assistant_sid'), 'sid' => Values::array_get($payload, 'sid'), 'data' => Values::array_get($payload, 'data'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['assistantSid' => $assistantSid, '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 DialogueContext Context for this DialogueInstance */ protected function proxy(): DialogueContext { if (!$this->context) { $this->context = new DialogueContext( $this->version, $this->solution['assistantSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the DialogueInstance * * @return DialogueInstance Fetched DialogueInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): DialogueInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Autopilot.V1.DialogueInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/DialoguePage.php000064400000002610150515725670017011 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return DialogueInstance \Twilio\Rest\Autopilot\V1\Assistant\DialogueInstance */ public function buildInstance(array $payload): DialogueInstance { return new DialogueInstance($this->version, $payload, $this->solution['assistantSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Autopilot.V1.DialoguePage]'; } }src/Twilio/Rest/Autopilot/V1/Assistant/FieldTypeInstance.php000064400000011470150515725670020041 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), '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'), 'links' => Values::array_get($payload, 'links'), 'assistantSid' => Values::array_get($payload, 'assistant_sid'), 'sid' => Values::array_get($payload, 'sid'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['assistantSid' => $assistantSid, '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 FieldTypeContext Context for this FieldTypeInstance */ protected function proxy(): FieldTypeContext { if (!$this->context) { $this->context = new FieldTypeContext( $this->version, $this->solution['assistantSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the FieldTypeInstance * * @return FieldTypeInstance Fetched FieldTypeInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FieldTypeInstance { return $this->proxy()->fetch(); } /** * Update the FieldTypeInstance * * @param array|Options $options Optional Arguments * @return FieldTypeInstance Updated FieldTypeInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): FieldTypeInstance { return $this->proxy()->update($options); } /** * Delete the FieldTypeInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the fieldValues */ protected function getFieldValues(): FieldValueList { return $this->proxy()->fieldValues; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Autopilot.V1.FieldTypeInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/TaskOptions.php000064400000016274150515725670016754 0ustar00options['friendlyName'] = $friendlyName; $this->options['actions'] = $actions; $this->options['actionsUrl'] = $actionsUrl; } /** * A descriptive string that you create to describe the new resource. It is not unique and can be up to 255 characters long. * * @param string $friendlyName descriptive string that you create to describe * the new resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. It is optional and not unique. * * @param array $actions The JSON string that specifies the actions that * instruct the Assistant on how to perform the task * @return $this Fluent Builder */ public function setActions(array $actions): self { $this->options['actions'] = $actions; return $this; } /** * The URL from which the Assistant can fetch actions. * * @param string $actionsUrl The URL from which the Assistant can fetch actions * @return $this Fluent Builder */ public function setActionsUrl(string $actionsUrl): self { $this->options['actionsUrl'] = $actionsUrl; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Autopilot.V1.CreateTaskOptions ' . $options . ']'; } } class UpdateTaskOptions extends Options { /** * @param string $friendlyName A string to describe the resource * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @param array $actions The JSON string that specifies the actions that * instruct the Assistant on how to perform the task * @param string $actionsUrl The URL from which the Assistant can fetch actions */ public function __construct(string $friendlyName = Values::NONE, string $uniqueName = Values::NONE, array $actions = Values::ARRAY_NONE, string $actionsUrl = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['uniqueName'] = $uniqueName; $this->options['actions'] = $actions; $this->options['actionsUrl'] = $actionsUrl; } /** * A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * An application-defined string that uniquely identifies the resource. This value must be 64 characters or less in length and be unique. It can be used as an alternative to the `sid` in the URL path to address the resource. * * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. * * @param array $actions The JSON string that specifies the actions that * instruct the Assistant on how to perform the task * @return $this Fluent Builder */ public function setActions(array $actions): self { $this->options['actions'] = $actions; return $this; } /** * The URL from which the Assistant can fetch actions. * * @param string $actionsUrl The URL from which the Assistant can fetch actions * @return $this Fluent Builder */ public function setActionsUrl(string $actionsUrl): self { $this->options['actionsUrl'] = $actionsUrl; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Autopilot.V1.UpdateTaskOptions ' . $options . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/StyleSheetPage.php000064400000002624150515725670017356 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return StyleSheetInstance \Twilio\Rest\Autopilot\V1\Assistant\StyleSheetInstance */ public function buildInstance(array $payload): StyleSheetInstance { return new StyleSheetInstance($this->version, $payload, $this->solution['assistantSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Autopilot.V1.StyleSheetPage]'; } }src/Twilio/Rest/Autopilot/V1/Assistant/QueryList.php000064400000014703150515725670016432 0ustar00solution = ['assistantSid' => $assistantSid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/Queries'; } /** * Streams QueryInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads QueryInstance 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 QueryInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of QueryInstance 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 QueryPage Page of QueryInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): QueryPage { $options = new Values($options); $params = Values::of([ 'Language' => $options['language'], 'ModelBuild' => $options['modelBuild'], 'Status' => $options['status'], 'DialogueSid' => $options['dialogueSid'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new QueryPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of QueryInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return QueryPage Page of QueryInstance */ public function getPage(string $targetUrl): QueryPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new QueryPage($this->version, $response, $this->solution); } /** * Create the QueryInstance * * @param string $language The ISO language-country string that specifies the * language used for the new query * @param string $query The end-user's natural language input * @param array|Options $options Optional Arguments * @return QueryInstance Created QueryInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $language, string $query, array $options = []): QueryInstance { $options = new Values($options); $data = Values::of([ 'Language' => $language, 'Query' => $query, 'Tasks' => $options['tasks'], 'ModelBuild' => $options['modelBuild'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new QueryInstance($this->version, $payload, $this->solution['assistantSid']); } /** * Constructs a QueryContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): QueryContext { return new QueryContext($this->version, $this->solution['assistantSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Autopilot.V1.QueryList]'; } }src/Twilio/Rest/Autopilot/V1/Assistant/ModelBuildInstance.php000064400000011264150515725670020175 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'assistantSid' => Values::array_get($payload, 'assistant_sid'), 'sid' => Values::array_get($payload, 'sid'), 'status' => Values::array_get($payload, 'status'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'url' => Values::array_get($payload, 'url'), 'buildDuration' => Values::array_get($payload, 'build_duration'), 'errorCode' => Values::array_get($payload, 'error_code'), ]; $this->solution = ['assistantSid' => $assistantSid, '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 ModelBuildContext Context for this ModelBuildInstance */ protected function proxy(): ModelBuildContext { if (!$this->context) { $this->context = new ModelBuildContext( $this->version, $this->solution['assistantSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the ModelBuildInstance * * @return ModelBuildInstance Fetched ModelBuildInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ModelBuildInstance { return $this->proxy()->fetch(); } /** * Update the ModelBuildInstance * * @param array|Options $options Optional Arguments * @return ModelBuildInstance Updated ModelBuildInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ModelBuildInstance { return $this->proxy()->update($options); } /** * Delete the ModelBuildInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Autopilot.V1.ModelBuildInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/FieldTypeContext.php000064400000011424150515725670017720 0ustar00solution = ['assistantSid' => $assistantSid, 'sid' => $sid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/FieldTypes/' . \rawurlencode($sid) . ''; } /** * Fetch the FieldTypeInstance * * @return FieldTypeInstance Fetched FieldTypeInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FieldTypeInstance { $payload = $this->version->fetch('GET', $this->uri); return new FieldTypeInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['sid'] ); } /** * Update the FieldTypeInstance * * @param array|Options $options Optional Arguments * @return FieldTypeInstance Updated FieldTypeInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): FieldTypeInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'UniqueName' => $options['uniqueName'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new FieldTypeInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['sid'] ); } /** * Delete the FieldTypeInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the fieldValues */ protected function getFieldValues(): FieldValueList { if (!$this->_fieldValues) { $this->_fieldValues = new FieldValueList( $this->version, $this->solution['assistantSid'], $this->solution['sid'] ); } return $this->_fieldValues; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Autopilot.V1.FieldTypeContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/WebhookPage.php000064400000002602150515725670016657 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return WebhookInstance \Twilio\Rest\Autopilot\V1\Assistant\WebhookInstance */ public function buildInstance(array $payload): WebhookInstance { return new WebhookInstance($this->version, $payload, $this->solution['assistantSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Autopilot.V1.WebhookPage]'; } }src/Twilio/Rest/Autopilot/V1/Assistant/QueryPage.php000064400000002566150515725670016377 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return QueryInstance \Twilio\Rest\Autopilot\V1\Assistant\QueryInstance */ public function buildInstance(array $payload): QueryInstance { return new QueryInstance($this->version, $payload, $this->solution['assistantSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Autopilot.V1.QueryPage]'; } }src/Twilio/Rest/Autopilot/V1/Assistant/QueryOptions.php000064400000020470150515725670017150 0ustar00options['language'] = $language; $this->options['modelBuild'] = $modelBuild; $this->options['status'] = $status; $this->options['dialogueSid'] = $dialogueSid; } /** * The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used by the Query resources to read. For example: `en-US`. * * @param string $language The ISO language-country string that specifies the * language used by the Query resources to read * @return $this Fluent Builder */ public function setLanguage(string $language): self { $this->options['language'] = $language; return $this; } /** * The SID or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried. * * @param string $modelBuild The SID or unique name of the Model Build to be * queried * @return $this Fluent Builder */ public function setModelBuild(string $modelBuild): self { $this->options['modelBuild'] = $modelBuild; return $this; } /** * The status of the resources to read. Can be: `pending-review`, `reviewed`, or `discarded` * * @param string $status The status of the resources to read * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * The SID of the [Dialogue](https://www.twilio.com/docs/autopilot/api/dialogue). * * @param string $dialogueSid The SID of the * [Dialogue](https://www.twilio.com/docs/autopilot/api/dialogue). * @return $this Fluent Builder */ public function setDialogueSid(string $dialogueSid): self { $this->options['dialogueSid'] = $dialogueSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Autopilot.V1.ReadQueryOptions ' . $options . ']'; } } class CreateQueryOptions extends Options { /** * @param string $tasks The list of tasks to limit the new query to * @param string $modelBuild The SID or unique name of the Model Build to be * queried */ public function __construct(string $tasks = Values::NONE, string $modelBuild = Values::NONE) { $this->options['tasks'] = $tasks; $this->options['modelBuild'] = $modelBuild; } /** * The list of tasks to limit the new query to. Tasks are expressed as a comma-separated list of task `unique_name` values. For example, `task-unique_name-1, task-unique_name-2`. Listing specific tasks is useful to constrain the paths that a user can take. * * @param string $tasks The list of tasks to limit the new query to * @return $this Fluent Builder */ public function setTasks(string $tasks): self { $this->options['tasks'] = $tasks; return $this; } /** * The SID or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried. * * @param string $modelBuild The SID or unique name of the Model Build to be * queried * @return $this Fluent Builder */ public function setModelBuild(string $modelBuild): self { $this->options['modelBuild'] = $modelBuild; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Autopilot.V1.CreateQueryOptions ' . $options . ']'; } } class UpdateQueryOptions extends Options { /** * @param string $sampleSid The SID of an optional reference to the Sample * created from the query * @param string $status The new status of the resource */ public function __construct(string $sampleSid = Values::NONE, string $status = Values::NONE) { $this->options['sampleSid'] = $sampleSid; $this->options['status'] = $status; } /** * The SID of an optional reference to the [Sample](https://www.twilio.com/docs/autopilot/api/task-sample) created from the query. * * @param string $sampleSid The SID of an optional reference to the Sample * created from the query * @return $this Fluent Builder */ public function setSampleSid(string $sampleSid): self { $this->options['sampleSid'] = $sampleSid; return $this; } /** * The new status of the resource. Can be: `pending-review`, `reviewed`, or `discarded` * * @param string $status The new status of the resource * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Autopilot.V1.UpdateQueryOptions ' . $options . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/WebhookList.php000064400000014203150515725670016716 0ustar00solution = ['assistantSid' => $assistantSid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/Webhooks'; } /** * Streams WebhookInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads WebhookInstance 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 WebhookInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of WebhookInstance 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 WebhookPage Page of WebhookInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): WebhookPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new WebhookPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of WebhookInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return WebhookPage Page of WebhookInstance */ public function getPage(string $targetUrl): WebhookPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new WebhookPage($this->version, $response, $this->solution); } /** * Create the WebhookInstance * * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @param string $events The list of space-separated events that this Webhook * will subscribe to. * @param string $webhookUrl The URL associated with this Webhook. * @param array|Options $options Optional Arguments * @return WebhookInstance Created WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $uniqueName, string $events, string $webhookUrl, array $options = []): WebhookInstance { $options = new Values($options); $data = Values::of([ 'UniqueName' => $uniqueName, 'Events' => $events, 'WebhookUrl' => $webhookUrl, 'WebhookMethod' => $options['webhookMethod'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new WebhookInstance($this->version, $payload, $this->solution['assistantSid']); } /** * Constructs a WebhookContext * * @param string $sid The unique string that identifies the resource to fetch */ public function getContext(string $sid): WebhookContext { return new WebhookContext($this->version, $this->solution['assistantSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Autopilot.V1.WebhookList]'; } }src/Twilio/Rest/Autopilot/V1/Assistant/QueryContext.php000064400000005676150515725670017154 0ustar00solution = ['assistantSid' => $assistantSid, 'sid' => $sid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/Queries/' . \rawurlencode($sid) . ''; } /** * Fetch the QueryInstance * * @return QueryInstance Fetched QueryInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): QueryInstance { $payload = $this->version->fetch('GET', $this->uri); return new QueryInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['sid'] ); } /** * Update the QueryInstance * * @param array|Options $options Optional Arguments * @return QueryInstance Updated QueryInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): QueryInstance { $options = new Values($options); $data = Values::of(['SampleSid' => $options['sampleSid'], 'Status' => $options['status'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new QueryInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['sid'] ); } /** * Delete the QueryInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Autopilot.V1.QueryContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/WebhookContext.php000064400000006165150515725670017437 0ustar00solution = ['assistantSid' => $assistantSid, 'sid' => $sid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/Webhooks/' . \rawurlencode($sid) . ''; } /** * Fetch the WebhookInstance * * @return WebhookInstance Fetched WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): WebhookInstance { $payload = $this->version->fetch('GET', $this->uri); return new WebhookInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['sid'] ); } /** * Update the WebhookInstance * * @param array|Options $options Optional Arguments * @return WebhookInstance Updated WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): WebhookInstance { $options = new Values($options); $data = Values::of([ 'UniqueName' => $options['uniqueName'], 'Events' => $options['events'], 'WebhookUrl' => $options['webhookUrl'], 'WebhookMethod' => $options['webhookMethod'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new WebhookInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['sid'] ); } /** * Delete the WebhookInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Autopilot.V1.WebhookContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/FieldTypePage.php000064400000002616150515725670017153 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return FieldTypeInstance \Twilio\Rest\Autopilot\V1\Assistant\FieldTypeInstance */ public function buildInstance(array $payload): FieldTypeInstance { return new FieldTypeInstance($this->version, $payload, $this->solution['assistantSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Autopilot.V1.FieldTypePage]'; } }src/Twilio/Rest/Autopilot/V1/Assistant/FieldTypeOptions.php000064400000007627150515725670017741 0ustar00options['friendlyName'] = $friendlyName; } /** * A descriptive string that you create to describe the new resource. It is not unique and can be up to 255 characters long. * * @param string $friendlyName A string to describe the new resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Autopilot.V1.CreateFieldTypeOptions ' . $options . ']'; } } class UpdateFieldTypeOptions extends Options { /** * @param string $friendlyName A string to describe the resource * @param string $uniqueName An application-defined string that uniquely * identifies the resource */ public function __construct(string $friendlyName = Values::NONE, string $uniqueName = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['uniqueName'] = $uniqueName; } /** * A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * An application-defined string that uniquely identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. * * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Autopilot.V1.UpdateFieldTypeOptions ' . $options . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/StyleSheetContext.php000064400000004726150515725670020133 0ustar00solution = ['assistantSid' => $assistantSid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/StyleSheet'; } /** * Fetch the StyleSheetInstance * * @return StyleSheetInstance Fetched StyleSheetInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): StyleSheetInstance { $payload = $this->version->fetch('GET', $this->uri); return new StyleSheetInstance($this->version, $payload, $this->solution['assistantSid']); } /** * Update the StyleSheetInstance * * @param array|Options $options Optional Arguments * @return StyleSheetInstance Updated StyleSheetInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): StyleSheetInstance { $options = new Values($options); $data = Values::of(['StyleSheet' => Serialize::jsonObject($options['styleSheet']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new StyleSheetInstance($this->version, $payload, $this->solution['assistantSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Autopilot.V1.StyleSheetContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Autopilot/V1/Assistant/TaskList.php000064400000013616150515725670016231 0ustar00solution = ['assistantSid' => $assistantSid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/Tasks'; } /** * Streams TaskInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads TaskInstance 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 TaskInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of TaskInstance 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 TaskPage Page of TaskInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): TaskPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new TaskPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of TaskInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return TaskPage Page of TaskInstance */ public function getPage(string $targetUrl): TaskPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new TaskPage($this->version, $response, $this->solution); } /** * Create the TaskInstance * * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @param array|Options $options Optional Arguments * @return TaskInstance Created TaskInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $uniqueName, array $options = []): TaskInstance { $options = new Values($options); $data = Values::of([ 'UniqueName' => $uniqueName, 'FriendlyName' => $options['friendlyName'], 'Actions' => Serialize::jsonObject($options['actions']), 'ActionsUrl' => $options['actionsUrl'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new TaskInstance($this->version, $payload, $this->solution['assistantSid']); } /** * Constructs a TaskContext * * @param string $sid The unique string that identifies the resource to fetch */ public function getContext(string $sid): TaskContext { return new TaskContext($this->version, $this->solution['assistantSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Autopilot.V1.TaskList]'; } }src/Twilio/Rest/Autopilot/V1/Assistant/TaskPage.php000064400000002560150515725670016166 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return TaskInstance \Twilio\Rest\Autopilot\V1\Assistant\TaskInstance */ public function buildInstance(array $payload): TaskInstance { return new TaskInstance($this->version, $payload, $this->solution['assistantSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Autopilot.V1.TaskPage]'; } }src/Twilio/Rest/Autopilot/V1/AssistantContext.php000064400000017514150515725670016041 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Assistants/' . \rawurlencode($sid) . ''; } /** * Fetch the AssistantInstance * * @return AssistantInstance Fetched AssistantInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AssistantInstance { $payload = $this->version->fetch('GET', $this->uri); return new AssistantInstance($this->version, $payload, $this->solution['sid']); } /** * Update the AssistantInstance * * @param array|Options $options Optional Arguments * @return AssistantInstance Updated AssistantInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): AssistantInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'LogQueries' => Serialize::booleanToString($options['logQueries']), 'UniqueName' => $options['uniqueName'], 'CallbackUrl' => $options['callbackUrl'], 'CallbackEvents' => $options['callbackEvents'], 'StyleSheet' => Serialize::jsonObject($options['styleSheet']), 'Defaults' => Serialize::jsonObject($options['defaults']), 'DevelopmentStage' => $options['developmentStage'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new AssistantInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the AssistantInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the fieldTypes */ protected function getFieldTypes(): FieldTypeList { if (!$this->_fieldTypes) { $this->_fieldTypes = new FieldTypeList($this->version, $this->solution['sid']); } return $this->_fieldTypes; } /** * Access the tasks */ protected function getTasks(): TaskList { if (!$this->_tasks) { $this->_tasks = new TaskList($this->version, $this->solution['sid']); } return $this->_tasks; } /** * Access the modelBuilds */ protected function getModelBuilds(): ModelBuildList { if (!$this->_modelBuilds) { $this->_modelBuilds = new ModelBuildList($this->version, $this->solution['sid']); } return $this->_modelBuilds; } /** * Access the queries */ protected function getQueries(): QueryList { if (!$this->_queries) { $this->_queries = new QueryList($this->version, $this->solution['sid']); } return $this->_queries; } /** * Access the styleSheet */ protected function getStyleSheet(): StyleSheetList { if (!$this->_styleSheet) { $this->_styleSheet = new StyleSheetList($this->version, $this->solution['sid']); } return $this->_styleSheet; } /** * Access the defaults */ protected function getDefaults(): DefaultsList { if (!$this->_defaults) { $this->_defaults = new DefaultsList($this->version, $this->solution['sid']); } return $this->_defaults; } /** * Access the dialogues */ protected function getDialogues(): DialogueList { if (!$this->_dialogues) { $this->_dialogues = new DialogueList($this->version, $this->solution['sid']); } return $this->_dialogues; } /** * Access the webhooks */ protected function getWebhooks(): WebhookList { if (!$this->_webhooks) { $this->_webhooks = new WebhookList($this->version, $this->solution['sid']); } return $this->_webhooks; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Autopilot.V1.AssistantContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Autopilot/V1/RestoreAssistantList.php000064400000003141150515725670016663 0ustar00solution = []; $this->uri = '/Assistants/Restore'; } /** * Update the RestoreAssistantInstance * * @param string $assistant The unique string that identifies the resource * @return RestoreAssistantInstance Updated RestoreAssistantInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $assistant): RestoreAssistantInstance { $data = Values::of(['Assistant' => $assistant, ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new RestoreAssistantInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Autopilot.V1.RestoreAssistantList]'; } }src/Twilio/Rest/Autopilot/V1.php000064400000005100150515725670012507 0ustar00version = 'v1'; } protected function getAssistants(): AssistantList { if (!$this->_assistants) { $this->_assistants = new AssistantList($this); } return $this->_assistants; } protected function getRestoreAssistant(): RestoreAssistantList { if (!$this->_restoreAssistant) { $this->_restoreAssistant = new RestoreAssistantList($this); } return $this->_restoreAssistant; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Autopilot.V1]'; } }src/Twilio/Rest/Numbers.php000064400000004401150515725670011657 0ustar00baseUrl = 'https://numbers.twilio.com'; } /** * @return V2 Version v2 of numbers */ protected function getV2(): V2 { if (!$this->_v2) { $this->_v2 = new V2($this); } return $this->_v2; } /** * Magic getter to lazy load version * * @param string $name Version to return * @return \Twilio\Version The requested version * @throws TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } protected function getRegulatoryCompliance(): \Twilio\Rest\Numbers\V2\RegulatoryComplianceList { return $this->v2->regulatoryCompliance; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Numbers]'; } }src/Twilio/Rest/Bulkexports/V1/ExportContext.php000064400000007122150515725670015705 0ustar00solution = ['resourceType' => $resourceType, ]; $this->uri = '/Exports/' . \rawurlencode($resourceType) . ''; } /** * Fetch the ExportInstance * * @return ExportInstance Fetched ExportInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ExportInstance { $payload = $this->version->fetch('GET', $this->uri); return new ExportInstance($this->version, $payload, $this->solution['resourceType']); } /** * Access the days */ protected function getDays(): DayList { if (!$this->_days) { $this->_days = new DayList($this->version, $this->solution['resourceType']); } return $this->_days; } /** * Access the exportCustomJobs */ protected function getExportCustomJobs(): ExportCustomJobList { if (!$this->_exportCustomJobs) { $this->_exportCustomJobs = new ExportCustomJobList($this->version, $this->solution['resourceType']); } return $this->_exportCustomJobs; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Bulkexports.V1.ExportContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Bulkexports/V1/ExportConfigurationOptions.php000064400000005442150515725670020447 0ustar00options['enabled'] = $enabled; $this->options['webhookUrl'] = $webhookUrl; $this->options['webhookMethod'] = $webhookMethod; } /** * If true, Twilio will automatically generate every day's file when the day is over. * * @param bool $enabled Whether files are automatically generated * @return $this Fluent Builder */ public function setEnabled(bool $enabled): self { $this->options['enabled'] = $enabled; return $this; } /** * Stores the URL destination for the method specified in webhook_method. * * @param string $webhookUrl URL targeted at export * @return $this Fluent Builder */ public function setWebhookUrl(string $webhookUrl): self { $this->options['webhookUrl'] = $webhookUrl; return $this; } /** * Sets whether Twilio should call a webhook URL when the automatic generation is complete, using GET or POST. The actual destination is set in the webhook_url * * @param string $webhookMethod Whether to GET or POST to the webhook url * @return $this Fluent Builder */ public function setWebhookMethod(string $webhookMethod): self { $this->options['webhookMethod'] = $webhookMethod; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Bulkexports.V1.UpdateExportConfigurationOptions ' . $options . ']'; } }src/Twilio/Rest/Bulkexports/V1/ExportPage.php000064400000002202150515725670015127 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ExportInstance \Twilio\Rest\Bulkexports\V1\ExportInstance */ public function buildInstance(array $payload): ExportInstance { return new ExportInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Bulkexports.V1.ExportPage]'; } }src/Twilio/Rest/Bulkexports/V1/ExportConfigurationList.php000064400000002212150515725670017717 0ustar00solution = []; } /** * Constructs a ExportConfigurationContext * * @param string $resourceType The type of communication – Messages, Calls, * Conferences, and Participants */ public function getContext(string $resourceType): ExportConfigurationContext { return new ExportConfigurationContext($this->version, $resourceType); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Bulkexports.V1.ExportConfigurationList]'; } }src/Twilio/Rest/Bulkexports/V1/ExportConfigurationPage.php000064400000002320150515725670017660 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ExportConfigurationInstance \Twilio\Rest\Bulkexports\V1\ExportConfigurationInstance */ public function buildInstance(array $payload): ExportConfigurationInstance { return new ExportConfigurationInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Bulkexports.V1.ExportConfigurationPage]'; } }src/Twilio/Rest/Bulkexports/V1/ExportConfigurationContext.php000064400000005012150515725670020431 0ustar00solution = ['resourceType' => $resourceType, ]; $this->uri = '/Exports/' . \rawurlencode($resourceType) . '/Configuration'; } /** * Fetch the ExportConfigurationInstance * * @return ExportConfigurationInstance Fetched ExportConfigurationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ExportConfigurationInstance { $payload = $this->version->fetch('GET', $this->uri); return new ExportConfigurationInstance($this->version, $payload, $this->solution['resourceType']); } /** * Update the ExportConfigurationInstance * * @param array|Options $options Optional Arguments * @return ExportConfigurationInstance Updated ExportConfigurationInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ExportConfigurationInstance { $options = new Values($options); $data = Values::of([ 'Enabled' => Serialize::booleanToString($options['enabled']), 'WebhookUrl' => $options['webhookUrl'], 'WebhookMethod' => $options['webhookMethod'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ExportConfigurationInstance($this->version, $payload, $this->solution['resourceType']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Bulkexports.V1.ExportConfigurationContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Bulkexports/V1/ExportList.php000064400000005163150515725670015177 0ustar00solution = []; } /** * Access the jobs */ protected function getJobs(): JobList { if (!$this->_jobs) { $this->_jobs = new JobList($this->version); } return $this->_jobs; } /** * Constructs a ExportContext * * @param string $resourceType The type of communication – Messages, Calls, * Conferences, and Participants */ public function getContext(string $resourceType): ExportContext { return new ExportContext($this->version, $resourceType); } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return \Twilio\ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Bulkexports.V1.ExportList]'; } }src/Twilio/Rest/Bulkexports/V1/Export/DayContext.php000064400000003376150515725670016431 0ustar00solution = ['resourceType' => $resourceType, 'day' => $day, ]; $this->uri = '/Exports/' . \rawurlencode($resourceType) . '/Days/' . \rawurlencode($day) . ''; } /** * Fetch the DayInstance * * @return DayInstance Fetched DayInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): DayInstance { $payload = $this->version->fetch('GET', $this->uri); return new DayInstance( $this->version, $payload, $this->solution['resourceType'], $this->solution['day'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Bulkexports.V1.DayContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Bulkexports/V1/Export/DayList.php000064400000011307150515725670015711 0ustar00solution = ['resourceType' => $resourceType, ]; $this->uri = '/Exports/' . \rawurlencode($resourceType) . '/Days'; } /** * Streams DayInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads DayInstance 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 DayInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of DayInstance 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 DayPage Page of DayInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): DayPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new DayPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of DayInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return DayPage Page of DayInstance */ public function getPage(string $targetUrl): DayPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new DayPage($this->version, $response, $this->solution); } /** * Constructs a DayContext * * @param string $day The date of the data in the file */ public function getContext(string $day): DayContext { return new DayContext($this->version, $this->solution['resourceType'], $day); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Bulkexports.V1.DayList]'; } }src/Twilio/Rest/Bulkexports/V1/Export/JobContext.php000064400000003445150515725670016423 0ustar00solution = ['jobSid' => $jobSid, ]; $this->uri = '/Exports/Jobs/' . \rawurlencode($jobSid) . ''; } /** * Fetch the JobInstance * * @return JobInstance Fetched JobInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): JobInstance { $payload = $this->version->fetch('GET', $this->uri); return new JobInstance($this->version, $payload, $this->solution['jobSid']); } /** * Delete the JobInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Bulkexports.V1.JobContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Bulkexports/V1/Export/JobPage.php000064400000002176150515725670015653 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return JobInstance \Twilio\Rest\Bulkexports\V1\Export\JobInstance */ public function buildInstance(array $payload): JobInstance { return new JobInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Bulkexports.V1.JobPage]'; } }src/Twilio/Rest/Bulkexports/V1/Export/ExportCustomJobInstance.php000064400000005561150515725670021141 0ustar00properties = [ 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'resourceType' => Values::array_get($payload, 'resource_type'), 'startDay' => Values::array_get($payload, 'start_day'), 'endDay' => Values::array_get($payload, 'end_day'), 'webhookUrl' => Values::array_get($payload, 'webhook_url'), 'webhookMethod' => Values::array_get($payload, 'webhook_method'), 'email' => Values::array_get($payload, 'email'), 'jobSid' => Values::array_get($payload, 'job_sid'), 'details' => Values::array_get($payload, 'details'), 'jobQueuePosition' => Values::array_get($payload, 'job_queue_position'), 'estimatedCompletionTime' => Values::array_get($payload, 'estimated_completion_time'), ]; $this->solution = ['resourceType' => $resourceType, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Bulkexports.V1.ExportCustomJobInstance]'; } }src/Twilio/Rest/Bulkexports/V1/Export/ExportCustomJobList.php000064400000014113150515725670020301 0ustar00solution = ['resourceType' => $resourceType, ]; $this->uri = '/Exports/' . \rawurlencode($resourceType) . '/Jobs'; } /** * Streams ExportCustomJobInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ExportCustomJobInstance 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 ExportCustomJobInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of ExportCustomJobInstance 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 ExportCustomJobPage Page of ExportCustomJobInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ExportCustomJobPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ExportCustomJobPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ExportCustomJobInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ExportCustomJobPage Page of ExportCustomJobInstance */ public function getPage(string $targetUrl): ExportCustomJobPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ExportCustomJobPage($this->version, $response, $this->solution); } /** * Create the ExportCustomJobInstance * * @param string $startDay The start day for the custom export specified as a * string in the format of yyyy-mm-dd * @param string $endDay The end day for the custom export specified as a * string in the format of yyyy-mm-dd. End day is * inclusive and must be 2 days earlier than the current * UTC day. * @param string $friendlyName The friendly name specified when creating the job * @param array|Options $options Optional Arguments * @return ExportCustomJobInstance Created ExportCustomJobInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $startDay, string $endDay, string $friendlyName, array $options = []): ExportCustomJobInstance { $options = new Values($options); $data = Values::of([ 'StartDay' => $startDay, 'EndDay' => $endDay, 'FriendlyName' => $friendlyName, 'WebhookUrl' => $options['webhookUrl'], 'WebhookMethod' => $options['webhookMethod'], 'Email' => $options['email'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ExportCustomJobInstance($this->version, $payload, $this->solution['resourceType']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Bulkexports.V1.ExportCustomJobList]'; } }src/Twilio/Rest/Bulkexports/V1/Export/DayPage.php000064400000002237150515725670015654 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return DayInstance \Twilio\Rest\Bulkexports\V1\Export\DayInstance */ public function buildInstance(array $payload): DayInstance { return new DayInstance($this->version, $payload, $this->solution['resourceType']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Bulkexports.V1.DayPage]'; } }src/Twilio/Rest/Bulkexports/V1/Export/DayInstance.php000064400000006501150515725670016542 0ustar00properties = [ 'redirectTo' => Values::array_get($payload, 'redirect_to'), 'day' => Values::array_get($payload, 'day'), 'size' => Values::array_get($payload, 'size'), 'createDate' => Values::array_get($payload, 'create_date'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'resourceType' => Values::array_get($payload, 'resource_type'), ]; $this->solution = ['resourceType' => $resourceType, 'day' => $day ?: $this->properties['day'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return DayContext Context for this DayInstance */ protected function proxy(): DayContext { if (!$this->context) { $this->context = new DayContext( $this->version, $this->solution['resourceType'], $this->solution['day'] ); } return $this->context; } /** * Fetch the DayInstance * * @return DayInstance Fetched DayInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): DayInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Bulkexports.V1.DayInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Bulkexports/V1/Export/JobList.php000064400000002023150515725670015701 0ustar00solution = []; } /** * Constructs a JobContext * * @param string $jobSid The unique string that that we created to identify the * Bulk Export job */ public function getContext(string $jobSid): JobContext { return new JobContext($this->version, $jobSid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Bulkexports.V1.JobList]'; } }src/Twilio/Rest/Bulkexports/V1/Export/ExportCustomJobOptions.php000064400000010057150515725670021024 0ustar00options['webhookUrl'] = $webhookUrl; $this->options['webhookMethod'] = $webhookMethod; $this->options['email'] = $email; } /** * The optional webhook url called on completion of the job. If this is supplied, `WebhookMethod` must also be supplied. If you set neither webhook nor email, you will have to check your job's status manually. * * @param string $webhookUrl The optional webhook url called on completion of * the job. If this is supplied, `WebhookMethod` must * also be supplied. * @return $this Fluent Builder */ public function setWebhookUrl(string $webhookUrl): self { $this->options['webhookUrl'] = $webhookUrl; return $this; } /** * This is the method used to call the webhook on completion of the job. If this is supplied, `WebhookUrl` must also be supplied. * * @param string $webhookMethod This is the method used to call the webhook on * completion of the job. If this is supplied, * `WebhookUrl` must also be supplied. * @return $this Fluent Builder */ public function setWebhookMethod(string $webhookMethod): self { $this->options['webhookMethod'] = $webhookMethod; return $this; } /** * The optional email to send the completion notification to. You can set both webhook, and email, or one or the other. If you set neither, the job will run but you will have to query to determine your job's status. * * @param string $email The optional email to send the completion notification * to * @return $this Fluent Builder */ public function setEmail(string $email): self { $this->options['email'] = $email; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Bulkexports.V1.CreateExportCustomJobOptions ' . $options . ']'; } }src/Twilio/Rest/Bulkexports/V1/Export/JobInstance.php000064400000007777150515725670016557 0ustar00properties = [ 'resourceType' => Values::array_get($payload, 'resource_type'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'details' => Values::array_get($payload, 'details'), 'startDay' => Values::array_get($payload, 'start_day'), 'endDay' => Values::array_get($payload, 'end_day'), 'jobSid' => Values::array_get($payload, 'job_sid'), 'webhookUrl' => Values::array_get($payload, 'webhook_url'), 'webhookMethod' => Values::array_get($payload, 'webhook_method'), 'email' => Values::array_get($payload, 'email'), 'url' => Values::array_get($payload, 'url'), 'jobQueuePosition' => Values::array_get($payload, 'job_queue_position'), 'estimatedCompletionTime' => Values::array_get($payload, 'estimated_completion_time'), ]; $this->solution = ['jobSid' => $jobSid ?: $this->properties['jobSid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return JobContext Context for this JobInstance */ protected function proxy(): JobContext { if (!$this->context) { $this->context = new JobContext($this->version, $this->solution['jobSid']); } return $this->context; } /** * Fetch the JobInstance * * @return JobInstance Fetched JobInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): JobInstance { return $this->proxy()->fetch(); } /** * Delete the JobInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Bulkexports.V1.JobInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Bulkexports/V1/Export/ExportCustomJobPage.php000064400000002347150515725670020250 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ExportCustomJobInstance \Twilio\Rest\Bulkexports\V1\Export\ExportCustomJobInstance */ public function buildInstance(array $payload): ExportCustomJobInstance { return new ExportCustomJobInstance($this->version, $payload, $this->solution['resourceType']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Bulkexports.V1.ExportCustomJobPage]'; } }src/Twilio/Rest/Bulkexports/V1/ExportInstance.php000064400000006517150515725670016034 0ustar00properties = [ 'resourceType' => Values::array_get($payload, 'resource_type'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['resourceType' => $resourceType ?: $this->properties['resourceType'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return ExportContext Context for this ExportInstance */ protected function proxy(): ExportContext { if (!$this->context) { $this->context = new ExportContext($this->version, $this->solution['resourceType']); } return $this->context; } /** * Fetch the ExportInstance * * @return ExportInstance Fetched ExportInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ExportInstance { return $this->proxy()->fetch(); } /** * Access the days */ protected function getDays(): DayList { return $this->proxy()->days; } /** * Access the exportCustomJobs */ protected function getExportCustomJobs(): ExportCustomJobList { return $this->proxy()->exportCustomJobs; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Bulkexports.V1.ExportInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Bulkexports/V1/ExportConfigurationInstance.php000064400000007266150515725670020566 0ustar00properties = [ 'enabled' => Values::array_get($payload, 'enabled'), 'webhookUrl' => Values::array_get($payload, 'webhook_url'), 'webhookMethod' => Values::array_get($payload, 'webhook_method'), 'resourceType' => Values::array_get($payload, 'resource_type'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['resourceType' => $resourceType ?: $this->properties['resourceType'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return ExportConfigurationContext Context for this * ExportConfigurationInstance */ protected function proxy(): ExportConfigurationContext { if (!$this->context) { $this->context = new ExportConfigurationContext($this->version, $this->solution['resourceType']); } return $this->context; } /** * Fetch the ExportConfigurationInstance * * @return ExportConfigurationInstance Fetched ExportConfigurationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ExportConfigurationInstance { return $this->proxy()->fetch(); } /** * Update the ExportConfigurationInstance * * @param array|Options $options Optional Arguments * @return ExportConfigurationInstance Updated ExportConfigurationInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ExportConfigurationInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Bulkexports.V1.ExportConfigurationInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Bulkexports/V1.php000064400000005273150515725670013064 0ustar00version = 'v1'; } protected function getExports(): ExportList { if (!$this->_exports) { $this->_exports = new ExportList($this); } return $this->_exports; } protected function getExportConfiguration(): ExportConfigurationList { if (!$this->_exportConfiguration) { $this->_exportConfiguration = new ExportConfigurationList($this); } return $this->_exportConfiguration; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Bulkexports.V1]'; } }src/Twilio/Rest/Messaging.php000064400000007630150515725670012170 0ustar00baseUrl = 'https://messaging.twilio.com'; } /** * @return V1 Version v1 of messaging */ protected function getV1(): V1 { 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 TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } protected function getBrandRegistrations(): \Twilio\Rest\Messaging\V1\BrandRegistrationList { return $this->v1->brandRegistrations; } /** * @param string $sid The SID that identifies the resource to fetch */ protected function contextBrandRegistrations(string $sid): \Twilio\Rest\Messaging\V1\BrandRegistrationContext { return $this->v1->brandRegistrations($sid); } protected function getDeactivations(): \Twilio\Rest\Messaging\V1\DeactivationsList { return $this->v1->deactivations; } protected function contextDeactivations(): \Twilio\Rest\Messaging\V1\DeactivationsContext { return $this->v1->deactivations(); } protected function getExternalCampaign(): \Twilio\Rest\Messaging\V1\ExternalCampaignList { return $this->v1->externalCampaign; } protected function getServices(): \Twilio\Rest\Messaging\V1\ServiceList { return $this->v1->services; } /** * @param string $sid The SID that identifies the resource to fetch */ protected function contextServices(string $sid): \Twilio\Rest\Messaging\V1\ServiceContext { return $this->v1->services($sid); } protected function getUsecases(): \Twilio\Rest\Messaging\V1\UsecaseList { return $this->v1->usecases; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Messaging]'; } }src/Twilio/Rest/Trusthub.php000064400000013600150515725670012065 0ustar00baseUrl = 'https://trusthub.twilio.com'; } /** * @return V1 Version v1 of trusthub */ protected function getV1(): V1 { 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 TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } protected function getCustomerProfiles(): \Twilio\Rest\Trusthub\V1\CustomerProfilesList { return $this->v1->customerProfiles; } /** * @param string $sid The unique string that identifies the resource. */ protected function contextCustomerProfiles(string $sid): \Twilio\Rest\Trusthub\V1\CustomerProfilesContext { return $this->v1->customerProfiles($sid); } protected function getEndUsers(): \Twilio\Rest\Trusthub\V1\EndUserList { return $this->v1->endUsers; } /** * @param string $sid The unique string that identifies the resource */ protected function contextEndUsers(string $sid): \Twilio\Rest\Trusthub\V1\EndUserContext { return $this->v1->endUsers($sid); } protected function getEndUserTypes(): \Twilio\Rest\Trusthub\V1\EndUserTypeList { return $this->v1->endUserTypes; } /** * @param string $sid The unique string that identifies the End-User Type * resource */ protected function contextEndUserTypes(string $sid): \Twilio\Rest\Trusthub\V1\EndUserTypeContext { return $this->v1->endUserTypes($sid); } protected function getPolicies(): \Twilio\Rest\Trusthub\V1\PoliciesList { return $this->v1->policies; } /** * @param string $sid The unique string that identifies the Policy resource */ protected function contextPolicies(string $sid): \Twilio\Rest\Trusthub\V1\PoliciesContext { return $this->v1->policies($sid); } protected function getSupportingDocuments(): \Twilio\Rest\Trusthub\V1\SupportingDocumentList { return $this->v1->supportingDocuments; } /** * @param string $sid The unique string that identifies the resource */ protected function contextSupportingDocuments(string $sid): \Twilio\Rest\Trusthub\V1\SupportingDocumentContext { return $this->v1->supportingDocuments($sid); } protected function getSupportingDocumentTypes(): \Twilio\Rest\Trusthub\V1\SupportingDocumentTypeList { return $this->v1->supportingDocumentTypes; } /** * @param string $sid The unique string that identifies the Supporting Document * Type resource */ protected function contextSupportingDocumentTypes(string $sid): \Twilio\Rest\Trusthub\V1\SupportingDocumentTypeContext { return $this->v1->supportingDocumentTypes($sid); } protected function getTrustProducts(): \Twilio\Rest\Trusthub\V1\TrustProductsList { return $this->v1->trustProducts; } /** * @param string $sid The unique string that identifies the resource. */ protected function contextTrustProducts(string $sid): \Twilio\Rest\Trusthub\V1\TrustProductsContext { return $this->v1->trustProducts($sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trusthub]'; } }src/Twilio/Rest/Autopilot.php000064400000005375150515725670012237 0ustar00baseUrl = 'https://autopilot.twilio.com'; } /** * @return V1 Version v1 of autopilot */ protected function getV1(): V1 { 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 TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } protected function getAssistants(): \Twilio\Rest\Autopilot\V1\AssistantList { return $this->v1->assistants; } /** * @param string $sid The unique string that identifies the resource */ protected function contextAssistants(string $sid): \Twilio\Rest\Autopilot\V1\AssistantContext { return $this->v1->assistants($sid); } protected function getRestoreAssistant(): \Twilio\Rest\Autopilot\V1\RestoreAssistantList { return $this->v1->restoreAssistant; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Autopilot]'; } }src/Twilio/Rest/FrontlineApi/V1/UserPage.php000064400000002352150515725670014642 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return UserInstance \Twilio\Rest\FrontlineApi\V1\UserInstance */ public function buildInstance(array $payload): UserInstance { return new UserInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.FrontlineApi.V1.UserPage]'; } }src/Twilio/Rest/FrontlineApi/V1/UserContext.php000064400000004511150515725670015411 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Users/' . \rawurlencode($sid) . ''; } /** * Fetch the UserInstance * * @return UserInstance Fetched UserInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): UserInstance { $payload = $this->version->fetch('GET', $this->uri); return new UserInstance($this->version, $payload, $this->solution['sid']); } /** * Update the UserInstance * * @param array|Options $options Optional Arguments * @return UserInstance Updated UserInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): UserInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'Avatar' => $options['avatar'], 'State' => $options['state'], 'IsAvailable' => Serialize::booleanToString($options['isAvailable']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new UserInstance($this->version, $payload, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.FrontlineApi.V1.UserContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/FrontlineApi/V1/UserOptions.php000064400000007153150515725670015425 0ustar00options['friendlyName'] = $friendlyName; $this->options['avatar'] = $avatar; $this->options['state'] = $state; $this->options['isAvailable'] = $isAvailable; } /** * The string that you assigned to describe the User. * * @param string $friendlyName The string that you assigned to describe the User * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The avatar URL which will be shown in Frontline application. * * @param string $avatar The avatar URL which will be shown in Frontline * application * @return $this Fluent Builder */ public function setAvatar(string $avatar): self { $this->options['avatar'] = $avatar; return $this; } /** * Current state of this user. Can be either `active` or `deactivated`. * * @param string $state Current state of this user * @return $this Fluent Builder */ public function setState(string $state): self { $this->options['state'] = $state; return $this; } /** * Whether the User is available for new conversations. Set to `false` to prevent User from receiving new inbound conversations if you are using [Pool Routing](https://www.twilio.com/docs/frontline/handle-incoming-conversations#3-pool-routing). * * @param bool $isAvailable Whether the User is available for new conversations * @return $this Fluent Builder */ public function setIsAvailable(bool $isAvailable): self { $this->options['isAvailable'] = $isAvailable; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.FrontlineApi.V1.UpdateUserOptions ' . $options . ']'; } }src/Twilio/Rest/FrontlineApi/V1/UserList.php000064400000002076150515725670014704 0ustar00solution = []; } /** * Constructs a UserContext * * @param string $sid The SID of the User resource to fetch */ public function getContext(string $sid): UserContext { return new UserContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.FrontlineApi.V1.UserList]'; } }src/Twilio/Rest/FrontlineApi/V1/UserInstance.php000064400000007063150515725670015536 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'identity' => Values::array_get($payload, 'identity'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'avatar' => Values::array_get($payload, 'avatar'), 'state' => Values::array_get($payload, 'state'), 'isAvailable' => Values::array_get($payload, 'is_available'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['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 UserContext Context for this UserInstance */ protected function proxy(): UserContext { if (!$this->context) { $this->context = new UserContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the UserInstance * * @return UserInstance Fetched UserInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): UserInstance { return $this->proxy()->fetch(); } /** * Update the UserInstance * * @param array|Options $options Optional Arguments * @return UserInstance Updated UserInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): UserInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.FrontlineApi.V1.UserInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/FrontlineApi/V1.php000064400000004232150515725670013126 0ustar00version = 'v1'; } protected function getUsers(): UserList { if (!$this->_users) { $this->_users = new UserList($this); } return $this->_users; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.FrontlineApi.V1]'; } }src/Twilio/Rest/Fax/V1/FaxList.php000064400000014443150515725670012631 0ustar00solution = []; $this->uri = '/Faxes'; } /** * Streams FaxInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads FaxInstance 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 FaxInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of FaxInstance 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 FaxPage Page of FaxInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): FaxPage { $options = new Values($options); $params = Values::of([ 'From' => $options['from'], 'To' => $options['to'], 'DateCreatedOnOrBefore' => Serialize::iso8601DateTime($options['dateCreatedOnOrBefore']), 'DateCreatedAfter' => Serialize::iso8601DateTime($options['dateCreatedAfter']), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new FaxPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of FaxInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return FaxPage Page of FaxInstance */ public function getPage(string $targetUrl): FaxPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new FaxPage($this->version, $response, $this->solution); } /** * Create the FaxInstance * * @param string $to The phone number to receive the fax * @param string $mediaUrl The URL of the PDF that contains the fax * @param array|Options $options Optional Arguments * @return FaxInstance Created FaxInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $to, string $mediaUrl, array $options = []): FaxInstance { $options = new Values($options); $data = Values::of([ 'To' => $to, 'MediaUrl' => $mediaUrl, 'Quality' => $options['quality'], 'StatusCallback' => $options['statusCallback'], 'From' => $options['from'], 'SipAuthUsername' => $options['sipAuthUsername'], 'SipAuthPassword' => $options['sipAuthPassword'], 'StoreMedia' => Serialize::booleanToString($options['storeMedia']), 'Ttl' => $options['ttl'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new FaxInstance($this->version, $payload); } /** * Constructs a FaxContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): FaxContext { return new FaxContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Fax.V1.FaxList]'; } }src/Twilio/Rest/Fax/V1/FaxContext.php000064400000007620150515725670013341 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Faxes/' . \rawurlencode($sid) . ''; } /** * Fetch the FaxInstance * * @return FaxInstance Fetched FaxInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FaxInstance { $payload = $this->version->fetch('GET', $this->uri); return new FaxInstance($this->version, $payload, $this->solution['sid']); } /** * Update the FaxInstance * * @param array|Options $options Optional Arguments * @return FaxInstance Updated FaxInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): FaxInstance { $options = new Values($options); $data = Values::of(['Status' => $options['status'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new FaxInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the FaxInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the media */ protected function getMedia(): FaxMediaList { if (!$this->_media) { $this->_media = new FaxMediaList($this->version, $this->solution['sid']); } return $this->_media; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Fax.V1.FaxContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Fax/V1/Fax/FaxMediaPage.php000064400000002412150515725670014241 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return FaxMediaInstance \Twilio\Rest\Fax\V1\Fax\FaxMediaInstance */ public function buildInstance(array $payload): FaxMediaInstance { return new FaxMediaInstance($this->version, $payload, $this->solution['faxSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Fax.V1.FaxMediaPage]'; } }src/Twilio/Rest/Fax/V1/Fax/FaxMediaList.php000064400000011537150515725670014310 0ustar00solution = ['faxSid' => $faxSid, ]; $this->uri = '/Faxes/' . \rawurlencode($faxSid) . '/Media'; } /** * Streams FaxMediaInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads FaxMediaInstance 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 FaxMediaInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of FaxMediaInstance 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 FaxMediaPage Page of FaxMediaInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): FaxMediaPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new FaxMediaPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of FaxMediaInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return FaxMediaPage Page of FaxMediaInstance */ public function getPage(string $targetUrl): FaxMediaPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new FaxMediaPage($this->version, $response, $this->solution); } /** * Constructs a FaxMediaContext * * @param string $sid The unique string that identifies the resource to fetch */ public function getContext(string $sid): FaxMediaContext { return new FaxMediaContext($this->version, $this->solution['faxSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Fax.V1.FaxMediaList]'; } }src/Twilio/Rest/Fax/V1/Fax/FaxMediaContext.php000064400000004127150515725670015016 0ustar00solution = ['faxSid' => $faxSid, 'sid' => $sid, ]; $this->uri = '/Faxes/' . \rawurlencode($faxSid) . '/Media/' . \rawurlencode($sid) . ''; } /** * Fetch the FaxMediaInstance * * @return FaxMediaInstance Fetched FaxMediaInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FaxMediaInstance { $payload = $this->version->fetch('GET', $this->uri); return new FaxMediaInstance( $this->version, $payload, $this->solution['faxSid'], $this->solution['sid'] ); } /** * Delete the FaxMediaInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Fax.V1.FaxMediaContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Fax/V1/Fax/FaxMediaInstance.php000064400000007536150515725670015145 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'faxSid' => Values::array_get($payload, 'fax_sid'), 'contentType' => Values::array_get($payload, 'content_type'), '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 = ['faxSid' => $faxSid, '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 FaxMediaContext Context for this FaxMediaInstance */ protected function proxy(): FaxMediaContext { if (!$this->context) { $this->context = new FaxMediaContext( $this->version, $this->solution['faxSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the FaxMediaInstance * * @return FaxMediaInstance Fetched FaxMediaInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FaxMediaInstance { return $this->proxy()->fetch(); } /** * Delete the FaxMediaInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Fax.V1.FaxMediaInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Fax/V1/FaxPage.php000064400000002311150515725670012561 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return FaxInstance \Twilio\Rest\Fax\V1\FaxInstance */ public function buildInstance(array $payload): FaxInstance { return new FaxInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Fax.V1.FaxPage]'; } }src/Twilio/Rest/Fax/V1/FaxOptions.php000064400000026016150515725670013350 0ustar00options['from'] = $from; $this->options['to'] = $to; $this->options['dateCreatedOnOrBefore'] = $dateCreatedOnOrBefore; $this->options['dateCreatedAfter'] = $dateCreatedAfter; } /** * Retrieve only those faxes sent from this phone number, specified in [E.164](https://www.twilio.com/docs/glossary/what-e164) format. * * @param string $from Retrieve only those faxes sent from this phone number * @return $this Fluent Builder */ public function setFrom(string $from): self { $this->options['from'] = $from; return $this; } /** * Retrieve only those faxes sent to this phone number, specified in [E.164](https://www.twilio.com/docs/glossary/what-e164) format. * * @param string $to Retrieve only those faxes sent to this phone number * @return $this Fluent Builder */ public function setTo(string $to): self { $this->options['to'] = $to; return $this; } /** * Retrieve only those faxes with a `date_created` that is before or equal to this value, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. * * @param \DateTime $dateCreatedOnOrBefore Retrieve only faxes created on or * before this date * @return $this Fluent Builder */ public function setDateCreatedOnOrBefore(\DateTime $dateCreatedOnOrBefore): self { $this->options['dateCreatedOnOrBefore'] = $dateCreatedOnOrBefore; return $this; } /** * Retrieve only those faxes with a `date_created` that is later than this value, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. * * @param \DateTime $dateCreatedAfter Retrieve only faxes created after this * date * @return $this Fluent Builder */ public function setDateCreatedAfter(\DateTime $dateCreatedAfter): self { $this->options['dateCreatedAfter'] = $dateCreatedAfter; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Fax.V1.ReadFaxOptions ' . $options . ']'; } } class CreateFaxOptions extends Options { /** * @param string $quality The quality of this fax * @param string $statusCallback The URL we should call to send status * information to your application * @param string $from The number the fax was sent from * @param string $sipAuthUsername The username for SIP authentication * @param string $sipAuthPassword The password for SIP authentication * @param bool $storeMedia Whether to store a copy of the sent media * @param int $ttl How long in minutes to try to send the fax */ public function __construct(string $quality = Values::NONE, string $statusCallback = Values::NONE, string $from = Values::NONE, string $sipAuthUsername = Values::NONE, string $sipAuthPassword = Values::NONE, bool $storeMedia = Values::NONE, int $ttl = Values::NONE) { $this->options['quality'] = $quality; $this->options['statusCallback'] = $statusCallback; $this->options['from'] = $from; $this->options['sipAuthUsername'] = $sipAuthUsername; $this->options['sipAuthPassword'] = $sipAuthPassword; $this->options['storeMedia'] = $storeMedia; $this->options['ttl'] = $ttl; } /** * The [Fax Quality value](https://www.twilio.com/docs/fax/api/fax-resource#fax-quality-values) that describes the fax quality. Can be: `standard`, `fine`, or `superfine` and defaults to `fine`. * * @param string $quality The quality of this fax * @return $this Fluent Builder */ public function setQuality(string $quality): self { $this->options['quality'] = $quality; return $this; } /** * The URL we should call using the `POST` method to send [status information](https://www.twilio.com/docs/fax/api/fax-resource#fax-status-callback) to your application when the status of the fax changes. * * @param string $statusCallback The URL we should call to send status * information to your application * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * The number the fax was sent from. Can be the phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format or the SIP `from` value. The caller ID displayed to the recipient uses this value. If this is a phone number, it must be a Twilio number or a verified outgoing caller id from your account. If `to` is a SIP address, this can be any alphanumeric string (and also the characters `+`, `_`, `.`, and `-`), which will be used in the `from` header of the SIP request. * * @param string $from The number the fax was sent from * @return $this Fluent Builder */ public function setFrom(string $from): self { $this->options['from'] = $from; return $this; } /** * The username to use with the `sip_auth_password` to authenticate faxes sent to a SIP address. * * @param string $sipAuthUsername The username for SIP authentication * @return $this Fluent Builder */ public function setSipAuthUsername(string $sipAuthUsername): self { $this->options['sipAuthUsername'] = $sipAuthUsername; return $this; } /** * The password to use with `sip_auth_username` to authenticate faxes sent to a SIP address. * * @param string $sipAuthPassword The password for SIP authentication * @return $this Fluent Builder */ public function setSipAuthPassword(string $sipAuthPassword): self { $this->options['sipAuthPassword'] = $sipAuthPassword; return $this; } /** * Whether to store a copy of the sent media on our servers for later retrieval. Can be: `true` or `false` and the default is `true`. * * @param bool $storeMedia Whether to store a copy of the sent media * @return $this Fluent Builder */ public function setStoreMedia(bool $storeMedia): self { $this->options['storeMedia'] = $storeMedia; return $this; } /** * How long in minutes from when the fax is initiated that we should try to send the fax. * * @param int $ttl How long in minutes to try to send the fax * @return $this Fluent Builder */ public function setTtl(int $ttl): self { $this->options['ttl'] = $ttl; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Fax.V1.CreateFaxOptions ' . $options . ']'; } } class UpdateFaxOptions extends Options { /** * @param string $status The new status of the resource */ public function __construct(string $status = Values::NONE) { $this->options['status'] = $status; } /** * The new [status](https://www.twilio.com/docs/fax/api/fax-resource#fax-status-values) of the resource. Can be only `canceled`. This may fail if transmission has already started. * * @param string $status The new status of the resource * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Fax.V1.UpdateFaxOptions ' . $options . ']'; } }src/Twilio/Rest/Fax/V1/FaxInstance.php000064400000012101150515725670013447 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'from' => Values::array_get($payload, 'from'), 'to' => Values::array_get($payload, 'to'), 'quality' => Values::array_get($payload, 'quality'), 'mediaSid' => Values::array_get($payload, 'media_sid'), 'mediaUrl' => Values::array_get($payload, 'media_url'), 'numPages' => Values::array_get($payload, 'num_pages'), 'duration' => Values::array_get($payload, 'duration'), 'status' => Values::array_get($payload, 'status'), 'direction' => Values::array_get($payload, 'direction'), 'apiVersion' => Values::array_get($payload, 'api_version'), 'price' => Values::array_get($payload, 'price'), 'priceUnit' => Values::array_get($payload, 'price_unit'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'links' => Values::array_get($payload, 'links'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['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 FaxContext Context for this FaxInstance */ protected function proxy(): FaxContext { if (!$this->context) { $this->context = new FaxContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the FaxInstance * * @return FaxInstance Fetched FaxInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FaxInstance { return $this->proxy()->fetch(); } /** * Update the FaxInstance * * @param array|Options $options Optional Arguments * @return FaxInstance Updated FaxInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): FaxInstance { return $this->proxy()->update($options); } /** * Delete the FaxInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the media */ protected function getMedia(): FaxMediaList { return $this->proxy()->media; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Fax.V1.FaxInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Fax/V1.php000064400000004150150515725670011251 0ustar00version = 'v1'; } protected function getFaxes(): FaxList { if (!$this->_faxes) { $this->_faxes = new FaxList($this); } return $this->_faxes; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Fax.V1]'; } }src/Twilio/Rest/Bulkexports.php000064400000006503150515725670012573 0ustar00baseUrl = 'https://bulkexports.twilio.com'; } /** * @return V1 Version v1 of bulkexports */ protected function getV1(): V1 { 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 TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } protected function getExports(): \Twilio\Rest\Bulkexports\V1\ExportList { return $this->v1->exports; } /** * @param string $resourceType The type of communication – Messages, Calls, * Conferences, and Participants */ protected function contextExports(string $resourceType): \Twilio\Rest\Bulkexports\V1\ExportContext { return $this->v1->exports($resourceType); } protected function getExportConfiguration(): \Twilio\Rest\Bulkexports\V1\ExportConfigurationList { return $this->v1->exportConfiguration; } /** * @param string $resourceType The type of communication – Messages, Calls, * Conferences, and Participants */ protected function contextExportConfiguration(string $resourceType): \Twilio\Rest\Bulkexports\V1\ExportConfigurationContext { return $this->v1->exportConfiguration($resourceType); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Bulkexports]'; } }src/Twilio/Rest/Serverless.php000064400000005016150515725670012404 0ustar00baseUrl = 'https://serverless.twilio.com'; } /** * @return V1 Version v1 of serverless */ protected function getV1(): V1 { 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 TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } protected function getServices(): \Twilio\Rest\Serverless\V1\ServiceList { return $this->v1->services; } /** * @param string $sid The SID of the Service resource to fetch */ protected function contextServices(string $sid): \Twilio\Rest\Serverless\V1\ServiceContext { return $this->v1->services($sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Serverless]'; } }src/Twilio/Rest/FlexApi/V1/ChannelContext.php000064400000003432150515725670015002 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Channels/' . \rawurlencode($sid) . ''; } /** * Fetch the ChannelInstance * * @return ChannelInstance Fetched ChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ChannelInstance { $payload = $this->version->fetch('GET', $this->uri); return new ChannelInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the ChannelInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.FlexApi.V1.ChannelContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/FlexApi/V1/WebChannelInstance.php000064400000007460150515725670015565 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'flexFlowSid' => Values::array_get($payload, 'flex_flow_sid'), 'sid' => Values::array_get($payload, 'sid'), 'url' => Values::array_get($payload, 'url'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), ]; $this->solution = ['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 WebChannelContext Context for this WebChannelInstance */ protected function proxy(): WebChannelContext { if (!$this->context) { $this->context = new WebChannelContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the WebChannelInstance * * @return WebChannelInstance Fetched WebChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): WebChannelInstance { return $this->proxy()->fetch(); } /** * Update the WebChannelInstance * * @param array|Options $options Optional Arguments * @return WebChannelInstance Updated WebChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): WebChannelInstance { return $this->proxy()->update($options); } /** * Delete the WebChannelInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.FlexApi.V1.WebChannelInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/FlexApi/V1/FlexFlowInstance.php000064400000011174150515725670015302 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'sid' => Values::array_get($payload, 'sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'chatServiceSid' => Values::array_get($payload, 'chat_service_sid'), 'channelType' => Values::array_get($payload, 'channel_type'), 'contactIdentity' => Values::array_get($payload, 'contact_identity'), 'enabled' => Values::array_get($payload, 'enabled'), 'integrationType' => Values::array_get($payload, 'integration_type'), 'integration' => Values::array_get($payload, 'integration'), 'longLived' => Values::array_get($payload, 'long_lived'), 'janitorEnabled' => Values::array_get($payload, 'janitor_enabled'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['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 FlexFlowContext Context for this FlexFlowInstance */ protected function proxy(): FlexFlowContext { if (!$this->context) { $this->context = new FlexFlowContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the FlexFlowInstance * * @return FlexFlowInstance Fetched FlexFlowInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FlexFlowInstance { return $this->proxy()->fetch(); } /** * Update the FlexFlowInstance * * @param array|Options $options Optional Arguments * @return FlexFlowInstance Updated FlexFlowInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): FlexFlowInstance { return $this->proxy()->update($options); } /** * Delete the FlexFlowInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.FlexApi.V1.FlexFlowInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/FlexApi/V1/WebChannelList.php000064400000013455150515725670014735 0ustar00solution = []; $this->uri = '/WebChannels'; } /** * Streams WebChannelInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads WebChannelInstance 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 WebChannelInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of WebChannelInstance 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 WebChannelPage Page of WebChannelInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): WebChannelPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new WebChannelPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of WebChannelInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return WebChannelPage Page of WebChannelInstance */ public function getPage(string $targetUrl): WebChannelPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new WebChannelPage($this->version, $response, $this->solution); } /** * Create the WebChannelInstance * * @param string $flexFlowSid The SID of the Flex Flow * @param string $identity The chat identity * @param string $customerFriendlyName The chat participant's friendly name * @param string $chatFriendlyName The chat channel's friendly name * @param array|Options $options Optional Arguments * @return WebChannelInstance Created WebChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $flexFlowSid, string $identity, string $customerFriendlyName, string $chatFriendlyName, array $options = []): WebChannelInstance { $options = new Values($options); $data = Values::of([ 'FlexFlowSid' => $flexFlowSid, 'Identity' => $identity, 'CustomerFriendlyName' => $customerFriendlyName, 'ChatFriendlyName' => $chatFriendlyName, 'ChatUniqueName' => $options['chatUniqueName'], 'PreEngagementData' => $options['preEngagementData'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new WebChannelInstance($this->version, $payload); } /** * Constructs a WebChannelContext * * @param string $sid The SID of the WebChannel resource to fetch */ public function getContext(string $sid): WebChannelContext { return new WebChannelContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.FlexApi.V1.WebChannelList]'; } }src/Twilio/Rest/FlexApi/V1/WebChannelPage.php000064400000002216150515725670014667 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return WebChannelInstance \Twilio\Rest\FlexApi\V1\WebChannelInstance */ public function buildInstance(array $payload): WebChannelInstance { return new WebChannelInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.FlexApi.V1.WebChannelPage]'; } }src/Twilio/Rest/FlexApi/V1/ChannelOptions.php000064400000011063150515725670015010 0ustar00options['target'] = $target; $this->options['chatUniqueName'] = $chatUniqueName; $this->options['preEngagementData'] = $preEngagementData; $this->options['taskSid'] = $taskSid; $this->options['taskAttributes'] = $taskAttributes; $this->options['longLived'] = $longLived; } /** * The Target Contact Identity, for example the phone number of an SMS. * * @param string $target The Target Contact Identity * @return $this Fluent Builder */ public function setTarget(string $target): self { $this->options['target'] = $target; return $this; } /** * The chat channel's unique name. * * @param string $chatUniqueName The chat channel's unique name * @return $this Fluent Builder */ public function setChatUniqueName(string $chatUniqueName): self { $this->options['chatUniqueName'] = $chatUniqueName; return $this; } /** * The pre-engagement data. * * @param string $preEngagementData The pre-engagement data * @return $this Fluent Builder */ public function setPreEngagementData(string $preEngagementData): self { $this->options['preEngagementData'] = $preEngagementData; return $this; } /** * The SID of the TaskRouter Task. Only valid when integration type is `task`. `null` for integration types `studio` & `external` * * @param string $taskSid The SID of the TaskRouter Task * @return $this Fluent Builder */ public function setTaskSid(string $taskSid): self { $this->options['taskSid'] = $taskSid; return $this; } /** * The Task attributes to be added for the TaskRouter Task. * * @param string $taskAttributes The Task attributes to be added for the * TaskRouter Task * @return $this Fluent Builder */ public function setTaskAttributes(string $taskAttributes): self { $this->options['taskAttributes'] = $taskAttributes; return $this; } /** * Whether to create the channel as long-lived. * * @param bool $longLived Whether to create the channel as long-lived * @return $this Fluent Builder */ public function setLongLived(bool $longLived): self { $this->options['longLived'] = $longLived; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.FlexApi.V1.CreateChannelOptions ' . $options . ']'; } }src/Twilio/Rest/FlexApi/V1/FlexFlowPage.php000064400000002202150515725670014402 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return FlexFlowInstance \Twilio\Rest\FlexApi\V1\FlexFlowInstance */ public function buildInstance(array $payload): FlexFlowInstance { return new FlexFlowInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.FlexApi.V1.FlexFlowPage]'; } }src/Twilio/Rest/FlexApi/V1/WebChannelOptions.php000064400000007427150515725670015457 0ustar00options['chatUniqueName'] = $chatUniqueName; $this->options['preEngagementData'] = $preEngagementData; } /** * The chat channel's unique name. * * @param string $chatUniqueName The chat channel's unique name * @return $this Fluent Builder */ public function setChatUniqueName(string $chatUniqueName): self { $this->options['chatUniqueName'] = $chatUniqueName; return $this; } /** * The pre-engagement data. * * @param string $preEngagementData The pre-engagement data * @return $this Fluent Builder */ public function setPreEngagementData(string $preEngagementData): self { $this->options['preEngagementData'] = $preEngagementData; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.FlexApi.V1.CreateWebChannelOptions ' . $options . ']'; } } class UpdateWebChannelOptions extends Options { /** * @param string $chatStatus The chat status * @param string $postEngagementData The post-engagement data */ public function __construct(string $chatStatus = Values::NONE, string $postEngagementData = Values::NONE) { $this->options['chatStatus'] = $chatStatus; $this->options['postEngagementData'] = $postEngagementData; } /** * The chat status. Can only be `inactive`. * * @param string $chatStatus The chat status * @return $this Fluent Builder */ public function setChatStatus(string $chatStatus): self { $this->options['chatStatus'] = $chatStatus; return $this; } /** * The post-engagement data. * * @param string $postEngagementData The post-engagement data * @return $this Fluent Builder */ public function setPostEngagementData(string $postEngagementData): self { $this->options['postEngagementData'] = $postEngagementData; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.FlexApi.V1.UpdateWebChannelOptions ' . $options . ']'; } }src/Twilio/Rest/FlexApi/V1/FlexFlowContext.php000064400000007015150515725670015161 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/FlexFlows/' . \rawurlencode($sid) . ''; } /** * Fetch the FlexFlowInstance * * @return FlexFlowInstance Fetched FlexFlowInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FlexFlowInstance { $payload = $this->version->fetch('GET', $this->uri); return new FlexFlowInstance($this->version, $payload, $this->solution['sid']); } /** * Update the FlexFlowInstance * * @param array|Options $options Optional Arguments * @return FlexFlowInstance Updated FlexFlowInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): FlexFlowInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'ChatServiceSid' => $options['chatServiceSid'], 'ChannelType' => $options['channelType'], 'ContactIdentity' => $options['contactIdentity'], 'Enabled' => Serialize::booleanToString($options['enabled']), 'IntegrationType' => $options['integrationType'], 'Integration.FlowSid' => $options['integrationFlowSid'], 'Integration.Url' => $options['integrationUrl'], 'Integration.WorkspaceSid' => $options['integrationWorkspaceSid'], 'Integration.WorkflowSid' => $options['integrationWorkflowSid'], 'Integration.Channel' => $options['integrationChannel'], 'Integration.Timeout' => $options['integrationTimeout'], 'Integration.Priority' => $options['integrationPriority'], 'Integration.CreationOnMessage' => Serialize::booleanToString($options['integrationCreationOnMessage']), 'LongLived' => Serialize::booleanToString($options['longLived']), 'JanitorEnabled' => Serialize::booleanToString($options['janitorEnabled']), 'Integration.RetryCount' => $options['integrationRetryCount'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new FlexFlowInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the FlexFlowInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.FlexApi.V1.FlexFlowContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/FlexApi/V1/FlexFlowList.php000064400000015632150515725670014454 0ustar00solution = []; $this->uri = '/FlexFlows'; } /** * Streams FlexFlowInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads FlexFlowInstance 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 FlexFlowInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of FlexFlowInstance 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 FlexFlowPage Page of FlexFlowInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): FlexFlowPage { $options = new Values($options); $params = Values::of([ 'FriendlyName' => $options['friendlyName'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new FlexFlowPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of FlexFlowInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return FlexFlowPage Page of FlexFlowInstance */ public function getPage(string $targetUrl): FlexFlowPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new FlexFlowPage($this->version, $response, $this->solution); } /** * Create the FlexFlowInstance * * @param string $friendlyName A string to describe the resource * @param string $chatServiceSid The SID of the chat service * @param string $channelType The channel type * @param array|Options $options Optional Arguments * @return FlexFlowInstance Created FlexFlowInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, string $chatServiceSid, string $channelType, array $options = []): FlexFlowInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $friendlyName, 'ChatServiceSid' => $chatServiceSid, 'ChannelType' => $channelType, 'ContactIdentity' => $options['contactIdentity'], 'Enabled' => Serialize::booleanToString($options['enabled']), 'IntegrationType' => $options['integrationType'], 'Integration.FlowSid' => $options['integrationFlowSid'], 'Integration.Url' => $options['integrationUrl'], 'Integration.WorkspaceSid' => $options['integrationWorkspaceSid'], 'Integration.WorkflowSid' => $options['integrationWorkflowSid'], 'Integration.Channel' => $options['integrationChannel'], 'Integration.Timeout' => $options['integrationTimeout'], 'Integration.Priority' => $options['integrationPriority'], 'Integration.CreationOnMessage' => Serialize::booleanToString($options['integrationCreationOnMessage']), 'LongLived' => Serialize::booleanToString($options['longLived']), 'JanitorEnabled' => Serialize::booleanToString($options['janitorEnabled']), 'Integration.RetryCount' => $options['integrationRetryCount'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new FlexFlowInstance($this->version, $payload); } /** * Constructs a FlexFlowContext * * @param string $sid The SID that identifies the resource to fetch */ public function getContext(string $sid): FlexFlowContext { return new FlexFlowContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.FlexApi.V1.FlexFlowList]'; } }src/Twilio/Rest/FlexApi/V1/ConfigurationList.php000064400000001641150515725670015530 0ustar00solution = []; } /** * Constructs a ConfigurationContext */ public function getContext(): ConfigurationContext { return new ConfigurationContext($this->version); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.FlexApi.V1.ConfigurationList]'; } }src/Twilio/Rest/FlexApi/V1/ChannelInstance.php000064400000007173150515725670015130 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'flexFlowSid' => Values::array_get($payload, 'flex_flow_sid'), 'sid' => Values::array_get($payload, 'sid'), 'userSid' => Values::array_get($payload, 'user_sid'), 'taskSid' => Values::array_get($payload, 'task_sid'), 'url' => Values::array_get($payload, 'url'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), ]; $this->solution = ['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 ChannelContext Context for this ChannelInstance */ protected function proxy(): ChannelContext { if (!$this->context) { $this->context = new ChannelContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the ChannelInstance * * @return ChannelInstance Fetched ChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ChannelInstance { return $this->proxy()->fetch(); } /** * Delete the ChannelInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.FlexApi.V1.ChannelInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/FlexApi/V1/ConfigurationInstance.php000064400000020260150515725670016357 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'attributes' => Values::array_get($payload, 'attributes'), 'status' => Values::array_get($payload, 'status'), 'taskrouterWorkspaceSid' => Values::array_get($payload, 'taskrouter_workspace_sid'), 'taskrouterTargetWorkflowSid' => Values::array_get($payload, 'taskrouter_target_workflow_sid'), 'taskrouterTargetTaskqueueSid' => Values::array_get($payload, 'taskrouter_target_taskqueue_sid'), 'taskrouterTaskqueues' => Values::array_get($payload, 'taskrouter_taskqueues'), 'taskrouterSkills' => Values::array_get($payload, 'taskrouter_skills'), 'taskrouterWorkerChannels' => Values::array_get($payload, 'taskrouter_worker_channels'), 'taskrouterWorkerAttributes' => Values::array_get($payload, 'taskrouter_worker_attributes'), 'taskrouterOfflineActivitySid' => Values::array_get($payload, 'taskrouter_offline_activity_sid'), 'runtimeDomain' => Values::array_get($payload, 'runtime_domain'), 'messagingServiceInstanceSid' => Values::array_get($payload, 'messaging_service_instance_sid'), 'chatServiceInstanceSid' => Values::array_get($payload, 'chat_service_instance_sid'), 'flexServiceInstanceSid' => Values::array_get($payload, 'flex_service_instance_sid'), 'uiLanguage' => Values::array_get($payload, 'ui_language'), 'uiAttributes' => Values::array_get($payload, 'ui_attributes'), 'uiDependencies' => Values::array_get($payload, 'ui_dependencies'), 'uiVersion' => Values::array_get($payload, 'ui_version'), 'serviceVersion' => Values::array_get($payload, 'service_version'), 'callRecordingEnabled' => Values::array_get($payload, 'call_recording_enabled'), 'callRecordingWebhookUrl' => Values::array_get($payload, 'call_recording_webhook_url'), 'crmEnabled' => Values::array_get($payload, 'crm_enabled'), 'crmType' => Values::array_get($payload, 'crm_type'), 'crmCallbackUrl' => Values::array_get($payload, 'crm_callback_url'), 'crmFallbackUrl' => Values::array_get($payload, 'crm_fallback_url'), 'crmAttributes' => Values::array_get($payload, 'crm_attributes'), 'publicAttributes' => Values::array_get($payload, 'public_attributes'), 'pluginServiceEnabled' => Values::array_get($payload, 'plugin_service_enabled'), 'pluginServiceAttributes' => Values::array_get($payload, 'plugin_service_attributes'), 'integrations' => Values::array_get($payload, 'integrations'), 'outboundCallFlows' => Values::array_get($payload, 'outbound_call_flows'), 'serverlessServiceSids' => Values::array_get($payload, 'serverless_service_sids'), 'queueStatsConfiguration' => Values::array_get($payload, 'queue_stats_configuration'), 'notifications' => Values::array_get($payload, 'notifications'), 'markdown' => Values::array_get($payload, 'markdown'), 'url' => Values::array_get($payload, 'url'), 'flexInsightsHr' => Values::array_get($payload, 'flex_insights_hr'), 'flexInsightsDrilldown' => Values::array_get($payload, 'flex_insights_drilldown'), 'flexUrl' => Values::array_get($payload, 'flex_url'), ]; $this->solution = []; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return ConfigurationContext Context for this ConfigurationInstance */ protected function proxy(): ConfigurationContext { if (!$this->context) { $this->context = new ConfigurationContext($this->version); } return $this->context; } /** * Fetch the ConfigurationInstance * * @param array|Options $options Optional Arguments * @return ConfigurationInstance Fetched ConfigurationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): ConfigurationInstance { return $this->proxy()->fetch($options); } /** * Create the ConfigurationInstance * * @return ConfigurationInstance Created ConfigurationInstance * @throws TwilioException When an HTTP error occurs. */ public function create(): ConfigurationInstance { return $this->proxy()->create(); } /** * Update the ConfigurationInstance * * @return ConfigurationInstance Updated ConfigurationInstance * @throws TwilioException When an HTTP error occurs. */ public function update(): ConfigurationInstance { return $this->proxy()->update(); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.FlexApi.V1.ConfigurationInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/FlexApi/V1/ConfigurationPage.php000064400000002240150515725670015465 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ConfigurationInstance \Twilio\Rest\FlexApi\V1\ConfigurationInstance */ public function buildInstance(array $payload): ConfigurationInstance { return new ConfigurationInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.FlexApi.V1.ConfigurationPage]'; } }src/Twilio/Rest/FlexApi/V1/ChannelPage.php000064400000002174150515725670014234 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ChannelInstance \Twilio\Rest\FlexApi\V1\ChannelInstance */ public function buildInstance(array $payload): ChannelInstance { return new ChannelInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.FlexApi.V1.ChannelPage]'; } }src/Twilio/Rest/FlexApi/V1/ChannelList.php000064400000014127150515725670014274 0ustar00solution = []; $this->uri = '/Channels'; } /** * Streams ChannelInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ChannelInstance 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 ChannelInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of ChannelInstance 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 ChannelPage Page of ChannelInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ChannelPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ChannelPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ChannelInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ChannelPage Page of ChannelInstance */ public function getPage(string $targetUrl): ChannelPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ChannelPage($this->version, $response, $this->solution); } /** * Create the ChannelInstance * * @param string $flexFlowSid The SID of the Flex Flow * @param string $identity The identity value that identifies the new * resource's chat User * @param string $chatUserFriendlyName The chat participant's friendly name * @param string $chatFriendlyName The chat channel's friendly name * @param array|Options $options Optional Arguments * @return ChannelInstance Created ChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $flexFlowSid, string $identity, string $chatUserFriendlyName, string $chatFriendlyName, array $options = []): ChannelInstance { $options = new Values($options); $data = Values::of([ 'FlexFlowSid' => $flexFlowSid, 'Identity' => $identity, 'ChatUserFriendlyName' => $chatUserFriendlyName, 'ChatFriendlyName' => $chatFriendlyName, 'Target' => $options['target'], 'ChatUniqueName' => $options['chatUniqueName'], 'PreEngagementData' => $options['preEngagementData'], 'TaskSid' => $options['taskSid'], 'TaskAttributes' => $options['taskAttributes'], 'LongLived' => Serialize::booleanToString($options['longLived']), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ChannelInstance($this->version, $payload); } /** * Constructs a ChannelContext * * @param string $sid The SID that identifies the Flex chat channel resource to * fetch */ public function getContext(string $sid): ChannelContext { return new ChannelContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.FlexApi.V1.ChannelList]'; } }src/Twilio/Rest/FlexApi/V1/WebChannelContext.php000064400000004706150515725670015445 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/WebChannels/' . \rawurlencode($sid) . ''; } /** * Fetch the WebChannelInstance * * @return WebChannelInstance Fetched WebChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): WebChannelInstance { $payload = $this->version->fetch('GET', $this->uri); return new WebChannelInstance($this->version, $payload, $this->solution['sid']); } /** * Update the WebChannelInstance * * @param array|Options $options Optional Arguments * @return WebChannelInstance Updated WebChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): WebChannelInstance { $options = new Values($options); $data = Values::of([ 'ChatStatus' => $options['chatStatus'], 'PostEngagementData' => $options['postEngagementData'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new WebChannelInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the WebChannelInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.FlexApi.V1.WebChannelContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/FlexApi/V1/ConfigurationOptions.php000064400000003127150515725670016251 0ustar00options['uiVersion'] = $uiVersion; } /** * The Pinned UI version of the Configuration resource to fetch. * * @param string $uiVersion The Pinned UI version of the Configuration resource * to fetch * @return $this Fluent Builder */ public function setUiVersion(string $uiVersion): self { $this->options['uiVersion'] = $uiVersion; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.FlexApi.V1.FetchConfigurationOptions ' . $options . ']'; } }src/Twilio/Rest/FlexApi/V1/ConfigurationContext.php000064400000004516150515725670016245 0ustar00solution = []; $this->uri = '/Configuration'; } /** * Fetch the ConfigurationInstance * * @param array|Options $options Optional Arguments * @return ConfigurationInstance Fetched ConfigurationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): ConfigurationInstance { $options = new Values($options); $params = Values::of(['UiVersion' => $options['uiVersion'], ]); $payload = $this->version->fetch('GET', $this->uri, $params); return new ConfigurationInstance($this->version, $payload); } /** * Create the ConfigurationInstance * * @return ConfigurationInstance Created ConfigurationInstance * @throws TwilioException When an HTTP error occurs. */ public function create(): ConfigurationInstance { $payload = $this->version->create('POST', $this->uri); return new ConfigurationInstance($this->version, $payload); } /** * Update the ConfigurationInstance * * @return ConfigurationInstance Updated ConfigurationInstance * @throws TwilioException When an HTTP error occurs. */ public function update(): ConfigurationInstance { $payload = $this->version->update('POST', $this->uri); return new ConfigurationInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.FlexApi.V1.ConfigurationContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/FlexApi/V1/FlexFlowOptions.php000064400000066146150515725670015202 0ustar00options['friendlyName'] = $friendlyName; } /** * The `friendly_name` of the Flex Flow resources to read. * * @param string $friendlyName The `friendly_name` of the Flex Flow resources * to read * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.FlexApi.V1.ReadFlexFlowOptions ' . $options . ']'; } } class CreateFlexFlowOptions extends Options { /** * @param string $contactIdentity The channel contact's Identity * @param bool $enabled Whether the new Flex Flow is enabled * @param string $integrationType The software that will handle inbound * messages. * @param string $integrationFlowSid The SID of the Studio Flow * @param string $integrationUrl The External Webhook URL * @param string $integrationWorkspaceSid The Workspace SID for a new Task * @param string $integrationWorkflowSid The Workflow SID for a new Task * @param string $integrationChannel The Task Channel for a new Task * @param int $integrationTimeout The Task timeout in seconds for a new Task * @param int $integrationPriority The Task priority of a new Task * @param bool $integrationCreationOnMessage Whether to create a Task when the * first message arrives * @param bool $longLived Reuse this chat channel for future interactions with * a contact * @param bool $janitorEnabled Remove active Proxy sessions if the * corresponding Task is deleted * @param int $integrationRetryCount The number of times to retry the webhook * if the first attempt fails */ public function __construct(string $contactIdentity = Values::NONE, bool $enabled = Values::NONE, string $integrationType = Values::NONE, string $integrationFlowSid = Values::NONE, string $integrationUrl = Values::NONE, string $integrationWorkspaceSid = Values::NONE, string $integrationWorkflowSid = Values::NONE, string $integrationChannel = Values::NONE, int $integrationTimeout = Values::NONE, int $integrationPriority = Values::NONE, bool $integrationCreationOnMessage = Values::NONE, bool $longLived = Values::NONE, bool $janitorEnabled = Values::NONE, int $integrationRetryCount = Values::NONE) { $this->options['contactIdentity'] = $contactIdentity; $this->options['enabled'] = $enabled; $this->options['integrationType'] = $integrationType; $this->options['integrationFlowSid'] = $integrationFlowSid; $this->options['integrationUrl'] = $integrationUrl; $this->options['integrationWorkspaceSid'] = $integrationWorkspaceSid; $this->options['integrationWorkflowSid'] = $integrationWorkflowSid; $this->options['integrationChannel'] = $integrationChannel; $this->options['integrationTimeout'] = $integrationTimeout; $this->options['integrationPriority'] = $integrationPriority; $this->options['integrationCreationOnMessage'] = $integrationCreationOnMessage; $this->options['longLived'] = $longLived; $this->options['janitorEnabled'] = $janitorEnabled; $this->options['integrationRetryCount'] = $integrationRetryCount; } /** * The channel contact's Identity. * * @param string $contactIdentity The channel contact's Identity * @return $this Fluent Builder */ public function setContactIdentity(string $contactIdentity): self { $this->options['contactIdentity'] = $contactIdentity; return $this; } /** * Whether the new Flex Flow is enabled. * * @param bool $enabled Whether the new Flex Flow is enabled * @return $this Fluent Builder */ public function setEnabled(bool $enabled): self { $this->options['enabled'] = $enabled; return $this; } /** * The software that will handle inbound messages. [Integration Type](https://www.twilio.com/docs/flex/developer/messaging/manage-flows#integration-types) can be: `studio`, `external`, or `task`. * * @param string $integrationType The software that will handle inbound * messages. * @return $this Fluent Builder */ public function setIntegrationType(string $integrationType): self { $this->options['integrationType'] = $integrationType; return $this; } /** * The SID of the Studio Flow. Required when `integrationType` is `studio`. * * @param string $integrationFlowSid The SID of the Studio Flow * @return $this Fluent Builder */ public function setIntegrationFlowSid(string $integrationFlowSid): self { $this->options['integrationFlowSid'] = $integrationFlowSid; return $this; } /** * The URL of the external webhook. Required when `integrationType` is `external`. * * @param string $integrationUrl The External Webhook URL * @return $this Fluent Builder */ public function setIntegrationUrl(string $integrationUrl): self { $this->options['integrationUrl'] = $integrationUrl; return $this; } /** * The Workspace SID for a new Task. Required when `integrationType` is `task`. * * @param string $integrationWorkspaceSid The Workspace SID for a new Task * @return $this Fluent Builder */ public function setIntegrationWorkspaceSid(string $integrationWorkspaceSid): self { $this->options['integrationWorkspaceSid'] = $integrationWorkspaceSid; return $this; } /** * The Workflow SID for a new Task. Required when `integrationType` is `task`. * * @param string $integrationWorkflowSid The Workflow SID for a new Task * @return $this Fluent Builder */ public function setIntegrationWorkflowSid(string $integrationWorkflowSid): self { $this->options['integrationWorkflowSid'] = $integrationWorkflowSid; return $this; } /** * The Task Channel SID (TCXXXX) or unique name (e.g., `sms`) to use for the Task that will be created. Applicable and required when `integrationType` is `task`. The default value is `default`. * * @param string $integrationChannel The Task Channel for a new Task * @return $this Fluent Builder */ public function setIntegrationChannel(string $integrationChannel): self { $this->options['integrationChannel'] = $integrationChannel; return $this; } /** * The Task timeout in seconds for a new Task. Default is 86,400 seconds (24 hours). Optional when `integrationType` is `task`, not applicable otherwise. * * @param int $integrationTimeout The Task timeout in seconds for a new Task * @return $this Fluent Builder */ public function setIntegrationTimeout(int $integrationTimeout): self { $this->options['integrationTimeout'] = $integrationTimeout; return $this; } /** * The Task priority of a new Task. The default priority is 0. Optional when `integrationType` is `task`, not applicable otherwise. * * @param int $integrationPriority The Task priority of a new Task * @return $this Fluent Builder */ public function setIntegrationPriority(int $integrationPriority): self { $this->options['integrationPriority'] = $integrationPriority; return $this; } /** * In the context of outbound messaging, defines whether to create a Task immediately (and therefore reserve the conversation to current agent), or delay Task creation until the customer sends the first response. Set to false to create immediately, true to delay Task creation. This setting is only applicable for outbound messaging. * * @param bool $integrationCreationOnMessage Whether to create a Task when the * first message arrives * @return $this Fluent Builder */ public function setIntegrationCreationOnMessage(bool $integrationCreationOnMessage): self { $this->options['integrationCreationOnMessage'] = $integrationCreationOnMessage; return $this; } /** * When enabled, Flex will keep the chat channel active so that it may be used for subsequent interactions with a contact identity. Defaults to `false`. * * @param bool $longLived Reuse this chat channel for future interactions with * a contact * @return $this Fluent Builder */ public function setLongLived(bool $longLived): self { $this->options['longLived'] = $longLived; return $this; } /** * When enabled, the Messaging Channel Janitor will remove active Proxy sessions if the associated Task is deleted outside of the Flex UI. Defaults to `false`. * * @param bool $janitorEnabled Remove active Proxy sessions if the * corresponding Task is deleted * @return $this Fluent Builder */ public function setJanitorEnabled(bool $janitorEnabled): self { $this->options['janitorEnabled'] = $janitorEnabled; return $this; } /** * The number of times to retry the webhook if the first attempt fails. Can be an integer between 0 and 3 (inclusive), default is 3. Optional when `integrationType` is `external`, not applicable otherwise. * * @param int $integrationRetryCount The number of times to retry the webhook * if the first attempt fails * @return $this Fluent Builder */ public function setIntegrationRetryCount(int $integrationRetryCount): self { $this->options['integrationRetryCount'] = $integrationRetryCount; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.FlexApi.V1.CreateFlexFlowOptions ' . $options . ']'; } } class UpdateFlexFlowOptions extends Options { /** * @param string $friendlyName A string to describe the resource * @param string $chatServiceSid The SID of the chat service * @param string $channelType The channel type * @param string $contactIdentity The channel contact's Identity * @param bool $enabled Whether the new Flex Flow is enabled * @param string $integrationType The software that will handle inbound * messages. * @param string $integrationFlowSid The SID of the Studio Flow * @param string $integrationUrl The External Webhook URL * @param string $integrationWorkspaceSid The Workspace SID for a new Task * @param string $integrationWorkflowSid The Workflow SID for a new Task * @param string $integrationChannel The Task Channel for a new Task * @param int $integrationTimeout The Task timeout in seconds for a new Task * @param int $integrationPriority The Task priority of a new Task * @param bool $integrationCreationOnMessage Whether to create a Task when the * first message arrives * @param bool $longLived Reuse this chat channel for future interactions with * a contact * @param bool $janitorEnabled Remove active Proxy sessions if the * corresponding Task is deleted * @param int $integrationRetryCount The number of times to retry the webhook * if the first attempt fails */ public function __construct(string $friendlyName = Values::NONE, string $chatServiceSid = Values::NONE, string $channelType = Values::NONE, string $contactIdentity = Values::NONE, bool $enabled = Values::NONE, string $integrationType = Values::NONE, string $integrationFlowSid = Values::NONE, string $integrationUrl = Values::NONE, string $integrationWorkspaceSid = Values::NONE, string $integrationWorkflowSid = Values::NONE, string $integrationChannel = Values::NONE, int $integrationTimeout = Values::NONE, int $integrationPriority = Values::NONE, bool $integrationCreationOnMessage = Values::NONE, bool $longLived = Values::NONE, bool $janitorEnabled = Values::NONE, int $integrationRetryCount = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['chatServiceSid'] = $chatServiceSid; $this->options['channelType'] = $channelType; $this->options['contactIdentity'] = $contactIdentity; $this->options['enabled'] = $enabled; $this->options['integrationType'] = $integrationType; $this->options['integrationFlowSid'] = $integrationFlowSid; $this->options['integrationUrl'] = $integrationUrl; $this->options['integrationWorkspaceSid'] = $integrationWorkspaceSid; $this->options['integrationWorkflowSid'] = $integrationWorkflowSid; $this->options['integrationChannel'] = $integrationChannel; $this->options['integrationTimeout'] = $integrationTimeout; $this->options['integrationPriority'] = $integrationPriority; $this->options['integrationCreationOnMessage'] = $integrationCreationOnMessage; $this->options['longLived'] = $longLived; $this->options['janitorEnabled'] = $janitorEnabled; $this->options['integrationRetryCount'] = $integrationRetryCount; } /** * A descriptive string that you create to describe the Flex Flow resource. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The SID of the chat service. * * @param string $chatServiceSid The SID of the chat service * @return $this Fluent Builder */ public function setChatServiceSid(string $chatServiceSid): self { $this->options['chatServiceSid'] = $chatServiceSid; return $this; } /** * The channel type. Can be: `web`, `facebook`, `sms`, `whatsapp`, `line` or `custom`. * * @param string $channelType The channel type * @return $this Fluent Builder */ public function setChannelType(string $channelType): self { $this->options['channelType'] = $channelType; return $this; } /** * The channel contact's Identity. * * @param string $contactIdentity The channel contact's Identity * @return $this Fluent Builder */ public function setContactIdentity(string $contactIdentity): self { $this->options['contactIdentity'] = $contactIdentity; return $this; } /** * Whether the new Flex Flow is enabled. * * @param bool $enabled Whether the new Flex Flow is enabled * @return $this Fluent Builder */ public function setEnabled(bool $enabled): self { $this->options['enabled'] = $enabled; return $this; } /** * The software that will handle inbound messages. [Integration Type](https://www.twilio.com/docs/flex/developer/messaging/manage-flows#integration-types) can be: `studio`, `external`, or `task`. * * @param string $integrationType The software that will handle inbound * messages. * @return $this Fluent Builder */ public function setIntegrationType(string $integrationType): self { $this->options['integrationType'] = $integrationType; return $this; } /** * The SID of the Studio Flow. Required when `integrationType` is `studio`. * * @param string $integrationFlowSid The SID of the Studio Flow * @return $this Fluent Builder */ public function setIntegrationFlowSid(string $integrationFlowSid): self { $this->options['integrationFlowSid'] = $integrationFlowSid; return $this; } /** * The URL of the external webhook. Required when `integrationType` is `external`. * * @param string $integrationUrl The External Webhook URL * @return $this Fluent Builder */ public function setIntegrationUrl(string $integrationUrl): self { $this->options['integrationUrl'] = $integrationUrl; return $this; } /** * The Workspace SID for a new Task. Required when `integrationType` is `task`. * * @param string $integrationWorkspaceSid The Workspace SID for a new Task * @return $this Fluent Builder */ public function setIntegrationWorkspaceSid(string $integrationWorkspaceSid): self { $this->options['integrationWorkspaceSid'] = $integrationWorkspaceSid; return $this; } /** * The Workflow SID for a new Task. Required when `integrationType` is `task`. * * @param string $integrationWorkflowSid The Workflow SID for a new Task * @return $this Fluent Builder */ public function setIntegrationWorkflowSid(string $integrationWorkflowSid): self { $this->options['integrationWorkflowSid'] = $integrationWorkflowSid; return $this; } /** * The Task Channel SID (TCXXXX) or unique name (e.g., `sms`) to use for the Task that will be created. Applicable and required when `integrationType` is `task`. The default value is `default`. * * @param string $integrationChannel The Task Channel for a new Task * @return $this Fluent Builder */ public function setIntegrationChannel(string $integrationChannel): self { $this->options['integrationChannel'] = $integrationChannel; return $this; } /** * The Task timeout in seconds for a new Task. Default is 86,400 seconds (24 hours). Optional when `integrationType` is `task`, not applicable otherwise. * * @param int $integrationTimeout The Task timeout in seconds for a new Task * @return $this Fluent Builder */ public function setIntegrationTimeout(int $integrationTimeout): self { $this->options['integrationTimeout'] = $integrationTimeout; return $this; } /** * The Task priority of a new Task. The default priority is 0. Optional when `integrationType` is `task`, not applicable otherwise. * * @param int $integrationPriority The Task priority of a new Task * @return $this Fluent Builder */ public function setIntegrationPriority(int $integrationPriority): self { $this->options['integrationPriority'] = $integrationPriority; return $this; } /** * In the context of outbound messaging, defines whether to create a Task immediately (and therefore reserve the conversation to current agent), or delay Task creation until the customer sends the first response. Set to false to create immediately, true to delay Task creation. This setting is only applicable for outbound messaging. * * @param bool $integrationCreationOnMessage Whether to create a Task when the * first message arrives * @return $this Fluent Builder */ public function setIntegrationCreationOnMessage(bool $integrationCreationOnMessage): self { $this->options['integrationCreationOnMessage'] = $integrationCreationOnMessage; return $this; } /** * When enabled, Flex will keep the chat channel active so that it may be used for subsequent interactions with a contact identity. Defaults to `false`. * * @param bool $longLived Reuse this chat channel for future interactions with * a contact * @return $this Fluent Builder */ public function setLongLived(bool $longLived): self { $this->options['longLived'] = $longLived; return $this; } /** * When enabled, the Messaging Channel Janitor will remove active Proxy sessions if the associated Task is deleted outside of the Flex UI. Defaults to `false`. * * @param bool $janitorEnabled Remove active Proxy sessions if the * corresponding Task is deleted * @return $this Fluent Builder */ public function setJanitorEnabled(bool $janitorEnabled): self { $this->options['janitorEnabled'] = $janitorEnabled; return $this; } /** * The number of times to retry the webhook if the first attempt fails. Can be an integer between 0 and 3 (inclusive), default is 3. Optional when `integrationType` is `external`, not applicable otherwise. * * @param int $integrationRetryCount The number of times to retry the webhook * if the first attempt fails * @return $this Fluent Builder */ public function setIntegrationRetryCount(int $integrationRetryCount): self { $this->options['integrationRetryCount'] = $integrationRetryCount; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.FlexApi.V1.UpdateFlexFlowOptions ' . $options . ']'; } }src/Twilio/Rest/FlexApi/V1.php000064400000006357150515725670012076 0ustar00version = 'v1'; } protected function getChannel(): ChannelList { if (!$this->_channel) { $this->_channel = new ChannelList($this); } return $this->_channel; } protected function getConfiguration(): ConfigurationList { if (!$this->_configuration) { $this->_configuration = new ConfigurationList($this); } return $this->_configuration; } protected function getFlexFlow(): FlexFlowList { if (!$this->_flexFlow) { $this->_flexFlow = new FlexFlowList($this); } return $this->_flexFlow; } protected function getWebChannel(): WebChannelList { if (!$this->_webChannel) { $this->_webChannel = new WebChannelList($this); } return $this->_webChannel; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.FlexApi.V1]'; } }src/Twilio/Rest/Lookups/V1/PhoneNumberOptions.php000064400000010146150515725670015767 0ustar00options['countryCode'] = $countryCode; $this->options['type'] = $type; $this->options['addOns'] = $addOns; $this->options['addOnsData'] = $addOnsData; } /** * The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the phone number to fetch. This is used to specify the country when the phone number is provided in a national format. * * @param string $countryCode The ISO country code of the phone number * @return $this Fluent Builder */ public function setCountryCode(string $countryCode): self { $this->options['countryCode'] = $countryCode; return $this; } /** * The type of information to return. Can be: `carrier` or `caller-name`. The default is null. Carrier information costs $0.005 per phone number looked up. Caller Name information is currently available only in the US and costs $0.01 per phone number looked up. To retrieve both types on information, specify this parameter twice; once with `carrier` and once with `caller-name` as the value. * * @param string[] $type The type of information to return * @return $this Fluent Builder */ public function setType(array $type): self { $this->options['type'] = $type; return $this; } /** * The `unique_name` of an Add-on you would like to invoke. Can be the `unique_name` of an Add-on that is installed on your account. You can specify multiple instances of this parameter to invoke multiple Add-ons. For more information about Add-ons, see the [Add-ons documentation](https://www.twilio.com/docs/add-ons). * * @param string[] $addOns The unique_name of an Add-on you would like to invoke * @return $this Fluent Builder */ public function setAddOns(array $addOns): self { $this->options['addOns'] = $addOns; return $this; } /** * Data specific to the add-on you would like to invoke. The content and format of this value depends on the add-on. * * @param string $addOnsData Data specific to the add-on you would like to * invoke * @return $this Fluent Builder */ public function setAddOnsData(string $addOnsData): self { $this->options['addOnsData'] = $addOnsData; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Lookups.V1.FetchPhoneNumberOptions ' . $options . ']'; } }src/Twilio/Rest/Lookups/V1/PhoneNumberContext.php000064400000004113150515725670015755 0ustar00solution = ['phoneNumber' => $phoneNumber, ]; $this->uri = '/PhoneNumbers/' . \rawurlencode($phoneNumber) . ''; } /** * Fetch the PhoneNumberInstance * * @param array|Options $options Optional Arguments * @return PhoneNumberInstance Fetched PhoneNumberInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): PhoneNumberInstance { $options = new Values($options); $params = Values::of([ 'CountryCode' => $options['countryCode'], 'Type' => Serialize::map($options['type'], function($e) { return $e; }), 'AddOns' => Serialize::map($options['addOns'], function($e) { return $e; }), ]); $params = \array_merge($params, Serialize::prefixedCollapsibleMap($options['addOnsData'], 'AddOns')); $payload = $this->version->fetch('GET', $this->uri, $params); return new PhoneNumberInstance($this->version, $payload, $this->solution['phoneNumber']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Lookups.V1.PhoneNumberContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Lookups/V1/PhoneNumberPage.php000064400000002224150515725670015206 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return PhoneNumberInstance \Twilio\Rest\Lookups\V1\PhoneNumberInstance */ public function buildInstance(array $payload): PhoneNumberInstance { return new PhoneNumberInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Lookups.V1.PhoneNumberPage]'; } }src/Twilio/Rest/Lookups/V1/PhoneNumberInstance.php000064400000006554150515725670016110 0ustar00properties = [ 'callerName' => Values::array_get($payload, 'caller_name'), 'countryCode' => Values::array_get($payload, 'country_code'), 'phoneNumber' => Values::array_get($payload, 'phone_number'), 'nationalFormat' => Values::array_get($payload, 'national_format'), 'carrier' => Values::array_get($payload, 'carrier'), 'addOns' => Values::array_get($payload, 'add_ons'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['phoneNumber' => $phoneNumber ?: $this->properties['phoneNumber'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return PhoneNumberContext Context for this PhoneNumberInstance */ protected function proxy(): PhoneNumberContext { if (!$this->context) { $this->context = new PhoneNumberContext($this->version, $this->solution['phoneNumber']); } return $this->context; } /** * Fetch the PhoneNumberInstance * * @param array|Options $options Optional Arguments * @return PhoneNumberInstance Fetched PhoneNumberInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): PhoneNumberInstance { return $this->proxy()->fetch($options); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Lookups.V1.PhoneNumberInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Lookups/V1/PhoneNumberList.php000064400000002011150515725670015237 0ustar00solution = []; } /** * Constructs a PhoneNumberContext * * @param string $phoneNumber The phone number to fetch in E.164 format */ public function getContext(string $phoneNumber): PhoneNumberContext { return new PhoneNumberContext($this->version, $phoneNumber); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Lookups.V1.PhoneNumberList]'; } }src/Twilio/Rest/Lookups/V1.php000064400000004335150515725670012174 0ustar00version = 'v1'; } protected function getPhoneNumbers(): PhoneNumberList { if (!$this->_phoneNumbers) { $this->_phoneNumbers = new PhoneNumberList($this); } return $this->_phoneNumbers; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Lookups.V1]'; } }src/Twilio/Rest/Supersim/V1/FleetPage.php000064400000002344150515725670014201 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return FleetInstance \Twilio\Rest\Supersim\V1\FleetInstance */ public function buildInstance(array $payload): FleetInstance { return new FleetInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Supersim.V1.FleetPage]'; } }src/Twilio/Rest/Supersim/V1/UsageRecordInstance.php000064400000004766150515725670016247 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'simSid' => Values::array_get($payload, 'sim_sid'), 'networkSid' => Values::array_get($payload, 'network_sid'), 'fleetSid' => Values::array_get($payload, 'fleet_sid'), 'isoCountry' => Values::array_get($payload, 'iso_country'), 'period' => Values::array_get($payload, 'period'), 'dataUpload' => Values::array_get($payload, 'data_upload'), 'dataDownload' => Values::array_get($payload, 'data_download'), 'dataTotal' => Values::array_get($payload, 'data_total'), ]; $this->solution = []; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Supersim.V1.UsageRecordInstance]'; } }src/Twilio/Rest/Supersim/V1/NetworkPage.php000064400000002360150515725670014571 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return NetworkInstance \Twilio\Rest\Supersim\V1\NetworkInstance */ public function buildInstance(array $payload): NetworkInstance { return new NetworkInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Supersim.V1.NetworkPage]'; } }src/Twilio/Rest/Supersim/V1/NetworkAccessProfileInstance.php000064400000010274150515725670020127 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 NetworkAccessProfileContext Context for this * NetworkAccessProfileInstance */ protected function proxy(): NetworkAccessProfileContext { if (!$this->context) { $this->context = new NetworkAccessProfileContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the NetworkAccessProfileInstance * * @return NetworkAccessProfileInstance Fetched NetworkAccessProfileInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): NetworkAccessProfileInstance { return $this->proxy()->fetch(); } /** * Update the NetworkAccessProfileInstance * * @param array|Options $options Optional Arguments * @return NetworkAccessProfileInstance Updated NetworkAccessProfileInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): NetworkAccessProfileInstance { return $this->proxy()->update($options); } /** * Access the networks */ protected function getNetworks(): NetworkAccessProfileNetworkList { return $this->proxy()->networks; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Supersim.V1.NetworkAccessProfileInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Supersim/V1/FleetList.php000064400000014607150515725670014245 0ustar00solution = []; $this->uri = '/Fleets'; } /** * Create the FleetInstance * * @param string $networkAccessProfile The SID or unique name of the Network * Access Profile of the Fleet * @param array|Options $options Optional Arguments * @return FleetInstance Created FleetInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $networkAccessProfile, array $options = []): FleetInstance { $options = new Values($options); $data = Values::of([ 'NetworkAccessProfile' => $networkAccessProfile, 'UniqueName' => $options['uniqueName'], 'DataEnabled' => Serialize::booleanToString($options['dataEnabled']), 'DataLimit' => $options['dataLimit'], 'CommandsEnabled' => Serialize::booleanToString($options['commandsEnabled']), 'CommandsUrl' => $options['commandsUrl'], 'CommandsMethod' => $options['commandsMethod'], 'SmsCommandsEnabled' => Serialize::booleanToString($options['smsCommandsEnabled']), 'SmsCommandsUrl' => $options['smsCommandsUrl'], 'SmsCommandsMethod' => $options['smsCommandsMethod'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new FleetInstance($this->version, $payload); } /** * Streams FleetInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads FleetInstance 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 FleetInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of FleetInstance 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 FleetPage Page of FleetInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): FleetPage { $options = new Values($options); $params = Values::of([ 'NetworkAccessProfile' => $options['networkAccessProfile'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new FleetPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of FleetInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return FleetPage Page of FleetInstance */ public function getPage(string $targetUrl): FleetPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new FleetPage($this->version, $response, $this->solution); } /** * Constructs a FleetContext * * @param string $sid The SID that identifies the resource to fetch */ public function getContext(string $sid): FleetContext { return new FleetContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Supersim.V1.FleetList]'; } }src/Twilio/Rest/Supersim/V1/CommandOptions.php000064400000012264150515725670015301 0ustar00options['callbackMethod'] = $callbackMethod; $this->options['callbackUrl'] = $callbackUrl; } /** * The HTTP method we should use to call `callback_url`. Can be: `GET` or `POST` and the default is POST. * * @param string $callbackMethod The HTTP method we should use to call * callback_url * @return $this Fluent Builder */ public function setCallbackMethod(string $callbackMethod): self { $this->options['callbackMethod'] = $callbackMethod; return $this; } /** * The URL we should call using the `callback_method` after we have sent the command. * * @param string $callbackUrl The URL we should call after we have sent the * command * @return $this Fluent Builder */ public function setCallbackUrl(string $callbackUrl): self { $this->options['callbackUrl'] = $callbackUrl; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Supersim.V1.CreateCommandOptions ' . $options . ']'; } } class ReadCommandOptions extends Options { /** * @param string $sim The SID or unique name of the Sim that Command was sent * to or from. * @param string $status The status of the Command * @param string $direction The direction of the Command */ public function __construct(string $sim = Values::NONE, string $status = Values::NONE, string $direction = Values::NONE) { $this->options['sim'] = $sim; $this->options['status'] = $status; $this->options['direction'] = $direction; } /** * The SID or unique name of the Sim that Command was sent to or from. * * @param string $sim The SID or unique name of the Sim that Command was sent * to or from. * @return $this Fluent Builder */ public function setSim(string $sim): self { $this->options['sim'] = $sim; return $this; } /** * The status of the Command. Can be: `queued`, `sent`, `delivered`, `received` or `failed`. See the [Command Status Values](https://www.twilio.com/docs/wireless/api/command-resource#status-values) for a description of each. * * @param string $status The status of the Command * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * The direction of the Command. Can be `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term `mobile terminated`, and `from_sim` is synonymous with the term `mobile originated`. * * @param string $direction The direction of the Command * @return $this Fluent Builder */ public function setDirection(string $direction): self { $this->options['direction'] = $direction; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Supersim.V1.ReadCommandOptions ' . $options . ']'; } }src/Twilio/Rest/Supersim/V1/IpCommandList.php000064400000014473150515725670015056 0ustar00solution = []; $this->uri = '/IpCommands'; } /** * Create the IpCommandInstance * * @param string $sim The sid or unique_name of the Super SIM to send the IP * Command to * @param string $payload The payload to be delivered to the device * @param int $devicePort The device port to which the IP Command will be sent * @param array|Options $options Optional Arguments * @return IpCommandInstance Created IpCommandInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $sim, string $payload, int $devicePort, array $options = []): IpCommandInstance { $options = new Values($options); $data = Values::of([ 'Sim' => $sim, 'Payload' => $payload, 'DevicePort' => $devicePort, 'PayloadType' => $options['payloadType'], 'CallbackUrl' => $options['callbackUrl'], 'CallbackMethod' => $options['callbackMethod'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new IpCommandInstance($this->version, $payload); } /** * Streams IpCommandInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads IpCommandInstance 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 IpCommandInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of IpCommandInstance 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 IpCommandPage Page of IpCommandInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): IpCommandPage { $options = new Values($options); $params = Values::of([ 'Sim' => $options['sim'], 'SimIccid' => $options['simIccid'], 'Status' => $options['status'], 'Direction' => $options['direction'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new IpCommandPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of IpCommandInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return IpCommandPage Page of IpCommandInstance */ public function getPage(string $targetUrl): IpCommandPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new IpCommandPage($this->version, $response, $this->solution); } /** * Constructs a IpCommandContext * * @param string $sid The SID that identifies the resource to fetch */ public function getContext(string $sid): IpCommandContext { return new IpCommandContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Supersim.V1.IpCommandList]'; } }src/Twilio/Rest/Supersim/V1/SimPage.php000064400000002330150515725670013665 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SimInstance \Twilio\Rest\Supersim\V1\SimInstance */ public function buildInstance(array $payload): SimInstance { return new SimInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Supersim.V1.SimPage]'; } }src/Twilio/Rest/Supersim/V1/CommandPage.php000064400000002360150515725670014516 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CommandInstance \Twilio\Rest\Supersim\V1\CommandInstance */ public function buildInstance(array $payload): CommandInstance { return new CommandInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Supersim.V1.CommandPage]'; } }src/Twilio/Rest/Supersim/V1/SmsCommandPage.php000064400000002402150515725670015176 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SmsCommandInstance \Twilio\Rest\Supersim\V1\SmsCommandInstance */ public function buildInstance(array $payload): SmsCommandInstance { return new SmsCommandInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Supersim.V1.SmsCommandPage]'; } }src/Twilio/Rest/Supersim/V1/IpCommandOptions.php000064400000015257150515725670015577 0ustar00options['payloadType'] = $payloadType; $this->options['callbackUrl'] = $callbackUrl; $this->options['callbackMethod'] = $callbackMethod; } /** * Indicates how the payload is encoded. Either `text` or `binary`. Defaults to `text`. * * @param string $payloadType Indicates how the payload is encoded * @return $this Fluent Builder */ public function setPayloadType(string $payloadType): self { $this->options['payloadType'] = $payloadType; return $this; } /** * The URL we should call using the `callback_method` after we have sent the IP Command. * * @param string $callbackUrl The URL we should call after we have sent the IP * Command * @return $this Fluent Builder */ public function setCallbackUrl(string $callbackUrl): self { $this->options['callbackUrl'] = $callbackUrl; return $this; } /** * The HTTP method we should use to call `callback_url`. Can be `GET` or `POST`, and the default is `POST`. * * @param string $callbackMethod The HTTP method we should use to call * callback_url * @return $this Fluent Builder */ public function setCallbackMethod(string $callbackMethod): self { $this->options['callbackMethod'] = $callbackMethod; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Supersim.V1.CreateIpCommandOptions ' . $options . ']'; } } class ReadIpCommandOptions extends Options { /** * @param string $sim The SID or unique name of the Sim resource that IP * Command was sent to or from. * @param string $simIccid The ICCID of the Sim resource that IP Command was * sent to or from. * @param string $status The status of the IP Command * @param string $direction The direction of the IP Command */ public function __construct(string $sim = Values::NONE, string $simIccid = Values::NONE, string $status = Values::NONE, string $direction = Values::NONE) { $this->options['sim'] = $sim; $this->options['simIccid'] = $simIccid; $this->options['status'] = $status; $this->options['direction'] = $direction; } /** * The SID or unique name of the Sim resource that IP Command was sent to or from. * * @param string $sim The SID or unique name of the Sim resource that IP * Command was sent to or from. * @return $this Fluent Builder */ public function setSim(string $sim): self { $this->options['sim'] = $sim; return $this; } /** * The ICCID of the Sim resource that IP Command was sent to or from. * * @param string $simIccid The ICCID of the Sim resource that IP Command was * sent to or from. * @return $this Fluent Builder */ public function setSimIccid(string $simIccid): self { $this->options['simIccid'] = $simIccid; return $this; } /** * The status of the IP Command. Can be: `queued`, `sent`, `received` or `failed`. See the [IP Command Status Values](https://www.twilio.com/docs/wireless/api/ipcommand-resource#status-values) for a description of each. * * @param string $status The status of the IP Command * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * The direction of the IP Command. Can be `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term `mobile terminated`, and `from_sim` is synonymous with the term `mobile originated`. * * @param string $direction The direction of the IP Command * @return $this Fluent Builder */ public function setDirection(string $direction): self { $this->options['direction'] = $direction; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Supersim.V1.ReadIpCommandOptions ' . $options . ']'; } }src/Twilio/Rest/Supersim/V1/SimOptions.php000064400000021004150515725670014443 0ustar00options['uniqueName'] = $uniqueName; $this->options['status'] = $status; $this->options['fleet'] = $fleet; $this->options['callbackUrl'] = $callbackUrl; $this->options['callbackMethod'] = $callbackMethod; $this->options['accountSid'] = $accountSid; } /** * An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. * * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * The new status of the resource. Can be: `ready`, `active`, or `inactive`. See the [Super SIM Status Values](https://www.twilio.com/docs/iot/supersim/api/sim-resource#status-values) for more info. * * @param string $status The new status of the Super SIM * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * The SID or unique name of the Fleet to which the SIM resource should be assigned. * * @param string $fleet The SID or unique name of the Fleet to which the SIM * resource should be assigned * @return $this Fluent Builder */ public function setFleet(string $fleet): self { $this->options['fleet'] = $fleet; return $this; } /** * The URL we should call using the `callback_method` after an asynchronous update has finished. * * @param string $callbackUrl The URL we should call after the update has * finished * @return $this Fluent Builder */ public function setCallbackUrl(string $callbackUrl): self { $this->options['callbackUrl'] = $callbackUrl; return $this; } /** * The HTTP method we should use to call `callback_url`. Can be: `GET` or `POST` and the default is POST. * * @param string $callbackMethod The HTTP method we should use to call * callback_url * @return $this Fluent Builder */ public function setCallbackMethod(string $callbackMethod): self { $this->options['callbackMethod'] = $callbackMethod; return $this; } /** * The SID of the Account to which the Sim resource should belong. The Account SID can only be that of the requesting Account or that of a Subaccount of the requesting Account. Only valid when the Sim resource's status is new. * * @param string $accountSid The SID of the Account to which the Sim resource * should belong * @return $this Fluent Builder */ public function setAccountSid(string $accountSid): self { $this->options['accountSid'] = $accountSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Supersim.V1.UpdateSimOptions ' . $options . ']'; } } class ReadSimOptions extends Options { /** * @param string $status The status of the Sim resources to read * @param string $fleet The SID or unique name of the Fleet to which a list of * Sims are assigned * @param string $iccid The ICCID associated with a Super SIM to filter the * list by */ public function __construct(string $status = Values::NONE, string $fleet = Values::NONE, string $iccid = Values::NONE) { $this->options['status'] = $status; $this->options['fleet'] = $fleet; $this->options['iccid'] = $iccid; } /** * The status of the Sim resources to read. Can be `new`, `ready`, `active`, `inactive`, or `scheduled`. * * @param string $status The status of the Sim resources to read * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * The SID or unique name of the Fleet to which a list of Sims are assigned. * * @param string $fleet The SID or unique name of the Fleet to which a list of * Sims are assigned * @return $this Fluent Builder */ public function setFleet(string $fleet): self { $this->options['fleet'] = $fleet; return $this; } /** * The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) associated with a Super SIM to filter the list by. Passing this parameter will always return a list containing zero or one SIMs. * * @param string $iccid The ICCID associated with a Super SIM to filter the * list by * @return $this Fluent Builder */ public function setIccid(string $iccid): self { $this->options['iccid'] = $iccid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Supersim.V1.ReadSimOptions ' . $options . ']'; } }src/Twilio/Rest/Supersim/V1/SmsCommandContext.php000064400000003143150515725670015751 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/SmsCommands/' . \rawurlencode($sid) . ''; } /** * Fetch the SmsCommandInstance * * @return SmsCommandInstance Fetched SmsCommandInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SmsCommandInstance { $payload = $this->version->fetch('GET', $this->uri); return new SmsCommandInstance($this->version, $payload, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Supersim.V1.SmsCommandContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Supersim/V1/NetworkOptions.php000064400000005665150515725670015363 0ustar00options['isoCountry'] = $isoCountry; $this->options['mcc'] = $mcc; $this->options['mnc'] = $mnc; } /** * The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Network resources to read. * * @param string $isoCountry The ISO country code of the Network resources to * read * @return $this Fluent Builder */ public function setIsoCountry(string $isoCountry): self { $this->options['isoCountry'] = $isoCountry; return $this; } /** * The 'mobile country code' of a country. Network resources with this `mcc` in their `identifiers` will be read. * * @param string $mcc The MCC of Network resource identifiers to be read * @return $this Fluent Builder */ public function setMcc(string $mcc): self { $this->options['mcc'] = $mcc; return $this; } /** * The 'mobile network code' of a mobile operator network. Network resources with this `mnc` in their `identifiers` will be read. * * @param string $mnc The MNC of Network resource identifiers to be read * @return $this Fluent Builder */ public function setMnc(string $mnc): self { $this->options['mnc'] = $mnc; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Supersim.V1.ReadNetworkOptions ' . $options . ']'; } }src/Twilio/Rest/Supersim/V1/UsageRecordList.php000064400000012332150515725670015402 0ustar00solution = []; $this->uri = '/UsageRecords'; } /** * Streams UsageRecordInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads UsageRecordInstance 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 UsageRecordInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of UsageRecordInstance 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 UsageRecordPage Page of UsageRecordInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): UsageRecordPage { $options = new Values($options); $params = Values::of([ 'Sim' => $options['sim'], 'Fleet' => $options['fleet'], 'Network' => $options['network'], 'IsoCountry' => $options['isoCountry'], 'Group' => $options['group'], 'Granularity' => $options['granularity'], 'StartTime' => Serialize::iso8601DateTime($options['startTime']), 'EndTime' => Serialize::iso8601DateTime($options['endTime']), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new UsageRecordPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of UsageRecordInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return UsageRecordPage Page of UsageRecordInstance */ public function getPage(string $targetUrl): UsageRecordPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new UsageRecordPage($this->version, $response, $this->solution); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Supersim.V1.UsageRecordList]'; } }src/Twilio/Rest/Supersim/V1/SimContext.php000064400000007656150515725670014455 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Sims/' . \rawurlencode($sid) . ''; } /** * Fetch the SimInstance * * @return SimInstance Fetched SimInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SimInstance { $payload = $this->version->fetch('GET', $this->uri); return new SimInstance($this->version, $payload, $this->solution['sid']); } /** * Update the SimInstance * * @param array|Options $options Optional Arguments * @return SimInstance Updated SimInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SimInstance { $options = new Values($options); $data = Values::of([ 'UniqueName' => $options['uniqueName'], 'Status' => $options['status'], 'Fleet' => $options['fleet'], 'CallbackUrl' => $options['callbackUrl'], 'CallbackMethod' => $options['callbackMethod'], 'AccountSid' => $options['accountSid'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new SimInstance($this->version, $payload, $this->solution['sid']); } /** * Access the billingPeriods */ protected function getBillingPeriods(): BillingPeriodList { if (!$this->_billingPeriods) { $this->_billingPeriods = new BillingPeriodList($this->version, $this->solution['sid']); } return $this->_billingPeriods; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Supersim.V1.SimContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Supersim/V1/IpCommandInstance.php000064400000007661150515725670015710 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'simSid' => Values::array_get($payload, 'sim_sid'), 'simIccid' => Values::array_get($payload, 'sim_iccid'), 'status' => Values::array_get($payload, 'status'), 'direction' => Values::array_get($payload, 'direction'), 'deviceIp' => Values::array_get($payload, 'device_ip'), 'devicePort' => Values::array_get($payload, 'device_port'), 'payloadType' => Values::array_get($payload, 'payload_type'), 'payload' => Values::array_get($payload, 'payload'), '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 = ['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 IpCommandContext Context for this IpCommandInstance */ protected function proxy(): IpCommandContext { if (!$this->context) { $this->context = new IpCommandContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the IpCommandInstance * * @return IpCommandInstance Fetched IpCommandInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): IpCommandInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Supersim.V1.IpCommandInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Supersim/V1/FleetOptions.php000064400000047026150515725670014766 0ustar00options['uniqueName'] = $uniqueName; $this->options['dataEnabled'] = $dataEnabled; $this->options['dataLimit'] = $dataLimit; $this->options['commandsEnabled'] = $commandsEnabled; $this->options['commandsUrl'] = $commandsUrl; $this->options['commandsMethod'] = $commandsMethod; $this->options['smsCommandsEnabled'] = $smsCommandsEnabled; $this->options['smsCommandsUrl'] = $smsCommandsUrl; $this->options['smsCommandsMethod'] = $smsCommandsMethod; } /** * An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. * * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * Defines whether SIMs in the Fleet are capable of using 2G/3G/4G/LTE/CAT-M data connectivity. Defaults to `true`. * * @param bool $dataEnabled Defines whether SIMs in the Fleet are capable of * using data connectivity * @return $this Fluent Builder */ public function setDataEnabled(bool $dataEnabled): self { $this->options['dataEnabled'] = $dataEnabled; return $this; } /** * The total data usage (download and upload combined) in Megabytes that each Sim resource assigned to the Fleet resource can consume during a billing period (normally one month). Value must be between 1MB (1) and 2TB (2,000,000). Defaults to 1GB (1,000). * * @param int $dataLimit The total data usage (download and upload combined) in * Megabytes that each Sim resource assigned to the Fleet * resource can consume * @return $this Fluent Builder */ public function setDataLimit(int $dataLimit): self { $this->options['dataLimit'] = $dataLimit; return $this; } /** * Defines whether SIMs in the Fleet are capable of sending and receiving machine-to-machine SMS via Commands. Defaults to `true`. * * @param bool $commandsEnabled Defines whether SIMs in the Fleet are capable * of sending and receiving machine-to-machine SMS * via Commands * @return $this Fluent Builder */ public function setCommandsEnabled(bool $commandsEnabled): self { $this->options['commandsEnabled'] = $commandsEnabled; return $this; } /** * The URL that will receive a webhook when a Super SIM in the Fleet is used to send an SMS from your device to the Commands number. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. * * @param string $commandsUrl The URL that will receive a webhook when a Super * SIM in the Fleet is used to send an SMS from your * device to the Commands number * @return $this Fluent Builder */ public function setCommandsUrl(string $commandsUrl): self { $this->options['commandsUrl'] = $commandsUrl; return $this; } /** * A string representing the HTTP method to use when making a request to `commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`. * * @param string $commandsMethod A string representing the HTTP method to use * when making a request to `commands_url` * @return $this Fluent Builder */ public function setCommandsMethod(string $commandsMethod): self { $this->options['commandsMethod'] = $commandsMethod; return $this; } /** * Defines whether SIMs in the Fleet are capable of sending and receiving machine-to-machine SMS via Commands. Defaults to `true`. * * @param bool $smsCommandsEnabled Defines whether SIMs in the Fleet are * capable of sending and receiving * machine-to-machine SMS via Commands * @return $this Fluent Builder */ public function setSmsCommandsEnabled(bool $smsCommandsEnabled): self { $this->options['smsCommandsEnabled'] = $smsCommandsEnabled; return $this; } /** * The URL that will receive a webhook when a Super SIM in the Fleet is used to send an SMS from your device to the SMS Commands number. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. * * @param string $smsCommandsUrl The URL that will receive a webhook when a * Super SIM in the Fleet is used to send an SMS * from your device to the SMS Commands number * @return $this Fluent Builder */ public function setSmsCommandsUrl(string $smsCommandsUrl): self { $this->options['smsCommandsUrl'] = $smsCommandsUrl; return $this; } /** * A string representing the HTTP method to use when making a request to `sms_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`. * * @param string $smsCommandsMethod A string representing the HTTP method to * use when making a request to * `sms_commands_url` * @return $this Fluent Builder */ public function setSmsCommandsMethod(string $smsCommandsMethod): self { $this->options['smsCommandsMethod'] = $smsCommandsMethod; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Supersim.V1.CreateFleetOptions ' . $options . ']'; } } class ReadFleetOptions extends Options { /** * @param string $networkAccessProfile The SID or unique name of the Network * Access Profile of the Fleet */ public function __construct(string $networkAccessProfile = Values::NONE) { $this->options['networkAccessProfile'] = $networkAccessProfile; } /** * The SID or unique name of the Network Access Profile that controls which cellular networks the Fleet's SIMs can connect to. * * @param string $networkAccessProfile The SID or unique name of the Network * Access Profile of the Fleet * @return $this Fluent Builder */ public function setNetworkAccessProfile(string $networkAccessProfile): self { $this->options['networkAccessProfile'] = $networkAccessProfile; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Supersim.V1.ReadFleetOptions ' . $options . ']'; } } class UpdateFleetOptions extends Options { /** * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @param string $networkAccessProfile The SID or unique name of the Network * Access Profile of the Fleet * @param string $commandsUrl The URL that will receive a webhook when a Super * SIM in the Fleet is used to send an SMS from your * device to the Commands number * @param string $commandsMethod A string representing the HTTP method to use * when making a request to `commands_url` * @param string $smsCommandsUrl The URL that will receive a webhook when a * Super SIM in the Fleet is used to send an SMS * from your device to the SMS Commands number * @param string $smsCommandsMethod A string representing the HTTP method to * use when making a request to * `sms_commands_url` */ public function __construct(string $uniqueName = Values::NONE, string $networkAccessProfile = Values::NONE, string $commandsUrl = Values::NONE, string $commandsMethod = Values::NONE, string $smsCommandsUrl = Values::NONE, string $smsCommandsMethod = Values::NONE) { $this->options['uniqueName'] = $uniqueName; $this->options['networkAccessProfile'] = $networkAccessProfile; $this->options['commandsUrl'] = $commandsUrl; $this->options['commandsMethod'] = $commandsMethod; $this->options['smsCommandsUrl'] = $smsCommandsUrl; $this->options['smsCommandsMethod'] = $smsCommandsMethod; } /** * An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. * * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * The SID or unique name of the Network Access Profile that will control which cellular networks the Fleet's SIMs can connect to. * * @param string $networkAccessProfile The SID or unique name of the Network * Access Profile of the Fleet * @return $this Fluent Builder */ public function setNetworkAccessProfile(string $networkAccessProfile): self { $this->options['networkAccessProfile'] = $networkAccessProfile; return $this; } /** * The URL that will receive a webhook when a Super SIM in the Fleet is used to send an SMS from your device to the Commands number. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. * * @param string $commandsUrl The URL that will receive a webhook when a Super * SIM in the Fleet is used to send an SMS from your * device to the Commands number * @return $this Fluent Builder */ public function setCommandsUrl(string $commandsUrl): self { $this->options['commandsUrl'] = $commandsUrl; return $this; } /** * A string representing the HTTP method to use when making a request to `commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`. * * @param string $commandsMethod A string representing the HTTP method to use * when making a request to `commands_url` * @return $this Fluent Builder */ public function setCommandsMethod(string $commandsMethod): self { $this->options['commandsMethod'] = $commandsMethod; return $this; } /** * The URL that will receive a webhook when a Super SIM in the Fleet is used to send an SMS from your device to the SMS Commands number. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. * * @param string $smsCommandsUrl The URL that will receive a webhook when a * Super SIM in the Fleet is used to send an SMS * from your device to the SMS Commands number * @return $this Fluent Builder */ public function setSmsCommandsUrl(string $smsCommandsUrl): self { $this->options['smsCommandsUrl'] = $smsCommandsUrl; return $this; } /** * A string representing the HTTP method to use when making a request to `sms_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`. * * @param string $smsCommandsMethod A string representing the HTTP method to * use when making a request to * `sms_commands_url` * @return $this Fluent Builder */ public function setSmsCommandsMethod(string $smsCommandsMethod): self { $this->options['smsCommandsMethod'] = $smsCommandsMethod; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Supersim.V1.UpdateFleetOptions ' . $options . ']'; } }src/Twilio/Rest/Supersim/V1/SimList.php000064400000013511150515725670013727 0ustar00solution = []; $this->uri = '/Sims'; } /** * Create the SimInstance * * @param string $iccid The * [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) of the Super SIM to be added to your Account * @param string $registrationCode The 10-digit code required to claim the * Super SIM for your Account * @return SimInstance Created SimInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $iccid, string $registrationCode): SimInstance { $data = Values::of(['Iccid' => $iccid, 'RegistrationCode' => $registrationCode, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new SimInstance($this->version, $payload); } /** * Streams SimInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads SimInstance 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 SimInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of SimInstance 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 SimPage Page of SimInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SimPage { $options = new Values($options); $params = Values::of([ 'Status' => $options['status'], 'Fleet' => $options['fleet'], 'Iccid' => $options['iccid'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new SimPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of SimInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return SimPage Page of SimInstance */ public function getPage(string $targetUrl): SimPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new SimPage($this->version, $response, $this->solution); } /** * Constructs a SimContext * * @param string $sid The SID that identifies the resource to fetch */ public function getContext(string $sid): SimContext { return new SimContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Supersim.V1.SimList]'; } }src/Twilio/Rest/Supersim/V1/CommandContext.php000064400000003110150515725670015260 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Commands/' . \rawurlencode($sid) . ''; } /** * Fetch the CommandInstance * * @return CommandInstance Fetched CommandInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CommandInstance { $payload = $this->version->fetch('GET', $this->uri); return new CommandInstance($this->version, $payload, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Supersim.V1.CommandContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Supersim/V1/NetworkInstance.php000064400000006100150515725670015455 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'url' => Values::array_get($payload, 'url'), 'isoCountry' => Values::array_get($payload, 'iso_country'), 'identifiers' => Values::array_get($payload, 'identifiers'), ]; $this->solution = ['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 NetworkContext Context for this NetworkInstance */ protected function proxy(): NetworkContext { if (!$this->context) { $this->context = new NetworkContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the NetworkInstance * * @return NetworkInstance Fetched NetworkInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): NetworkInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Supersim.V1.NetworkInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Supersim/V1/NetworkAccessProfileList.php000064400000013256150515725670017301 0ustar00solution = []; $this->uri = '/NetworkAccessProfiles'; } /** * Create the NetworkAccessProfileInstance * * @param array|Options $options Optional Arguments * @return NetworkAccessProfileInstance Created NetworkAccessProfileInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): NetworkAccessProfileInstance { $options = new Values($options); $data = Values::of([ 'UniqueName' => $options['uniqueName'], 'Networks' => Serialize::map($options['networks'], function($e) { return $e; }), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new NetworkAccessProfileInstance($this->version, $payload); } /** * Streams NetworkAccessProfileInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads NetworkAccessProfileInstance 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 NetworkAccessProfileInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of NetworkAccessProfileInstance 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 NetworkAccessProfilePage Page of NetworkAccessProfileInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): NetworkAccessProfilePage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new NetworkAccessProfilePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of NetworkAccessProfileInstance records from the * API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return NetworkAccessProfilePage Page of NetworkAccessProfileInstance */ public function getPage(string $targetUrl): NetworkAccessProfilePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new NetworkAccessProfilePage($this->version, $response, $this->solution); } /** * Constructs a NetworkAccessProfileContext * * @param string $sid The SID that identifies the resource to fetch */ public function getContext(string $sid): NetworkAccessProfileContext { return new NetworkAccessProfileContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Supersim.V1.NetworkAccessProfileList]'; } }src/Twilio/Rest/Supersim/V1/UsageRecordOptions.php000064400000020466150515725670016131 0ustar00options['sim'] = $sim; $this->options['fleet'] = $fleet; $this->options['network'] = $network; $this->options['isoCountry'] = $isoCountry; $this->options['group'] = $group; $this->options['granularity'] = $granularity; $this->options['startTime'] = $startTime; $this->options['endTime'] = $endTime; } /** * SID or unique name of a Sim resource. Only show UsageRecords representing usage incurred by this Super SIM. * * @param string $sim SID or unique name of a Sim resource. Only show * UsageRecords representing usage incurred by this Super * SIM. * @return $this Fluent Builder */ public function setSim(string $sim): self { $this->options['sim'] = $sim; return $this; } /** * SID or unique name of a Fleet resource. Only show UsageRecords representing usage for Super SIMs belonging to this Fleet resource at the time the usage occurred. * * @param string $fleet SID or unique name of a Fleet resource. Only show * UsageRecords representing usage for Super SIMs * belonging to this Fleet resource at the time the usage * occurred. * @return $this Fluent Builder */ public function setFleet(string $fleet): self { $this->options['fleet'] = $fleet; return $this; } /** * SID of a Network resource. Only show UsageRecords representing usage on this network. * * @param string $network SID of a Network resource. Only show UsageRecords * representing usage on this network. * @return $this Fluent Builder */ public function setNetwork(string $network): self { $this->options['network'] = $network; return $this; } /** * Alpha-2 ISO Country Code. Only show UsageRecords representing usage in this country. * * @param string $isoCountry Alpha-2 ISO Country Code. Only show UsageRecords * representing usage in this country. * @return $this Fluent Builder */ public function setIsoCountry(string $isoCountry): self { $this->options['isoCountry'] = $isoCountry; return $this; } /** * Dimension over which to aggregate usage records. Can be: `sim`, `fleet`, `network`, `isoCountry`. Default is to not aggregate across any of these dimensions, UsageRecords will be aggregated into the time buckets described by the `Granularity` parameter. * * @param string $group Dimension over which to aggregate usage records. * @return $this Fluent Builder */ public function setGroup(string $group): self { $this->options['group'] = $group; return $this; } /** * Time-based grouping that UsageRecords should be aggregated by. Can be: `hour`, `day`, or `all`. Default is `all`. `all` returns one UsageRecord that describes the usage for the entire period. * * @param string $granularity Time-based grouping that UsageRecords should be * aggregated by. Can be: `hour`, `day`, or `all`. * Default is `all`. * @return $this Fluent Builder */ public function setGranularity(string $granularity): self { $this->options['granularity'] = $granularity; return $this; } /** * Only include usage that occurred at or after this time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is one month before the `end_time`. * * @param \DateTime $startTime Only include usage that occurred at or after * this time. * @return $this Fluent Builder */ public function setStartTime(\DateTime $startTime): self { $this->options['startTime'] = $startTime; return $this; } /** * Only include usage that occurred before this time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Default is the current time. * * @param \DateTime $endTime Only include usage that occurred before this time. * @return $this Fluent Builder */ public function setEndTime(\DateTime $endTime): self { $this->options['endTime'] = $endTime; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Supersim.V1.ReadUsageRecordOptions ' . $options . ']'; } }src/Twilio/Rest/Supersim/V1/Sim/BillingPeriodPage.php000064400000002306150515725670016413 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return BillingPeriodInstance \Twilio\Rest\Supersim\V1\Sim\BillingPeriodInstance */ public function buildInstance(array $payload): BillingPeriodInstance { return new BillingPeriodInstance($this->version, $payload, $this->solution['simSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Supersim.V1.BillingPeriodPage]'; } }src/Twilio/Rest/Supersim/V1/Sim/BillingPeriodInstance.php000064400000005032150515725670017302 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'simSid' => Values::array_get($payload, 'sim_sid'), 'startTime' => Deserialize::dateTime(Values::array_get($payload, 'start_time')), 'endTime' => Deserialize::dateTime(Values::array_get($payload, 'end_time')), 'periodType' => Values::array_get($payload, 'period_type'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), ]; $this->solution = ['simSid' => $simSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Supersim.V1.BillingPeriodInstance]'; } }src/Twilio/Rest/Supersim/V1/Sim/BillingPeriodList.php000064400000011006150515725670016447 0ustar00solution = ['simSid' => $simSid, ]; $this->uri = '/Sims/' . \rawurlencode($simSid) . '/BillingPeriods'; } /** * Streams BillingPeriodInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads BillingPeriodInstance 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 BillingPeriodInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of BillingPeriodInstance 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 BillingPeriodPage Page of BillingPeriodInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): BillingPeriodPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new BillingPeriodPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of BillingPeriodInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return BillingPeriodPage Page of BillingPeriodInstance */ public function getPage(string $targetUrl): BillingPeriodPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new BillingPeriodPage($this->version, $response, $this->solution); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Supersim.V1.BillingPeriodList]'; } }src/Twilio/Rest/Supersim/V1/SmsCommandList.php000064400000014126150515725670015243 0ustar00solution = []; $this->uri = '/SmsCommands'; } /** * Create the SmsCommandInstance * * @param string $sim The sid or unique_name of the SIM to send the SMS Command * to * @param string $payload The message body of the SMS Command * @param array|Options $options Optional Arguments * @return SmsCommandInstance Created SmsCommandInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $sim, string $payload, array $options = []): SmsCommandInstance { $options = new Values($options); $data = Values::of([ 'Sim' => $sim, 'Payload' => $payload, 'CallbackMethod' => $options['callbackMethod'], 'CallbackUrl' => $options['callbackUrl'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new SmsCommandInstance($this->version, $payload); } /** * Streams SmsCommandInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads SmsCommandInstance 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 SmsCommandInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of SmsCommandInstance 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 SmsCommandPage Page of SmsCommandInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SmsCommandPage { $options = new Values($options); $params = Values::of([ 'Sim' => $options['sim'], 'Status' => $options['status'], 'Direction' => $options['direction'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new SmsCommandPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of SmsCommandInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return SmsCommandPage Page of SmsCommandInstance */ public function getPage(string $targetUrl): SmsCommandPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new SmsCommandPage($this->version, $response, $this->solution); } /** * Constructs a SmsCommandContext * * @param string $sid The SID that identifies the resource to fetch */ public function getContext(string $sid): SmsCommandContext { return new SmsCommandContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Supersim.V1.SmsCommandList]'; } }src/Twilio/Rest/Supersim/V1/FleetInstance.php000064400000011331150515725670015065 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'sid' => Values::array_get($payload, 'sid'), 'uniqueName' => Values::array_get($payload, 'unique_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'), 'dataEnabled' => Values::array_get($payload, 'data_enabled'), 'dataLimit' => Values::array_get($payload, 'data_limit'), 'dataMetering' => Values::array_get($payload, 'data_metering'), 'commandsEnabled' => Values::array_get($payload, 'commands_enabled'), 'commandsUrl' => Values::array_get($payload, 'commands_url'), 'commandsMethod' => Values::array_get($payload, 'commands_method'), 'smsCommandsEnabled' => Values::array_get($payload, 'sms_commands_enabled'), 'smsCommandsUrl' => Values::array_get($payload, 'sms_commands_url'), 'smsCommandsMethod' => Values::array_get($payload, 'sms_commands_method'), 'networkAccessProfileSid' => Values::array_get($payload, 'network_access_profile_sid'), ]; $this->solution = ['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 FleetContext Context for this FleetInstance */ protected function proxy(): FleetContext { if (!$this->context) { $this->context = new FleetContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the FleetInstance * * @return FleetInstance Fetched FleetInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FleetInstance { return $this->proxy()->fetch(); } /** * Update the FleetInstance * * @param array|Options $options Optional Arguments * @return FleetInstance Updated FleetInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): FleetInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Supersim.V1.FleetInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Supersim/V1/IpCommandPage.php000064400000002374150515725670015014 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return IpCommandInstance \Twilio\Rest\Supersim\V1\IpCommandInstance */ public function buildInstance(array $payload): IpCommandInstance { return new IpCommandInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Supersim.V1.IpCommandPage]'; } }src/Twilio/Rest/Supersim/V1/SmsCommandOptions.php000064400000012460150515725670015762 0ustar00options['callbackMethod'] = $callbackMethod; $this->options['callbackUrl'] = $callbackUrl; } /** * The HTTP method we should use to call `callback_url`. Can be: `GET` or `POST` and the default is POST. * * @param string $callbackMethod The HTTP method we should use to call * callback_url * @return $this Fluent Builder */ public function setCallbackMethod(string $callbackMethod): self { $this->options['callbackMethod'] = $callbackMethod; return $this; } /** * The URL we should call using the `callback_method` after we have sent the command. * * @param string $callbackUrl The URL we should call after we have sent the * command * @return $this Fluent Builder */ public function setCallbackUrl(string $callbackUrl): self { $this->options['callbackUrl'] = $callbackUrl; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Supersim.V1.CreateSmsCommandOptions ' . $options . ']'; } } class ReadSmsCommandOptions extends Options { /** * @param string $sim The SID or unique name of the Sim resource that SMS * Command was sent to or from. * @param string $status The status of the SMS Command * @param string $direction The direction of the SMS Command */ public function __construct(string $sim = Values::NONE, string $status = Values::NONE, string $direction = Values::NONE) { $this->options['sim'] = $sim; $this->options['status'] = $status; $this->options['direction'] = $direction; } /** * The SID or unique name of the Sim resource that SMS Command was sent to or from. * * @param string $sim The SID or unique name of the Sim resource that SMS * Command was sent to or from. * @return $this Fluent Builder */ public function setSim(string $sim): self { $this->options['sim'] = $sim; return $this; } /** * The status of the SMS Command. Can be: `queued`, `sent`, `delivered`, `received` or `failed`. See the [SMS Command Status Values](https://www.twilio.com/docs/wireless/api/smscommand-resource#status-values) for a description of each. * * @param string $status The status of the SMS Command * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * The direction of the SMS Command. Can be `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term `mobile terminated`, and `from_sim` is synonymous with the term `mobile originated`. * * @param string $direction The direction of the SMS Command * @return $this Fluent Builder */ public function setDirection(string $direction): self { $this->options['direction'] = $direction; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Supersim.V1.ReadSmsCommandOptions ' . $options . ']'; } }src/Twilio/Rest/Supersim/V1/NetworkAccessProfileOptions.php000064400000007700150515725670020016 0ustar00options['uniqueName'] = $uniqueName; $this->options['networks'] = $networks; } /** * An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. * * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * List of Network SIDs that this Network Access Profile will allow connections to. * * @param string[] $networks List of Network SIDs that this Network Access * Profile will allow connections to * @return $this Fluent Builder */ public function setNetworks(array $networks): self { $this->options['networks'] = $networks; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Supersim.V1.CreateNetworkAccessProfileOptions ' . $options . ']'; } } class UpdateNetworkAccessProfileOptions extends Options { /** * @param string $uniqueName The new unique name of the resource */ public function __construct(string $uniqueName = Values::NONE) { $this->options['uniqueName'] = $uniqueName; } /** * The new unique name of the Network Access Profile. * * @param string $uniqueName The new unique name of the resource * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Supersim.V1.UpdateNetworkAccessProfileOptions ' . $options . ']'; } }src/Twilio/Rest/Supersim/V1/UsageRecordPage.php000064400000002410150515725670015337 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return UsageRecordInstance \Twilio\Rest\Supersim\V1\UsageRecordInstance */ public function buildInstance(array $payload): UsageRecordInstance { return new UsageRecordInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Supersim.V1.UsageRecordPage]'; } }src/Twilio/Rest/Supersim/V1/FleetContext.php000064400000004715150515725670014755 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Fleets/' . \rawurlencode($sid) . ''; } /** * Fetch the FleetInstance * * @return FleetInstance Fetched FleetInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FleetInstance { $payload = $this->version->fetch('GET', $this->uri); return new FleetInstance($this->version, $payload, $this->solution['sid']); } /** * Update the FleetInstance * * @param array|Options $options Optional Arguments * @return FleetInstance Updated FleetInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): FleetInstance { $options = new Values($options); $data = Values::of([ 'UniqueName' => $options['uniqueName'], 'NetworkAccessProfile' => $options['networkAccessProfile'], 'CommandsUrl' => $options['commandsUrl'], 'CommandsMethod' => $options['commandsMethod'], 'SmsCommandsUrl' => $options['smsCommandsUrl'], 'SmsCommandsMethod' => $options['smsCommandsMethod'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new FleetInstance($this->version, $payload, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Supersim.V1.FleetContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Supersim/V1/CommandInstance.php000064400000007007150515725670015411 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'simSid' => Values::array_get($payload, 'sim_sid'), 'command' => Values::array_get($payload, 'command'), 'status' => Values::array_get($payload, 'status'), 'direction' => Values::array_get($payload, 'direction'), '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 = ['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 CommandContext Context for this CommandInstance */ protected function proxy(): CommandContext { if (!$this->context) { $this->context = new CommandContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the CommandInstance * * @return CommandInstance Fetched CommandInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CommandInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Supersim.V1.CommandInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Supersim/V1/CommandList.php000064400000013751150515725670014563 0ustar00solution = []; $this->uri = '/Commands'; } /** * Create the CommandInstance * * @param string $sim The sid or unique_name of the SIM to send the Command to * @param string $command The message body of the command * @param array|Options $options Optional Arguments * @return CommandInstance Created CommandInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $sim, string $command, array $options = []): CommandInstance { $options = new Values($options); $data = Values::of([ 'Sim' => $sim, 'Command' => $command, 'CallbackMethod' => $options['callbackMethod'], 'CallbackUrl' => $options['callbackUrl'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new CommandInstance($this->version, $payload); } /** * Streams CommandInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param array|Options $options Optional Arguments * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads CommandInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param array|Options $options Optional Arguments * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return CommandInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of CommandInstance records from the API. * Request is executed immediately * * @param array|Options $options Optional Arguments * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return CommandPage Page of CommandInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): CommandPage { $options = new Values($options); $params = Values::of([ 'Sim' => $options['sim'], 'Status' => $options['status'], 'Direction' => $options['direction'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new CommandPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of CommandInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return CommandPage Page of CommandInstance */ public function getPage(string $targetUrl): CommandPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new CommandPage($this->version, $response, $this->solution); } /** * Constructs a CommandContext * * @param string $sid The SID that identifies the resource to fetch */ public function getContext(string $sid): CommandContext { return new CommandContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Supersim.V1.CommandList]'; } }src/Twilio/Rest/Supersim/V1/NetworkList.php000064400000012121150515725670014624 0ustar00solution = []; $this->uri = '/Networks'; } /** * Streams NetworkInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads NetworkInstance 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 NetworkInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of NetworkInstance 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 NetworkPage Page of NetworkInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): NetworkPage { $options = new Values($options); $params = Values::of([ 'IsoCountry' => $options['isoCountry'], 'Mcc' => $options['mcc'], 'Mnc' => $options['mnc'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new NetworkPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of NetworkInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return NetworkPage Page of NetworkInstance */ public function getPage(string $targetUrl): NetworkPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new NetworkPage($this->version, $response, $this->solution); } /** * Constructs a NetworkContext * * @param string $sid The SID of the Network resource to fetch */ public function getContext(string $sid): NetworkContext { return new NetworkContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Supersim.V1.NetworkList]'; } }src/Twilio/Rest/Supersim/V1/SmsCommandInstance.php000064400000007050150515725670016072 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'simSid' => Values::array_get($payload, 'sim_sid'), 'payload' => Values::array_get($payload, 'payload'), 'status' => Values::array_get($payload, 'status'), 'direction' => Values::array_get($payload, 'direction'), '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 = ['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 SmsCommandContext Context for this SmsCommandInstance */ protected function proxy(): SmsCommandContext { if (!$this->context) { $this->context = new SmsCommandContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the SmsCommandInstance * * @return SmsCommandInstance Fetched SmsCommandInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SmsCommandInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Supersim.V1.SmsCommandInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Supersim/V1/NetworkAccessProfile/NetworkAccessProfileNetworkContext.php000064400000004757150515725670025466 0ustar00solution = ['networkAccessProfileSid' => $networkAccessProfileSid, 'sid' => $sid, ]; $this->uri = '/NetworkAccessProfiles/' . \rawurlencode($networkAccessProfileSid) . '/Networks/' . \rawurlencode($sid) . ''; } /** * Delete the NetworkAccessProfileNetworkInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Fetch the NetworkAccessProfileNetworkInstance * * @return NetworkAccessProfileNetworkInstance Fetched * NetworkAccessProfileNetworkInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): NetworkAccessProfileNetworkInstance { $payload = $this->version->fetch('GET', $this->uri); return new NetworkAccessProfileNetworkInstance( $this->version, $payload, $this->solution['networkAccessProfileSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Supersim.V1.NetworkAccessProfileNetworkContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Supersim/V1/NetworkAccessProfile/NetworkAccessProfileNetworkInstance.php000064400000010275150515725670025576 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'networkAccessProfileSid' => Values::array_get($payload, 'network_access_profile_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'isoCountry' => Values::array_get($payload, 'iso_country'), 'identifiers' => Values::array_get($payload, 'identifiers'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'networkAccessProfileSid' => $networkAccessProfileSid, '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 NetworkAccessProfileNetworkContext Context for this * NetworkAccessProfileNetworkInstance */ protected function proxy(): NetworkAccessProfileNetworkContext { if (!$this->context) { $this->context = new NetworkAccessProfileNetworkContext( $this->version, $this->solution['networkAccessProfileSid'], $this->solution['sid'] ); } return $this->context; } /** * Delete the NetworkAccessProfileNetworkInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Fetch the NetworkAccessProfileNetworkInstance * * @return NetworkAccessProfileNetworkInstance Fetched * NetworkAccessProfileNetworkInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): NetworkAccessProfileNetworkInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Supersim.V1.NetworkAccessProfileNetworkInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Supersim/V1/NetworkAccessProfile/NetworkAccessProfileNetworkPage.php000064400000002754150515725670024711 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return NetworkAccessProfileNetworkInstance \Twilio\Rest\Supersim\V1\NetworkAccessProfile\NetworkAccessProfileNetworkInstance */ public function buildInstance(array $payload): NetworkAccessProfileNetworkInstance { return new NetworkAccessProfileNetworkInstance( $this->version, $payload, $this->solution['networkAccessProfileSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Supersim.V1.NetworkAccessProfileNetworkPage]'; } }src/Twilio/Rest/Supersim/V1/NetworkAccessProfile/NetworkAccessProfileNetworkList.php000064400000014425150515725670024746 0ustar00solution = ['networkAccessProfileSid' => $networkAccessProfileSid, ]; $this->uri = '/NetworkAccessProfiles/' . \rawurlencode($networkAccessProfileSid) . '/Networks'; } /** * Streams NetworkAccessProfileNetworkInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads NetworkAccessProfileNetworkInstance 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 NetworkAccessProfileNetworkInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of NetworkAccessProfileNetworkInstance 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 NetworkAccessProfileNetworkPage Page of * NetworkAccessProfileNetworkInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): NetworkAccessProfileNetworkPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new NetworkAccessProfileNetworkPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of NetworkAccessProfileNetworkInstance records from * the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return NetworkAccessProfileNetworkPage Page of * NetworkAccessProfileNetworkInstance */ public function getPage(string $targetUrl): NetworkAccessProfileNetworkPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new NetworkAccessProfileNetworkPage($this->version, $response, $this->solution); } /** * Create the NetworkAccessProfileNetworkInstance * * @param string $network The SID that identifies the Network resource * @return NetworkAccessProfileNetworkInstance Created * NetworkAccessProfileNetworkInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $network): NetworkAccessProfileNetworkInstance { $data = Values::of(['Network' => $network, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new NetworkAccessProfileNetworkInstance( $this->version, $payload, $this->solution['networkAccessProfileSid'] ); } /** * Constructs a NetworkAccessProfileNetworkContext * * @param string $sid The SID of the resource to fetch */ public function getContext(string $sid): NetworkAccessProfileNetworkContext { return new NetworkAccessProfileNetworkContext( $this->version, $this->solution['networkAccessProfileSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Supersim.V1.NetworkAccessProfileNetworkList]'; } }src/Twilio/Rest/Supersim/V1/NetworkAccessProfilePage.php000064400000002476150515725670017244 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return NetworkAccessProfileInstance \Twilio\Rest\Supersim\V1\NetworkAccessProfileInstance */ public function buildInstance(array $payload): NetworkAccessProfileInstance { return new NetworkAccessProfileInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Supersim.V1.NetworkAccessProfilePage]'; } }src/Twilio/Rest/Supersim/V1/IpCommandContext.php000064400000003132150515725670015555 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/IpCommands/' . \rawurlencode($sid) . ''; } /** * Fetch the IpCommandInstance * * @return IpCommandInstance Fetched IpCommandInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): IpCommandInstance { $payload = $this->version->fetch('GET', $this->uri); return new IpCommandInstance($this->version, $payload, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Supersim.V1.IpCommandContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Supersim/V1/NetworkContext.php000064400000003103150515725670015335 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Networks/' . \rawurlencode($sid) . ''; } /** * Fetch the NetworkInstance * * @return NetworkInstance Fetched NetworkInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): NetworkInstance { $payload = $this->version->fetch('GET', $this->uri); return new NetworkInstance($this->version, $payload, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Supersim.V1.NetworkContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Supersim/V1/NetworkAccessProfileContext.php000064400000010034150515725670020001 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/NetworkAccessProfiles/' . \rawurlencode($sid) . ''; } /** * Fetch the NetworkAccessProfileInstance * * @return NetworkAccessProfileInstance Fetched NetworkAccessProfileInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): NetworkAccessProfileInstance { $payload = $this->version->fetch('GET', $this->uri); return new NetworkAccessProfileInstance($this->version, $payload, $this->solution['sid']); } /** * Update the NetworkAccessProfileInstance * * @param array|Options $options Optional Arguments * @return NetworkAccessProfileInstance Updated NetworkAccessProfileInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): NetworkAccessProfileInstance { $options = new Values($options); $data = Values::of(['UniqueName' => $options['uniqueName'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new NetworkAccessProfileInstance($this->version, $payload, $this->solution['sid']); } /** * Access the networks */ protected function getNetworks(): NetworkAccessProfileNetworkList { if (!$this->_networks) { $this->_networks = new NetworkAccessProfileNetworkList($this->version, $this->solution['sid']); } return $this->_networks; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Supersim.V1.NetworkAccessProfileContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Supersim/V1/SimInstance.php000064400000010222150515725670014554 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'iccid' => Values::array_get($payload, 'iccid'), 'status' => Values::array_get($payload, 'status'), 'fleetSid' => Values::array_get($payload, 'fleet_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 SimContext Context for this SimInstance */ protected function proxy(): SimContext { if (!$this->context) { $this->context = new SimContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the SimInstance * * @return SimInstance Fetched SimInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SimInstance { return $this->proxy()->fetch(); } /** * Update the SimInstance * * @param array|Options $options Optional Arguments * @return SimInstance Updated SimInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SimInstance { return $this->proxy()->update($options); } /** * Access the billingPeriods */ protected function getBillingPeriods(): BillingPeriodList { return $this->proxy()->billingPeriods; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Supersim.V1.SimInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Supersim/V1.php000064400000011424150515725670012344 0ustar00version = 'v1'; } protected function getCommands(): CommandList { if (!$this->_commands) { $this->_commands = new CommandList($this); } return $this->_commands; } protected function getFleets(): FleetList { if (!$this->_fleets) { $this->_fleets = new FleetList($this); } return $this->_fleets; } protected function getIpCommands(): IpCommandList { if (!$this->_ipCommands) { $this->_ipCommands = new IpCommandList($this); } return $this->_ipCommands; } protected function getNetworks(): NetworkList { if (!$this->_networks) { $this->_networks = new NetworkList($this); } return $this->_networks; } protected function getNetworkAccessProfiles(): NetworkAccessProfileList { if (!$this->_networkAccessProfiles) { $this->_networkAccessProfiles = new NetworkAccessProfileList($this); } return $this->_networkAccessProfiles; } protected function getSims(): SimList { if (!$this->_sims) { $this->_sims = new SimList($this); } return $this->_sims; } protected function getSmsCommands(): SmsCommandList { if (!$this->_smsCommands) { $this->_smsCommands = new SmsCommandList($this); } return $this->_smsCommands; } protected function getUsageRecords(): UsageRecordList { if (!$this->_usageRecords) { $this->_usageRecords = new UsageRecordList($this); } return $this->_usageRecords; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Supersim.V1]'; } }src/Twilio/Rest/Preview/BulkExports/ExportContext.php000064400000007461150515725670017006 0ustar00solution = ['resourceType' => $resourceType, ]; $this->uri = '/Exports/' . \rawurlencode($resourceType) . ''; } /** * Fetch the ExportInstance * * @return ExportInstance Fetched ExportInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ExportInstance { $payload = $this->version->fetch('GET', $this->uri); return new ExportInstance($this->version, $payload, $this->solution['resourceType']); } /** * Access the days */ protected function getDays(): DayList { if (!$this->_days) { $this->_days = new DayList($this->version, $this->solution['resourceType']); } return $this->_days; } /** * Access the exportCustomJobs */ protected function getExportCustomJobs(): ExportCustomJobList { if (!$this->_exportCustomJobs) { $this->_exportCustomJobs = new ExportCustomJobList($this->version, $this->solution['resourceType']); } return $this->_exportCustomJobs; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.BulkExports.ExportContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/BulkExports/ExportConfigurationOptions.php000064400000005767150515725670021554 0ustar00options['enabled'] = $enabled; $this->options['webhookUrl'] = $webhookUrl; $this->options['webhookMethod'] = $webhookMethod; } /** * If true, Twilio will automatically generate every day's file when the day is over. * * @param bool $enabled Whether files are automatically generated * @return $this Fluent Builder */ public function setEnabled(bool $enabled): self { $this->options['enabled'] = $enabled; return $this; } /** * Stores the URL destination for the method specified in webhook_method. * * @param string $webhookUrl URL targeted at export * @return $this Fluent Builder */ public function setWebhookUrl(string $webhookUrl): self { $this->options['webhookUrl'] = $webhookUrl; return $this; } /** * Sets whether Twilio should call a webhook URL when the automatic generation is complete, using GET or POST. The actual destination is set in the webhook_url * * @param string $webhookMethod Whether to GET or POST to the webhook url * @return $this Fluent Builder */ public function setWebhookMethod(string $webhookMethod): self { $this->options['webhookMethod'] = $webhookMethod; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.BulkExports.UpdateExportConfigurationOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/BulkExports/ExportPage.php000064400000002534150515725670016232 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ExportInstance \Twilio\Rest\Preview\BulkExports\ExportInstance */ public function buildInstance(array $payload): ExportInstance { return new ExportInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.BulkExports.ExportPage]'; } }src/Twilio/Rest/Preview/BulkExports/ExportConfigurationList.php000064400000002537150515725670021024 0ustar00solution = []; } /** * Constructs a ExportConfigurationContext * * @param string $resourceType The type of communication – Messages, Calls, * Conferences, and Participants */ public function getContext(string $resourceType): ExportConfigurationContext { return new ExportConfigurationContext($this->version, $resourceType); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.BulkExports.ExportConfigurationList]'; } }src/Twilio/Rest/Preview/BulkExports/ExportConfigurationPage.php000064400000002652150515725670020763 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ExportConfigurationInstance \Twilio\Rest\Preview\BulkExports\ExportConfigurationInstance */ public function buildInstance(array $payload): ExportConfigurationInstance { return new ExportConfigurationInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.BulkExports.ExportConfigurationPage]'; } }src/Twilio/Rest/Preview/BulkExports/ExportConfigurationContext.php000064400000005337150515725670021536 0ustar00solution = ['resourceType' => $resourceType, ]; $this->uri = '/Exports/' . \rawurlencode($resourceType) . '/Configuration'; } /** * Fetch the ExportConfigurationInstance * * @return ExportConfigurationInstance Fetched ExportConfigurationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ExportConfigurationInstance { $payload = $this->version->fetch('GET', $this->uri); return new ExportConfigurationInstance($this->version, $payload, $this->solution['resourceType']); } /** * Update the ExportConfigurationInstance * * @param array|Options $options Optional Arguments * @return ExportConfigurationInstance Updated ExportConfigurationInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ExportConfigurationInstance { $options = new Values($options); $data = Values::of([ 'Enabled' => Serialize::booleanToString($options['enabled']), 'WebhookUrl' => $options['webhookUrl'], 'WebhookMethod' => $options['webhookMethod'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ExportConfigurationInstance($this->version, $payload, $this->solution['resourceType']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.BulkExports.ExportConfigurationContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/BulkExports/ExportList.php000064400000005515150515725670016273 0ustar00solution = []; } /** * Access the jobs */ protected function getJobs(): JobList { if (!$this->_jobs) { $this->_jobs = new JobList($this->version); } return $this->_jobs; } /** * Constructs a ExportContext * * @param string $resourceType The type of communication – Messages, Calls, * Conferences, and Participants */ public function getContext(string $resourceType): ExportContext { return new ExportContext($this->version, $resourceType); } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return \Twilio\ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Preview.BulkExports.ExportList]'; } }src/Twilio/Rest/Preview/BulkExports/Export/DayContext.php000064400000003723150515725670017520 0ustar00solution = ['resourceType' => $resourceType, 'day' => $day, ]; $this->uri = '/Exports/' . \rawurlencode($resourceType) . '/Days/' . \rawurlencode($day) . ''; } /** * Fetch the DayInstance * * @return DayInstance Fetched DayInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): DayInstance { $payload = $this->version->fetch('GET', $this->uri); return new DayInstance( $this->version, $payload, $this->solution['resourceType'], $this->solution['day'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.BulkExports.DayContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/BulkExports/Export/DayList.php000064400000011634150515725670017007 0ustar00solution = ['resourceType' => $resourceType, ]; $this->uri = '/Exports/' . \rawurlencode($resourceType) . '/Days'; } /** * Streams DayInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads DayInstance 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 DayInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of DayInstance 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 DayPage Page of DayInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): DayPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new DayPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of DayInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return DayPage Page of DayInstance */ public function getPage(string $targetUrl): DayPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new DayPage($this->version, $response, $this->solution); } /** * Constructs a DayContext * * @param string $day The date of the data in the file */ public function getContext(string $day): DayContext { return new DayContext($this->version, $this->solution['resourceType'], $day); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.BulkExports.DayList]'; } }src/Twilio/Rest/Preview/BulkExports/Export/JobContext.php000064400000003772150515725670017521 0ustar00solution = ['jobSid' => $jobSid, ]; $this->uri = '/Exports/Jobs/' . \rawurlencode($jobSid) . ''; } /** * Fetch the JobInstance * * @return JobInstance Fetched JobInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): JobInstance { $payload = $this->version->fetch('GET', $this->uri); return new JobInstance($this->version, $payload, $this->solution['jobSid']); } /** * Delete the JobInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.BulkExports.JobContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/BulkExports/Export/JobPage.php000064400000002530150515725670016740 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return JobInstance \Twilio\Rest\Preview\BulkExports\Export\JobInstance */ public function buildInstance(array $payload): JobInstance { return new JobInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.BulkExports.JobPage]'; } }src/Twilio/Rest/Preview/BulkExports/Export/ExportCustomJobInstance.php000064400000005466150515725670022240 0ustar00properties = [ 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'resourceType' => Values::array_get($payload, 'resource_type'), 'startDay' => Values::array_get($payload, 'start_day'), 'endDay' => Values::array_get($payload, 'end_day'), 'webhookUrl' => Values::array_get($payload, 'webhook_url'), 'webhookMethod' => Values::array_get($payload, 'webhook_method'), 'email' => Values::array_get($payload, 'email'), 'jobSid' => Values::array_get($payload, 'job_sid'), 'details' => Values::array_get($payload, 'details'), ]; $this->solution = ['resourceType' => $resourceType, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Preview.BulkExports.ExportCustomJobInstance]'; } }src/Twilio/Rest/Preview/BulkExports/Export/ExportCustomJobList.php000064400000014440150515725670021377 0ustar00solution = ['resourceType' => $resourceType, ]; $this->uri = '/Exports/' . \rawurlencode($resourceType) . '/Jobs'; } /** * Streams ExportCustomJobInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ExportCustomJobInstance 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 ExportCustomJobInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of ExportCustomJobInstance 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 ExportCustomJobPage Page of ExportCustomJobInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ExportCustomJobPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ExportCustomJobPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ExportCustomJobInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ExportCustomJobPage Page of ExportCustomJobInstance */ public function getPage(string $targetUrl): ExportCustomJobPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ExportCustomJobPage($this->version, $response, $this->solution); } /** * Create the ExportCustomJobInstance * * @param string $startDay The start day for the custom export specified as a * string in the format of yyyy-mm-dd * @param string $endDay The end day for the custom export specified as a * string in the format of yyyy-mm-dd. End day is * inclusive and must be 2 days earlier than the current * UTC day. * @param string $friendlyName The friendly name specified when creating the job * @param array|Options $options Optional Arguments * @return ExportCustomJobInstance Created ExportCustomJobInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $startDay, string $endDay, string $friendlyName, array $options = []): ExportCustomJobInstance { $options = new Values($options); $data = Values::of([ 'StartDay' => $startDay, 'EndDay' => $endDay, 'FriendlyName' => $friendlyName, 'WebhookUrl' => $options['webhookUrl'], 'WebhookMethod' => $options['webhookMethod'], 'Email' => $options['email'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ExportCustomJobInstance($this->version, $payload, $this->solution['resourceType']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.BulkExports.ExportCustomJobList]'; } }src/Twilio/Rest/Preview/BulkExports/Export/DayPage.php000064400000002571150515725670016750 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return DayInstance \Twilio\Rest\Preview\BulkExports\Export\DayInstance */ public function buildInstance(array $payload): DayInstance { return new DayInstance($this->version, $payload, $this->solution['resourceType']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.BulkExports.DayPage]'; } }src/Twilio/Rest/Preview/BulkExports/Export/DayInstance.php000064400000007021150515725670017633 0ustar00properties = [ 'redirectTo' => Values::array_get($payload, 'redirect_to'), 'day' => Values::array_get($payload, 'day'), 'size' => Values::array_get($payload, 'size'), 'createDate' => Values::array_get($payload, 'create_date'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'resourceType' => Values::array_get($payload, 'resource_type'), ]; $this->solution = ['resourceType' => $resourceType, 'day' => $day ?: $this->properties['day'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return DayContext Context for this DayInstance */ protected function proxy(): DayContext { if (!$this->context) { $this->context = new DayContext( $this->version, $this->solution['resourceType'], $this->solution['day'] ); } return $this->context; } /** * Fetch the DayInstance * * @return DayInstance Fetched DayInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): DayInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.BulkExports.DayInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/BulkExports/Export/JobList.php000064400000002350150515725670016777 0ustar00solution = []; } /** * Constructs a JobContext * * @param string $jobSid The unique string that that we created to identify the * Bulk Export job */ public function getContext(string $jobSid): JobContext { return new JobContext($this->version, $jobSid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.BulkExports.JobList]'; } }src/Twilio/Rest/Preview/BulkExports/Export/ExportCustomJobOptions.php000064400000010020150515725670022105 0ustar00options['webhookUrl'] = $webhookUrl; $this->options['webhookMethod'] = $webhookMethod; $this->options['email'] = $email; } /** * The optional webhook url called on completion of the job. If this is supplied, `WebhookMethod` must also be supplied. * * @param string $webhookUrl The optional webhook url called on completion of * the job. If this is supplied, `WebhookMethod` must * also be supplied. * @return $this Fluent Builder */ public function setWebhookUrl(string $webhookUrl): self { $this->options['webhookUrl'] = $webhookUrl; return $this; } /** * This is the method used to call the webhook on completion of the job. If this is supplied, `WebhookUrl` must also be supplied. * * @param string $webhookMethod This is the method used to call the webhook on * completion of the job. If this is supplied, * `WebhookUrl` must also be supplied. * @return $this Fluent Builder */ public function setWebhookMethod(string $webhookMethod): self { $this->options['webhookMethod'] = $webhookMethod; return $this; } /** * The optional email to send the completion notification to * * @param string $email The optional email to send the completion notification * to * @return $this Fluent Builder */ public function setEmail(string $email): self { $this->options['email'] = $email; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.BulkExports.CreateExportCustomJobOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/BulkExports/Export/JobInstance.php000064400000007704150515725670017640 0ustar00properties = [ 'resourceType' => Values::array_get($payload, 'resource_type'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'details' => Values::array_get($payload, 'details'), 'startDay' => Values::array_get($payload, 'start_day'), 'endDay' => Values::array_get($payload, 'end_day'), 'jobSid' => Values::array_get($payload, 'job_sid'), 'webhookUrl' => Values::array_get($payload, 'webhook_url'), 'webhookMethod' => Values::array_get($payload, 'webhook_method'), 'email' => Values::array_get($payload, 'email'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['jobSid' => $jobSid ?: $this->properties['jobSid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return JobContext Context for this JobInstance */ protected function proxy(): JobContext { if (!$this->context) { $this->context = new JobContext($this->version, $this->solution['jobSid']); } return $this->context; } /** * Fetch the JobInstance * * @return JobInstance Fetched JobInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): JobInstance { return $this->proxy()->fetch(); } /** * Delete the JobInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.BulkExports.JobInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/BulkExports/Export/ExportCustomJobPage.php000064400000002701150515725670021335 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ExportCustomJobInstance \Twilio\Rest\Preview\BulkExports\Export\ExportCustomJobInstance */ public function buildInstance(array $payload): ExportCustomJobInstance { return new ExportCustomJobInstance($this->version, $payload, $this->solution['resourceType']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.BulkExports.ExportCustomJobPage]'; } }src/Twilio/Rest/Preview/BulkExports/ExportInstance.php000064400000007051150515725670017121 0ustar00properties = [ 'resourceType' => Values::array_get($payload, 'resource_type'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['resourceType' => $resourceType ?: $this->properties['resourceType'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return ExportContext Context for this ExportInstance */ protected function proxy(): ExportContext { if (!$this->context) { $this->context = new ExportContext($this->version, $this->solution['resourceType']); } return $this->context; } /** * Fetch the ExportInstance * * @return ExportInstance Fetched ExportInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ExportInstance { return $this->proxy()->fetch(); } /** * Access the days */ protected function getDays(): DayList { return $this->proxy()->days; } /** * Access the exportCustomJobs */ protected function getExportCustomJobs(): ExportCustomJobList { return $this->proxy()->exportCustomJobs; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.BulkExports.ExportInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/BulkExports/ExportConfigurationInstance.php000064400000007606150515725670021657 0ustar00properties = [ 'enabled' => Values::array_get($payload, 'enabled'), 'webhookUrl' => Values::array_get($payload, 'webhook_url'), 'webhookMethod' => Values::array_get($payload, 'webhook_method'), 'resourceType' => Values::array_get($payload, 'resource_type'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['resourceType' => $resourceType ?: $this->properties['resourceType'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return ExportConfigurationContext Context for this * ExportConfigurationInstance */ protected function proxy(): ExportConfigurationContext { if (!$this->context) { $this->context = new ExportConfigurationContext($this->version, $this->solution['resourceType']); } return $this->context; } /** * Fetch the ExportConfigurationInstance * * @return ExportConfigurationInstance Fetched ExportConfigurationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ExportConfigurationInstance { return $this->proxy()->fetch(); } /** * Update the ExportConfigurationInstance * * @param array|Options $options Optional Arguments * @return ExportConfigurationInstance Updated ExportConfigurationInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ExportConfigurationInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.BulkExports.ExportConfigurationInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Understand/AssistantPage.php000064400000002553150515725670016550 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return AssistantInstance \Twilio\Rest\Preview\Understand\AssistantInstance */ public function buildInstance(array $payload): AssistantInstance { return new AssistantInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Understand.AssistantPage]'; } }src/Twilio/Rest/Preview/Understand/AssistantList.php000064400000013665150515725670016615 0ustar00solution = []; $this->uri = '/Assistants'; } /** * Streams AssistantInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads AssistantInstance 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 AssistantInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of AssistantInstance 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 AssistantPage Page of AssistantInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): AssistantPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new AssistantPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of AssistantInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return AssistantPage Page of AssistantInstance */ public function getPage(string $targetUrl): AssistantPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new AssistantPage($this->version, $response, $this->solution); } /** * Create the AssistantInstance * * @param array|Options $options Optional Arguments * @return AssistantInstance Created AssistantInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): AssistantInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'LogQueries' => Serialize::booleanToString($options['logQueries']), 'UniqueName' => $options['uniqueName'], 'CallbackUrl' => $options['callbackUrl'], 'CallbackEvents' => $options['callbackEvents'], 'FallbackActions' => Serialize::jsonObject($options['fallbackActions']), 'InitiationActions' => Serialize::jsonObject($options['initiationActions']), 'StyleSheet' => Serialize::jsonObject($options['styleSheet']), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new AssistantInstance($this->version, $payload); } /** * Constructs a AssistantContext * * @param string $sid A 34 character string that uniquely identifies this * resource. */ public function getContext(string $sid): AssistantContext { return new AssistantContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Understand.AssistantList]'; } }src/Twilio/Rest/Preview/Understand/AssistantInstance.php000064400000015256150515725670017444 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), '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'), 'latestModelBuildSid' => Values::array_get($payload, 'latest_model_build_sid'), 'links' => Values::array_get($payload, 'links'), 'logQueries' => Values::array_get($payload, 'log_queries'), 'sid' => Values::array_get($payload, 'sid'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'url' => Values::array_get($payload, 'url'), 'callbackUrl' => Values::array_get($payload, 'callback_url'), 'callbackEvents' => Values::array_get($payload, 'callback_events'), ]; $this->solution = ['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 AssistantContext Context for this AssistantInstance */ protected function proxy(): AssistantContext { if (!$this->context) { $this->context = new AssistantContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the AssistantInstance * * @return AssistantInstance Fetched AssistantInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AssistantInstance { return $this->proxy()->fetch(); } /** * Update the AssistantInstance * * @param array|Options $options Optional Arguments * @return AssistantInstance Updated AssistantInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): AssistantInstance { return $this->proxy()->update($options); } /** * Delete the AssistantInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the fieldTypes */ protected function getFieldTypes(): FieldTypeList { return $this->proxy()->fieldTypes; } /** * Access the tasks */ protected function getTasks(): TaskList { return $this->proxy()->tasks; } /** * Access the modelBuilds */ protected function getModelBuilds(): ModelBuildList { return $this->proxy()->modelBuilds; } /** * Access the queries */ protected function getQueries(): QueryList { return $this->proxy()->queries; } /** * Access the assistantFallbackActions */ protected function getAssistantFallbackActions(): AssistantFallbackActionsList { return $this->proxy()->assistantFallbackActions; } /** * Access the assistantInitiationActions */ protected function getAssistantInitiationActions(): AssistantInitiationActionsList { return $this->proxy()->assistantInitiationActions; } /** * Access the dialogues */ protected function getDialogues(): DialogueList { return $this->proxy()->dialogues; } /** * Access the styleSheet */ protected function getStyleSheet(): StyleSheetList { return $this->proxy()->styleSheet; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Understand.AssistantInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Understand/AssistantOptions.php000064400000044073150515725670017332 0ustar00options['friendlyName'] = $friendlyName; $this->options['logQueries'] = $logQueries; $this->options['uniqueName'] = $uniqueName; $this->options['callbackUrl'] = $callbackUrl; $this->options['callbackEvents'] = $callbackEvents; $this->options['fallbackActions'] = $fallbackActions; $this->options['initiationActions'] = $initiationActions; $this->options['styleSheet'] = $styleSheet; } /** * A text description for the Assistant. It is non-unique and can up to 255 characters long. * * @param string $friendlyName A text description for the Assistant. It is * non-unique and can up to 255 characters long. * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * A boolean that specifies whether queries should be logged for 30 days further training. If false, no queries will be stored, if true, queries will be stored for 30 days and deleted thereafter. Defaults to true if no value is provided. * * @param bool $logQueries A boolean that specifies whether queries should be * logged for 30 days further training. If false, no * queries will be stored, if true, queries will be * stored for 30 days and deleted thereafter. Defaults * to true if no value is provided. * @return $this Fluent Builder */ public function setLogQueries(bool $logQueries): self { $this->options['logQueries'] = $logQueries; return $this; } /** * A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. * * @param string $uniqueName A user-provided string that uniquely identifies * this resource as an alternative to the sid. Unique * up to 64 characters long. * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * A user-provided URL to send event callbacks to. * * @param string $callbackUrl A user-provided URL to send event callbacks to. * @return $this Fluent Builder */ public function setCallbackUrl(string $callbackUrl): self { $this->options['callbackUrl'] = $callbackUrl; return $this; } /** * Space-separated list of callback events that will trigger callbacks. * * @param string $callbackEvents Space-separated list of callback events that * will trigger callbacks. * @return $this Fluent Builder */ public function setCallbackEvents(string $callbackEvents): self { $this->options['callbackEvents'] = $callbackEvents; return $this; } /** * The JSON actions to be executed when the user's input is not recognized as matching any Task. * * @param array $fallbackActions The JSON actions to be executed when the * user's input is not recognized as matching any * Task. * @return $this Fluent Builder */ public function setFallbackActions(array $fallbackActions): self { $this->options['fallbackActions'] = $fallbackActions; return $this; } /** * The JSON actions to be executed on inbound phone calls when the Assistant has to say something first. * * @param array $initiationActions The JSON actions to be executed on inbound * phone calls when the Assistant has to say * something first. * @return $this Fluent Builder */ public function setInitiationActions(array $initiationActions): self { $this->options['initiationActions'] = $initiationActions; return $this; } /** * The JSON object that holds the style sheet for the assistant * * @param array $styleSheet The JSON object that holds the style sheet for the * assistant * @return $this Fluent Builder */ public function setStyleSheet(array $styleSheet): self { $this->options['styleSheet'] = $styleSheet; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Understand.CreateAssistantOptions ' . $options . ']'; } } class UpdateAssistantOptions extends Options { /** * @param string $friendlyName A text description for the Assistant. It is * non-unique and can up to 255 characters long. * @param bool $logQueries A boolean that specifies whether queries should be * logged for 30 days further training. If false, no * queries will be stored, if true, queries will be * stored for 30 days and deleted thereafter. Defaults * to true if no value is provided. * @param string $uniqueName A user-provided string that uniquely identifies * this resource as an alternative to the sid. Unique * up to 64 characters long. * @param string $callbackUrl A user-provided URL to send event callbacks to. * @param string $callbackEvents Space-separated list of callback events that * will trigger callbacks. * @param array $fallbackActions The JSON actions to be executed when the * user's input is not recognized as matching any * Task. * @param array $initiationActions The JSON actions to be executed on inbound * phone calls when the Assistant has to say * something first. * @param array $styleSheet The JSON object that holds the style sheet for the * assistant */ public function __construct(string $friendlyName = Values::NONE, bool $logQueries = Values::NONE, string $uniqueName = Values::NONE, string $callbackUrl = Values::NONE, string $callbackEvents = Values::NONE, array $fallbackActions = Values::ARRAY_NONE, array $initiationActions = Values::ARRAY_NONE, array $styleSheet = Values::ARRAY_NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['logQueries'] = $logQueries; $this->options['uniqueName'] = $uniqueName; $this->options['callbackUrl'] = $callbackUrl; $this->options['callbackEvents'] = $callbackEvents; $this->options['fallbackActions'] = $fallbackActions; $this->options['initiationActions'] = $initiationActions; $this->options['styleSheet'] = $styleSheet; } /** * A text description for the Assistant. It is non-unique and can up to 255 characters long. * * @param string $friendlyName A text description for the Assistant. It is * non-unique and can up to 255 characters long. * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * A boolean that specifies whether queries should be logged for 30 days further training. If false, no queries will be stored, if true, queries will be stored for 30 days and deleted thereafter. Defaults to true if no value is provided. * * @param bool $logQueries A boolean that specifies whether queries should be * logged for 30 days further training. If false, no * queries will be stored, if true, queries will be * stored for 30 days and deleted thereafter. Defaults * to true if no value is provided. * @return $this Fluent Builder */ public function setLogQueries(bool $logQueries): self { $this->options['logQueries'] = $logQueries; return $this; } /** * A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. * * @param string $uniqueName A user-provided string that uniquely identifies * this resource as an alternative to the sid. Unique * up to 64 characters long. * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * A user-provided URL to send event callbacks to. * * @param string $callbackUrl A user-provided URL to send event callbacks to. * @return $this Fluent Builder */ public function setCallbackUrl(string $callbackUrl): self { $this->options['callbackUrl'] = $callbackUrl; return $this; } /** * Space-separated list of callback events that will trigger callbacks. * * @param string $callbackEvents Space-separated list of callback events that * will trigger callbacks. * @return $this Fluent Builder */ public function setCallbackEvents(string $callbackEvents): self { $this->options['callbackEvents'] = $callbackEvents; return $this; } /** * The JSON actions to be executed when the user's input is not recognized as matching any Task. * * @param array $fallbackActions The JSON actions to be executed when the * user's input is not recognized as matching any * Task. * @return $this Fluent Builder */ public function setFallbackActions(array $fallbackActions): self { $this->options['fallbackActions'] = $fallbackActions; return $this; } /** * The JSON actions to be executed on inbound phone calls when the Assistant has to say something first. * * @param array $initiationActions The JSON actions to be executed on inbound * phone calls when the Assistant has to say * something first. * @return $this Fluent Builder */ public function setInitiationActions(array $initiationActions): self { $this->options['initiationActions'] = $initiationActions; return $this; } /** * The JSON object that holds the style sheet for the assistant * * @param array $styleSheet The JSON object that holds the style sheet for the * assistant * @return $this Fluent Builder */ public function setStyleSheet(array $styleSheet): self { $this->options['styleSheet'] = $styleSheet; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Understand.UpdateAssistantOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/DialogueList.php000064400000002504150515725670020334 0ustar00solution = ['assistantSid' => $assistantSid, ]; } /** * Constructs a DialogueContext * * @param string $sid The sid */ public function getContext(string $sid): DialogueContext { return new DialogueContext($this->version, $this->solution['assistantSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Understand.DialogueList]'; } }src/Twilio/Rest/Preview/Understand/Assistant/AssistantFallbackActionsOptions.php000064400000003321150515725670024233 0ustar00options['fallbackActions'] = $fallbackActions; } /** * The fallback_actions * * @param array $fallbackActions The fallback_actions * @return $this Fluent Builder */ public function setFallbackActions(array $fallbackActions): self { $this->options['fallbackActions'] = $fallbackActions; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Understand.UpdateAssistantFallbackActionsOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/AssistantInitiationActionsPage.php000064400000003064150515725670024070 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return AssistantInitiationActionsInstance \Twilio\Rest\Preview\Understand\Assistant\AssistantInitiationActionsInstance */ public function buildInstance(array $payload): AssistantInitiationActionsInstance { return new AssistantInitiationActionsInstance( $this->version, $payload, $this->solution['assistantSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Understand.AssistantInitiationActionsPage]'; } }src/Twilio/Rest/Preview/Understand/Assistant/ModelBuildContext.php000064400000005571150515725670021343 0ustar00solution = ['assistantSid' => $assistantSid, 'sid' => $sid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/ModelBuilds/' . \rawurlencode($sid) . ''; } /** * Fetch the ModelBuildInstance * * @return ModelBuildInstance Fetched ModelBuildInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ModelBuildInstance { $payload = $this->version->fetch('GET', $this->uri); return new ModelBuildInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['sid'] ); } /** * Update the ModelBuildInstance * * @param array|Options $options Optional Arguments * @return ModelBuildInstance Updated ModelBuildInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ModelBuildInstance { $options = new Values($options); $data = Values::of(['UniqueName' => $options['uniqueName'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ModelBuildInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['sid'] ); } /** * Delete the ModelBuildInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Understand.ModelBuildContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/DialogueContext.php000064400000003615150515725670021051 0ustar00solution = ['assistantSid' => $assistantSid, 'sid' => $sid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/Dialogues/' . \rawurlencode($sid) . ''; } /** * Fetch the DialogueInstance * * @return DialogueInstance Fetched DialogueInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): DialogueInstance { $payload = $this->version->fetch('GET', $this->uri); return new DialogueInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Understand.DialogueContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/ModelBuildOptions.php000064400000011115150515725670021341 0ustar00options['statusCallback'] = $statusCallback; $this->options['uniqueName'] = $uniqueName; } /** * The status_callback * * @param string $statusCallback The status_callback * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. For example: v0.1 * * @param string $uniqueName A user-provided string that uniquely identifies * this resource as an alternative to the sid. Unique * up to 64 characters long. For example: v0.1 * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Understand.CreateModelBuildOptions ' . $options . ']'; } } class UpdateModelBuildOptions extends Options { /** * @param string $uniqueName A user-provided string that uniquely identifies * this resource as an alternative to the sid. Unique * up to 64 characters long. For example: v0.1 */ public function __construct(string $uniqueName = Values::NONE) { $this->options['uniqueName'] = $uniqueName; } /** * A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. For example: v0.1 * * @param string $uniqueName A user-provided string that uniquely identifies * this resource as an alternative to the sid. Unique * up to 64 characters long. For example: v0.1 * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Understand.UpdateModelBuildOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/QueryInstance.php000064400000011607150515725670020545 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'results' => Values::array_get($payload, 'results'), 'language' => Values::array_get($payload, 'language'), 'modelBuildSid' => Values::array_get($payload, 'model_build_sid'), 'query' => Values::array_get($payload, 'query'), 'sampleSid' => Values::array_get($payload, 'sample_sid'), 'assistantSid' => Values::array_get($payload, 'assistant_sid'), 'sid' => Values::array_get($payload, 'sid'), 'status' => Values::array_get($payload, 'status'), 'url' => Values::array_get($payload, 'url'), 'sourceChannel' => Values::array_get($payload, 'source_channel'), ]; $this->solution = ['assistantSid' => $assistantSid, '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 QueryContext Context for this QueryInstance */ protected function proxy(): QueryContext { if (!$this->context) { $this->context = new QueryContext( $this->version, $this->solution['assistantSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the QueryInstance * * @return QueryInstance Fetched QueryInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): QueryInstance { return $this->proxy()->fetch(); } /** * Update the QueryInstance * * @param array|Options $options Optional Arguments * @return QueryInstance Updated QueryInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): QueryInstance { return $this->proxy()->update($options); } /** * Delete the QueryInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Understand.QueryInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/TaskContext.php000064400000015021150515725670020214 0ustar00solution = ['assistantSid' => $assistantSid, 'sid' => $sid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/Tasks/' . \rawurlencode($sid) . ''; } /** * Fetch the TaskInstance * * @return TaskInstance Fetched TaskInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TaskInstance { $payload = $this->version->fetch('GET', $this->uri); return new TaskInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['sid'] ); } /** * Update the TaskInstance * * @param array|Options $options Optional Arguments * @return TaskInstance Updated TaskInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): TaskInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'UniqueName' => $options['uniqueName'], 'Actions' => Serialize::jsonObject($options['actions']), 'ActionsUrl' => $options['actionsUrl'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new TaskInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['sid'] ); } /** * Delete the TaskInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the fields */ protected function getFields(): FieldList { if (!$this->_fields) { $this->_fields = new FieldList( $this->version, $this->solution['assistantSid'], $this->solution['sid'] ); } return $this->_fields; } /** * Access the samples */ protected function getSamples(): SampleList { if (!$this->_samples) { $this->_samples = new SampleList( $this->version, $this->solution['assistantSid'], $this->solution['sid'] ); } return $this->_samples; } /** * Access the taskActions */ protected function getTaskActions(): TaskActionsList { if (!$this->_taskActions) { $this->_taskActions = new TaskActionsList( $this->version, $this->solution['assistantSid'], $this->solution['sid'] ); } return $this->_taskActions; } /** * Access the statistics */ protected function getStatistics(): TaskStatisticsList { if (!$this->_statistics) { $this->_statistics = new TaskStatisticsList( $this->version, $this->solution['assistantSid'], $this->solution['sid'] ); } return $this->_statistics; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Understand.TaskContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/StyleSheetInstance.php000064400000006747150515725670021542 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'assistantSid' => Values::array_get($payload, 'assistant_sid'), 'url' => Values::array_get($payload, 'url'), 'data' => Values::array_get($payload, 'data'), ]; $this->solution = ['assistantSid' => $assistantSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return StyleSheetContext Context for this StyleSheetInstance */ protected function proxy(): StyleSheetContext { if (!$this->context) { $this->context = new StyleSheetContext($this->version, $this->solution['assistantSid']); } return $this->context; } /** * Fetch the StyleSheetInstance * * @return StyleSheetInstance Fetched StyleSheetInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): StyleSheetInstance { return $this->proxy()->fetch(); } /** * Update the StyleSheetInstance * * @param array|Options $options Optional Arguments * @return StyleSheetInstance Updated StyleSheetInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): StyleSheetInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Understand.StyleSheetInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/FieldTypeList.php000064400000013522150515725670020472 0ustar00solution = ['assistantSid' => $assistantSid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/FieldTypes'; } /** * Streams FieldTypeInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads FieldTypeInstance 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 FieldTypeInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of FieldTypeInstance 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 FieldTypePage Page of FieldTypeInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): FieldTypePage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new FieldTypePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of FieldTypeInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return FieldTypePage Page of FieldTypeInstance */ public function getPage(string $targetUrl): FieldTypePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new FieldTypePage($this->version, $response, $this->solution); } /** * Create the FieldTypeInstance * * @param string $uniqueName A user-provided string that uniquely identifies * this resource as an alternative to the sid. Unique * up to 64 characters long. * @param array|Options $options Optional Arguments * @return FieldTypeInstance Created FieldTypeInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $uniqueName, array $options = []): FieldTypeInstance { $options = new Values($options); $data = Values::of(['UniqueName' => $uniqueName, 'FriendlyName' => $options['friendlyName'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new FieldTypeInstance($this->version, $payload, $this->solution['assistantSid']); } /** * Constructs a FieldTypeContext * * @param string $sid The sid */ public function getContext(string $sid): FieldTypeContext { return new FieldTypeContext($this->version, $this->solution['assistantSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Understand.FieldTypeList]'; } }src/Twilio/Rest/Preview/Understand/Assistant/StyleSheetList.php000064400000002416150515725670020676 0ustar00solution = ['assistantSid' => $assistantSid, ]; } /** * Constructs a StyleSheetContext */ public function getContext(): StyleSheetContext { return new StyleSheetContext($this->version, $this->solution['assistantSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Understand.StyleSheetList]'; } }src/Twilio/Rest/Preview/Understand/Assistant/AssistantFallbackActionsInstance.php000064400000007551150515725670024355 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'assistantSid' => Values::array_get($payload, 'assistant_sid'), 'url' => Values::array_get($payload, 'url'), 'data' => Values::array_get($payload, 'data'), ]; $this->solution = ['assistantSid' => $assistantSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return AssistantFallbackActionsContext Context for this * AssistantFallbackActionsInstance */ protected function proxy(): AssistantFallbackActionsContext { if (!$this->context) { $this->context = new AssistantFallbackActionsContext( $this->version, $this->solution['assistantSid'] ); } return $this->context; } /** * Fetch the AssistantFallbackActionsInstance * * @return AssistantFallbackActionsInstance Fetched * AssistantFallbackActionsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AssistantFallbackActionsInstance { return $this->proxy()->fetch(); } /** * Update the AssistantFallbackActionsInstance * * @param array|Options $options Optional Arguments * @return AssistantFallbackActionsInstance Updated * AssistantFallbackActionsInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): AssistantFallbackActionsInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Understand.AssistantFallbackActionsInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/TaskInstance.php000064400000013005150515725670020334 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), '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'), 'links' => Values::array_get($payload, 'links'), 'assistantSid' => Values::array_get($payload, 'assistant_sid'), 'sid' => Values::array_get($payload, 'sid'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'actionsUrl' => Values::array_get($payload, 'actions_url'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['assistantSid' => $assistantSid, '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 TaskContext Context for this TaskInstance */ protected function proxy(): TaskContext { if (!$this->context) { $this->context = new TaskContext( $this->version, $this->solution['assistantSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the TaskInstance * * @return TaskInstance Fetched TaskInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TaskInstance { return $this->proxy()->fetch(); } /** * Update the TaskInstance * * @param array|Options $options Optional Arguments * @return TaskInstance Updated TaskInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): TaskInstance { return $this->proxy()->update($options); } /** * Delete the TaskInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the fields */ protected function getFields(): FieldList { return $this->proxy()->fields; } /** * Access the samples */ protected function getSamples(): SampleList { return $this->proxy()->samples; } /** * Access the taskActions */ protected function getTaskActions(): TaskActionsList { return $this->proxy()->taskActions; } /** * Access the statistics */ protected function getStatistics(): TaskStatisticsList { return $this->proxy()->statistics; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Understand.TaskInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/StyleSheetOptions.php000064400000003135150515725670021415 0ustar00options['styleSheet'] = $styleSheet; } /** * The JSON Style sheet string * * @param array $styleSheet The JSON Style sheet string * @return $this Fluent Builder */ public function setStyleSheet(array $styleSheet): self { $this->options['styleSheet'] = $styleSheet; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Understand.UpdateStyleSheetOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/ModelBuildPage.php000064400000002646150515725670020573 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ModelBuildInstance \Twilio\Rest\Preview\Understand\Assistant\ModelBuildInstance */ public function buildInstance(array $payload): ModelBuildInstance { return new ModelBuildInstance($this->version, $payload, $this->solution['assistantSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Understand.ModelBuildPage]'; } }src/Twilio/Rest/Preview/Understand/Assistant/AssistantFallbackActionsContext.php000064400000005423150515725670024231 0ustar00solution = ['assistantSid' => $assistantSid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/FallbackActions'; } /** * Fetch the AssistantFallbackActionsInstance * * @return AssistantFallbackActionsInstance Fetched * AssistantFallbackActionsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AssistantFallbackActionsInstance { $payload = $this->version->fetch('GET', $this->uri); return new AssistantFallbackActionsInstance( $this->version, $payload, $this->solution['assistantSid'] ); } /** * Update the AssistantFallbackActionsInstance * * @param array|Options $options Optional Arguments * @return AssistantFallbackActionsInstance Updated * AssistantFallbackActionsInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): AssistantFallbackActionsInstance { $options = new Values($options); $data = Values::of(['FallbackActions' => Serialize::jsonObject($options['fallbackActions']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new AssistantFallbackActionsInstance( $this->version, $payload, $this->solution['assistantSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Understand.AssistantFallbackActionsContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/Task/FieldInstance.php000064400000010553150515725670021364 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'fieldType' => Values::array_get($payload, 'field_type'), 'taskSid' => Values::array_get($payload, 'task_sid'), 'assistantSid' => Values::array_get($payload, 'assistant_sid'), 'sid' => Values::array_get($payload, 'sid'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'assistantSid' => $assistantSid, 'taskSid' => $taskSid, '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 FieldContext Context for this FieldInstance */ protected function proxy(): FieldContext { if (!$this->context) { $this->context = new FieldContext( $this->version, $this->solution['assistantSid'], $this->solution['taskSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the FieldInstance * * @return FieldInstance Fetched FieldInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FieldInstance { return $this->proxy()->fetch(); } /** * Delete the FieldInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Understand.FieldInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/Task/SampleList.php000064400000015230150515725670020726 0ustar00solution = ['assistantSid' => $assistantSid, 'taskSid' => $taskSid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/Tasks/' . \rawurlencode($taskSid) . '/Samples'; } /** * Streams SampleInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads SampleInstance 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 SampleInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of SampleInstance 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 SamplePage Page of SampleInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SamplePage { $options = new Values($options); $params = Values::of([ 'Language' => $options['language'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new SamplePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of SampleInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return SamplePage Page of SampleInstance */ public function getPage(string $targetUrl): SamplePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new SamplePage($this->version, $response, $this->solution); } /** * Create the SampleInstance * * @param string $language An ISO language-country string of the sample. * @param string $taggedText The text example of how end-users may express this * task. The sample may contain Field tag blocks. * @param array|Options $options Optional Arguments * @return SampleInstance Created SampleInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $language, string $taggedText, array $options = []): SampleInstance { $options = new Values($options); $data = Values::of([ 'Language' => $language, 'TaggedText' => $taggedText, 'SourceChannel' => $options['sourceChannel'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new SampleInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['taskSid'] ); } /** * Constructs a SampleContext * * @param string $sid A 34 character string that uniquely identifies this * resource. */ public function getContext(string $sid): SampleContext { return new SampleContext( $this->version, $this->solution['assistantSid'], $this->solution['taskSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Understand.SampleList]'; } }src/Twilio/Rest/Preview/Understand/Assistant/Task/TaskActionsOptions.php000064400000003507150515725670022454 0ustar00options['actions'] = $actions; } /** * The JSON actions that instruct the Assistant how to perform this task. * * @param array $actions The JSON actions that instruct the Assistant how to * perform this task. * @return $this Fluent Builder */ public function setActions(array $actions): self { $this->options['actions'] = $actions; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Understand.UpdateTaskActionsOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/Task/FieldContext.php000064400000004657150515725670021254 0ustar00solution = ['assistantSid' => $assistantSid, 'taskSid' => $taskSid, 'sid' => $sid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/Tasks/' . \rawurlencode($taskSid) . '/Fields/' . \rawurlencode($sid) . ''; } /** * Fetch the FieldInstance * * @return FieldInstance Fetched FieldInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FieldInstance { $payload = $this->version->fetch('GET', $this->uri); return new FieldInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['taskSid'], $this->solution['sid'] ); } /** * Delete the FieldInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Understand.FieldContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/Task/SampleContext.php000064400000006413150515725670021442 0ustar00solution = ['assistantSid' => $assistantSid, 'taskSid' => $taskSid, 'sid' => $sid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/Tasks/' . \rawurlencode($taskSid) . '/Samples/' . \rawurlencode($sid) . ''; } /** * Fetch the SampleInstance * * @return SampleInstance Fetched SampleInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SampleInstance { $payload = $this->version->fetch('GET', $this->uri); return new SampleInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['taskSid'], $this->solution['sid'] ); } /** * Update the SampleInstance * * @param array|Options $options Optional Arguments * @return SampleInstance Updated SampleInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SampleInstance { $options = new Values($options); $data = Values::of([ 'Language' => $options['language'], 'TaggedText' => $options['taggedText'], 'SourceChannel' => $options['sourceChannel'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new SampleInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['taskSid'], $this->solution['sid'] ); } /** * Delete the SampleInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Understand.SampleContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/Task/SampleOptions.php000064400000016107150515725670021452 0ustar00options['language'] = $language; } /** * An ISO language-country string of the sample. * * @param string $language An ISO language-country string of the sample. * @return $this Fluent Builder */ public function setLanguage(string $language): self { $this->options['language'] = $language; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Understand.ReadSampleOptions ' . $options . ']'; } } class CreateSampleOptions extends Options { /** * @param string $sourceChannel The communication channel the sample was * captured. It can be: voice, sms, chat, alexa, * google-assistant, or slack. If not included the * value will be null */ public function __construct(string $sourceChannel = Values::NONE) { $this->options['sourceChannel'] = $sourceChannel; } /** * The communication channel the sample was captured. It can be: *voice*, *sms*, *chat*, *alexa*, *google-assistant*, or *slack*. If not included the value will be null * * @param string $sourceChannel The communication channel the sample was * captured. It can be: voice, sms, chat, alexa, * google-assistant, or slack. If not included the * value will be null * @return $this Fluent Builder */ public function setSourceChannel(string $sourceChannel): self { $this->options['sourceChannel'] = $sourceChannel; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Understand.CreateSampleOptions ' . $options . ']'; } } class UpdateSampleOptions extends Options { /** * @param string $language An ISO language-country string of the sample. * @param string $taggedText The text example of how end-users may express this * task. The sample may contain Field tag blocks. * @param string $sourceChannel The communication channel the sample was * captured. It can be: voice, sms, chat, alexa, * google-assistant, or slack. If not included the * value will be null */ public function __construct(string $language = Values::NONE, string $taggedText = Values::NONE, string $sourceChannel = Values::NONE) { $this->options['language'] = $language; $this->options['taggedText'] = $taggedText; $this->options['sourceChannel'] = $sourceChannel; } /** * An ISO language-country string of the sample. * * @param string $language An ISO language-country string of the sample. * @return $this Fluent Builder */ public function setLanguage(string $language): self { $this->options['language'] = $language; return $this; } /** * The text example of how end-users may express this task. The sample may contain Field tag blocks. * * @param string $taggedText The text example of how end-users may express this * task. The sample may contain Field tag blocks. * @return $this Fluent Builder */ public function setTaggedText(string $taggedText): self { $this->options['taggedText'] = $taggedText; return $this; } /** * The communication channel the sample was captured. It can be: *voice*, *sms*, *chat*, *alexa*, *google-assistant*, or *slack*. If not included the value will be null * * @param string $sourceChannel The communication channel the sample was * captured. It can be: voice, sms, chat, alexa, * google-assistant, or slack. If not included the * value will be null * @return $this Fluent Builder */ public function setSourceChannel(string $sourceChannel): self { $this->options['sourceChannel'] = $sourceChannel; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Understand.UpdateSampleOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/Task/SampleInstance.php000064400000011513150515725670021557 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'taskSid' => Values::array_get($payload, 'task_sid'), 'language' => Values::array_get($payload, 'language'), 'assistantSid' => Values::array_get($payload, 'assistant_sid'), 'sid' => Values::array_get($payload, 'sid'), 'taggedText' => Values::array_get($payload, 'tagged_text'), 'url' => Values::array_get($payload, 'url'), 'sourceChannel' => Values::array_get($payload, 'source_channel'), ]; $this->solution = [ 'assistantSid' => $assistantSid, 'taskSid' => $taskSid, '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 SampleContext Context for this SampleInstance */ protected function proxy(): SampleContext { if (!$this->context) { $this->context = new SampleContext( $this->version, $this->solution['assistantSid'], $this->solution['taskSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the SampleInstance * * @return SampleInstance Fetched SampleInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SampleInstance { return $this->proxy()->fetch(); } /** * Update the SampleInstance * * @param array|Options $options Optional Arguments * @return SampleInstance Updated SampleInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SampleInstance { return $this->proxy()->update($options); } /** * Delete the SampleInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Understand.SampleInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/Task/TaskActionsList.php000064400000002714150515725670021733 0ustar00solution = ['assistantSid' => $assistantSid, 'taskSid' => $taskSid, ]; } /** * Constructs a TaskActionsContext */ public function getContext(): TaskActionsContext { return new TaskActionsContext( $this->version, $this->solution['assistantSid'], $this->solution['taskSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Understand.TaskActionsList]'; } }src/Twilio/Rest/Preview/Understand/Assistant/Task/FieldList.php000064400000014354150515725670020536 0ustar00solution = ['assistantSid' => $assistantSid, 'taskSid' => $taskSid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/Tasks/' . \rawurlencode($taskSid) . '/Fields'; } /** * Streams FieldInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads FieldInstance 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 FieldInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of FieldInstance 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 FieldPage Page of FieldInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): FieldPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new FieldPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of FieldInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return FieldPage Page of FieldInstance */ public function getPage(string $targetUrl): FieldPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new FieldPage($this->version, $response, $this->solution); } /** * Create the FieldInstance * * @param string $fieldType The unique name or sid of the FieldType. It can be * any Built-in Field Type or the unique_name or sid * of a custom Field Type. * @param string $uniqueName A user-provided string that uniquely identifies * this resource as an alternative to the sid. Unique * up to 64 characters long. * @return FieldInstance Created FieldInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $fieldType, string $uniqueName): FieldInstance { $data = Values::of(['FieldType' => $fieldType, 'UniqueName' => $uniqueName, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new FieldInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['taskSid'] ); } /** * Constructs a FieldContext * * @param string $sid A 34 character string that uniquely identifies this * resource. */ public function getContext(string $sid): FieldContext { return new FieldContext( $this->version, $this->solution['assistantSid'], $this->solution['taskSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Understand.FieldList]'; } }src/Twilio/Rest/Preview/Understand/Assistant/Task/TaskActionsContext.php000064400000005334150515725670022445 0ustar00solution = ['assistantSid' => $assistantSid, 'taskSid' => $taskSid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/Tasks/' . \rawurlencode($taskSid) . '/Actions'; } /** * Fetch the TaskActionsInstance * * @return TaskActionsInstance Fetched TaskActionsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TaskActionsInstance { $payload = $this->version->fetch('GET', $this->uri); return new TaskActionsInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['taskSid'] ); } /** * Update the TaskActionsInstance * * @param array|Options $options Optional Arguments * @return TaskActionsInstance Updated TaskActionsInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): TaskActionsInstance { $options = new Values($options); $data = Values::of(['Actions' => Serialize::jsonObject($options['actions']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new TaskActionsInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['taskSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Understand.TaskActionsContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/Task/FieldPage.php000064400000002750150515725670020474 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return FieldInstance \Twilio\Rest\Preview\Understand\Assistant\Task\FieldInstance */ public function buildInstance(array $payload): FieldInstance { return new FieldInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['taskSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Understand.FieldPage]'; } }src/Twilio/Rest/Preview/Understand/Assistant/Task/TaskActionsInstance.php000064400000007435150515725670022571 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'assistantSid' => Values::array_get($payload, 'assistant_sid'), 'taskSid' => Values::array_get($payload, 'task_sid'), 'url' => Values::array_get($payload, 'url'), 'data' => Values::array_get($payload, 'data'), ]; $this->solution = ['assistantSid' => $assistantSid, 'taskSid' => $taskSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return TaskActionsContext Context for this TaskActionsInstance */ protected function proxy(): TaskActionsContext { if (!$this->context) { $this->context = new TaskActionsContext( $this->version, $this->solution['assistantSid'], $this->solution['taskSid'] ); } return $this->context; } /** * Fetch the TaskActionsInstance * * @return TaskActionsInstance Fetched TaskActionsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TaskActionsInstance { return $this->proxy()->fetch(); } /** * Update the TaskActionsInstance * * @param array|Options $options Optional Arguments * @return TaskActionsInstance Updated TaskActionsInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): TaskActionsInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Understand.TaskActionsInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/Task/TaskStatisticsList.php000064400000002771150515725670022470 0ustar00solution = ['assistantSid' => $assistantSid, 'taskSid' => $taskSid, ]; } /** * Constructs a TaskStatisticsContext */ public function getContext(): TaskStatisticsContext { return new TaskStatisticsContext( $this->version, $this->solution['assistantSid'], $this->solution['taskSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Understand.TaskStatisticsList]'; } }src/Twilio/Rest/Preview/Understand/Assistant/Task/SamplePage.php000064400000002756150515725670020700 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SampleInstance \Twilio\Rest\Preview\Understand\Assistant\Task\SampleInstance */ public function buildInstance(array $payload): SampleInstance { return new SampleInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['taskSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Understand.SamplePage]'; } }src/Twilio/Rest/Preview/Understand/Assistant/Task/TaskStatisticsContext.php000064400000004044150515725670023174 0ustar00solution = ['assistantSid' => $assistantSid, 'taskSid' => $taskSid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/Tasks/' . \rawurlencode($taskSid) . '/Statistics'; } /** * Fetch the TaskStatisticsInstance * * @return TaskStatisticsInstance Fetched TaskStatisticsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TaskStatisticsInstance { $payload = $this->version->fetch('GET', $this->uri); return new TaskStatisticsInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['taskSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Understand.TaskStatisticsContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/Task/TaskActionsPage.php000064400000003014150515725670021666 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return TaskActionsInstance \Twilio\Rest\Preview\Understand\Assistant\Task\TaskActionsInstance */ public function buildInstance(array $payload): TaskActionsInstance { return new TaskActionsInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['taskSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Understand.TaskActionsPage]'; } }src/Twilio/Rest/Preview/Understand/Assistant/Task/TaskStatisticsInstance.php000064400000007127150515725670023321 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'assistantSid' => Values::array_get($payload, 'assistant_sid'), 'taskSid' => Values::array_get($payload, 'task_sid'), 'samplesCount' => Values::array_get($payload, 'samples_count'), 'fieldsCount' => Values::array_get($payload, 'fields_count'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['assistantSid' => $assistantSid, 'taskSid' => $taskSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return TaskStatisticsContext Context for this TaskStatisticsInstance */ protected function proxy(): TaskStatisticsContext { if (!$this->context) { $this->context = new TaskStatisticsContext( $this->version, $this->solution['assistantSid'], $this->solution['taskSid'] ); } return $this->context; } /** * Fetch the TaskStatisticsInstance * * @return TaskStatisticsInstance Fetched TaskStatisticsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TaskStatisticsInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Understand.TaskStatisticsInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/Task/TaskStatisticsPage.php000064400000003036150515725670022424 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return TaskStatisticsInstance \Twilio\Rest\Preview\Understand\Assistant\Task\TaskStatisticsInstance */ public function buildInstance(array $payload): TaskStatisticsInstance { return new TaskStatisticsInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['taskSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Understand.TaskStatisticsPage]'; } }src/Twilio/Rest/Preview/Understand/Assistant/ModelBuildList.php000064400000013256150515725670020631 0ustar00solution = ['assistantSid' => $assistantSid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/ModelBuilds'; } /** * Streams ModelBuildInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ModelBuildInstance 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 ModelBuildInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of ModelBuildInstance 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 ModelBuildPage Page of ModelBuildInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ModelBuildPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ModelBuildPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ModelBuildInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ModelBuildPage Page of ModelBuildInstance */ public function getPage(string $targetUrl): ModelBuildPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ModelBuildPage($this->version, $response, $this->solution); } /** * Create the ModelBuildInstance * * @param array|Options $options Optional Arguments * @return ModelBuildInstance Created ModelBuildInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): ModelBuildInstance { $options = new Values($options); $data = Values::of([ 'StatusCallback' => $options['statusCallback'], 'UniqueName' => $options['uniqueName'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ModelBuildInstance($this->version, $payload, $this->solution['assistantSid']); } /** * Constructs a ModelBuildContext * * @param string $sid The sid */ public function getContext(string $sid): ModelBuildContext { return new ModelBuildContext($this->version, $this->solution['assistantSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Understand.ModelBuildList]'; } }src/Twilio/Rest/Preview/Understand/Assistant/FieldType/FieldValueInstance.php000064400000010776150515725670023353 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'fieldTypeSid' => Values::array_get($payload, 'field_type_sid'), 'language' => Values::array_get($payload, 'language'), 'assistantSid' => Values::array_get($payload, 'assistant_sid'), 'sid' => Values::array_get($payload, 'sid'), 'value' => Values::array_get($payload, 'value'), 'url' => Values::array_get($payload, 'url'), 'synonymOf' => Values::array_get($payload, 'synonym_of'), ]; $this->solution = [ 'assistantSid' => $assistantSid, 'fieldTypeSid' => $fieldTypeSid, '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 FieldValueContext Context for this FieldValueInstance */ protected function proxy(): FieldValueContext { if (!$this->context) { $this->context = new FieldValueContext( $this->version, $this->solution['assistantSid'], $this->solution['fieldTypeSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the FieldValueInstance * * @return FieldValueInstance Fetched FieldValueInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FieldValueInstance { return $this->proxy()->fetch(); } /** * Delete the FieldValueInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Understand.FieldValueInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/FieldType/FieldValueList.php000064400000015434150515725670022516 0ustar00solution = ['assistantSid' => $assistantSid, 'fieldTypeSid' => $fieldTypeSid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/FieldTypes/' . \rawurlencode($fieldTypeSid) . '/FieldValues'; } /** * Streams FieldValueInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads FieldValueInstance 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 FieldValueInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of FieldValueInstance 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 FieldValuePage Page of FieldValueInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): FieldValuePage { $options = new Values($options); $params = Values::of([ 'Language' => $options['language'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new FieldValuePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of FieldValueInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return FieldValuePage Page of FieldValueInstance */ public function getPage(string $targetUrl): FieldValuePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new FieldValuePage($this->version, $response, $this->solution); } /** * Create the FieldValueInstance * * @param string $language An ISO language-country string of the value. * @param string $value A user-provided string that uniquely identifies this * resource as an alternative to the sid. Unique up to 64 * characters long. * @param array|Options $options Optional Arguments * @return FieldValueInstance Created FieldValueInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $language, string $value, array $options = []): FieldValueInstance { $options = new Values($options); $data = Values::of([ 'Language' => $language, 'Value' => $value, 'SynonymOf' => $options['synonymOf'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new FieldValueInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['fieldTypeSid'] ); } /** * Constructs a FieldValueContext * * @param string $sid The sid */ public function getContext(string $sid): FieldValueContext { return new FieldValueContext( $this->version, $this->solution['assistantSid'], $this->solution['fieldTypeSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Understand.FieldValueList]'; } }src/Twilio/Rest/Preview/Understand/Assistant/FieldType/FieldValuePage.php000064400000003025150515725670022450 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return FieldValueInstance \Twilio\Rest\Preview\Understand\Assistant\FieldType\FieldValueInstance */ public function buildInstance(array $payload): FieldValueInstance { return new FieldValueInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['fieldTypeSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Understand.FieldValuePage]'; } }src/Twilio/Rest/Preview/Understand/Assistant/FieldType/FieldValueOptions.php000064400000006437150515725670023241 0ustar00options['language'] = $language; } /** * An ISO language-country string of the value. For example: *en-US* * * @param string $language An ISO language-country string of the value. For * example: en-US * @return $this Fluent Builder */ public function setLanguage(string $language): self { $this->options['language'] = $language; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Understand.ReadFieldValueOptions ' . $options . ']'; } } class CreateFieldValueOptions extends Options { /** * @param string $synonymOf A value that indicates this field value is a * synonym of. Empty if the value is not a synonym. */ public function __construct(string $synonymOf = Values::NONE) { $this->options['synonymOf'] = $synonymOf; } /** * A value that indicates this field value is a synonym of. Empty if the value is not a synonym. * * @param string $synonymOf A value that indicates this field value is a * synonym of. Empty if the value is not a synonym. * @return $this Fluent Builder */ public function setSynonymOf(string $synonymOf): self { $this->options['synonymOf'] = $synonymOf; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Understand.CreateFieldValueOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/FieldType/FieldValueContext.php000064400000004610150515725670023221 0ustar00solution = ['assistantSid' => $assistantSid, 'fieldTypeSid' => $fieldTypeSid, 'sid' => $sid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/FieldTypes/' . \rawurlencode($fieldTypeSid) . '/FieldValues/' . \rawurlencode($sid) . ''; } /** * Fetch the FieldValueInstance * * @return FieldValueInstance Fetched FieldValueInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FieldValueInstance { $payload = $this->version->fetch('GET', $this->uri); return new FieldValueInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['fieldTypeSid'], $this->solution['sid'] ); } /** * Delete the FieldValueInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Understand.FieldValueContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/DialogueInstance.php000064400000006545150515725670021176 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'assistantSid' => Values::array_get($payload, 'assistant_sid'), 'sid' => Values::array_get($payload, 'sid'), 'data' => Values::array_get($payload, 'data'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['assistantSid' => $assistantSid, '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 DialogueContext Context for this DialogueInstance */ protected function proxy(): DialogueContext { if (!$this->context) { $this->context = new DialogueContext( $this->version, $this->solution['assistantSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the DialogueInstance * * @return DialogueInstance Fetched DialogueInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): DialogueInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Understand.DialogueInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/DialoguePage.php000064400000002632150515725670020277 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return DialogueInstance \Twilio\Rest\Preview\Understand\Assistant\DialogueInstance */ public function buildInstance(array $payload): DialogueInstance { return new DialogueInstance($this->version, $payload, $this->solution['assistantSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Understand.DialoguePage]'; } }src/Twilio/Rest/Preview/Understand/Assistant/FieldTypeInstance.php000064400000011344150515725670021323 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), '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'), 'links' => Values::array_get($payload, 'links'), 'assistantSid' => Values::array_get($payload, 'assistant_sid'), 'sid' => Values::array_get($payload, 'sid'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['assistantSid' => $assistantSid, '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 FieldTypeContext Context for this FieldTypeInstance */ protected function proxy(): FieldTypeContext { if (!$this->context) { $this->context = new FieldTypeContext( $this->version, $this->solution['assistantSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the FieldTypeInstance * * @return FieldTypeInstance Fetched FieldTypeInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FieldTypeInstance { return $this->proxy()->fetch(); } /** * Update the FieldTypeInstance * * @param array|Options $options Optional Arguments * @return FieldTypeInstance Updated FieldTypeInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): FieldTypeInstance { return $this->proxy()->update($options); } /** * Delete the FieldTypeInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the fieldValues */ protected function getFieldValues(): FieldValueList { return $this->proxy()->fieldValues; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Understand.FieldTypeInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/AssistantFallbackActionsList.php000064400000002525150515725670023520 0ustar00solution = ['assistantSid' => $assistantSid, ]; } /** * Constructs a AssistantFallbackActionsContext */ public function getContext(): AssistantFallbackActionsContext { return new AssistantFallbackActionsContext($this->version, $this->solution['assistantSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Understand.AssistantFallbackActionsList]'; } }src/Twilio/Rest/Preview/Understand/Assistant/TaskOptions.php000064400000021007150515725670020224 0ustar00options['friendlyName'] = $friendlyName; $this->options['actions'] = $actions; $this->options['actionsUrl'] = $actionsUrl; } /** * A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. * * @param string $friendlyName A user-provided string that identifies this * resource. It is non-unique and can up to 255 * characters long. * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * A user-provided JSON object encoded as a string to specify the actions for this task. It is optional and non-unique. * * @param array $actions A user-provided JSON object encoded as a string to * specify the actions for this task. It is optional and * non-unique. * @return $this Fluent Builder */ public function setActions(array $actions): self { $this->options['actions'] = $actions; return $this; } /** * User-provided HTTP endpoint where from the assistant fetches actions * * @param string $actionsUrl User-provided HTTP endpoint where from the * assistant fetches actions * @return $this Fluent Builder */ public function setActionsUrl(string $actionsUrl): self { $this->options['actionsUrl'] = $actionsUrl; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Understand.CreateTaskOptions ' . $options . ']'; } } class UpdateTaskOptions extends Options { /** * @param string $friendlyName A user-provided string that identifies this * resource. It is non-unique and can up to 255 * characters long. * @param string $uniqueName A user-provided string that uniquely identifies * this resource as an alternative to the sid. Unique * up to 64 characters long. * @param array $actions A user-provided JSON object encoded as a string to * specify the actions for this task. It is optional and * non-unique. * @param string $actionsUrl User-provided HTTP endpoint where from the * assistant fetches actions */ public function __construct(string $friendlyName = Values::NONE, string $uniqueName = Values::NONE, array $actions = Values::ARRAY_NONE, string $actionsUrl = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['uniqueName'] = $uniqueName; $this->options['actions'] = $actions; $this->options['actionsUrl'] = $actionsUrl; } /** * A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. * * @param string $friendlyName A user-provided string that identifies this * resource. It is non-unique and can up to 255 * characters long. * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. * * @param string $uniqueName A user-provided string that uniquely identifies * this resource as an alternative to the sid. Unique * up to 64 characters long. * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * A user-provided JSON object encoded as a string to specify the actions for this task. It is optional and non-unique. * * @param array $actions A user-provided JSON object encoded as a string to * specify the actions for this task. It is optional and * non-unique. * @return $this Fluent Builder */ public function setActions(array $actions): self { $this->options['actions'] = $actions; return $this; } /** * User-provided HTTP endpoint where from the assistant fetches actions * * @param string $actionsUrl User-provided HTTP endpoint where from the * assistant fetches actions * @return $this Fluent Builder */ public function setActionsUrl(string $actionsUrl): self { $this->options['actionsUrl'] = $actionsUrl; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Understand.UpdateTaskOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/AssistantFallbackActionsPage.php000064400000003050150515725670023453 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return AssistantFallbackActionsInstance \Twilio\Rest\Preview\Understand\Assistant\AssistantFallbackActionsInstance */ public function buildInstance(array $payload): AssistantFallbackActionsInstance { return new AssistantFallbackActionsInstance( $this->version, $payload, $this->solution['assistantSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Understand.AssistantFallbackActionsPage]'; } }src/Twilio/Rest/Preview/Understand/Assistant/StyleSheetPage.php000064400000002646150515725670020644 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return StyleSheetInstance \Twilio\Rest\Preview\Understand\Assistant\StyleSheetInstance */ public function buildInstance(array $payload): StyleSheetInstance { return new StyleSheetInstance($this->version, $payload, $this->solution['assistantSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Understand.StyleSheetPage]'; } }src/Twilio/Rest/Preview/Understand/Assistant/QueryList.php000064400000015004150515725670017707 0ustar00solution = ['assistantSid' => $assistantSid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/Queries'; } /** * Streams QueryInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads QueryInstance 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 QueryInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of QueryInstance 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 QueryPage Page of QueryInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): QueryPage { $options = new Values($options); $params = Values::of([ 'Language' => $options['language'], 'ModelBuild' => $options['modelBuild'], 'Status' => $options['status'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new QueryPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of QueryInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return QueryPage Page of QueryInstance */ public function getPage(string $targetUrl): QueryPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new QueryPage($this->version, $response, $this->solution); } /** * Create the QueryInstance * * @param string $language An ISO language-country string of the sample. * @param string $query A user-provided string that uniquely identifies this * resource as an alternative to the sid. It can be up to * 2048 characters long. * @param array|Options $options Optional Arguments * @return QueryInstance Created QueryInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $language, string $query, array $options = []): QueryInstance { $options = new Values($options); $data = Values::of([ 'Language' => $language, 'Query' => $query, 'Tasks' => $options['tasks'], 'ModelBuild' => $options['modelBuild'], 'Field' => $options['field'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new QueryInstance($this->version, $payload, $this->solution['assistantSid']); } /** * Constructs a QueryContext * * @param string $sid A 34 character string that uniquely identifies this * resource. */ public function getContext(string $sid): QueryContext { return new QueryContext($this->version, $this->solution['assistantSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Understand.QueryList]'; } }src/Twilio/Rest/Preview/Understand/Assistant/AssistantInitiationActionsInstance.php000064400000007615150515725670024766 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'assistantSid' => Values::array_get($payload, 'assistant_sid'), 'url' => Values::array_get($payload, 'url'), 'data' => Values::array_get($payload, 'data'), ]; $this->solution = ['assistantSid' => $assistantSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return AssistantInitiationActionsContext Context for this * AssistantInitiationActionsInstance */ protected function proxy(): AssistantInitiationActionsContext { if (!$this->context) { $this->context = new AssistantInitiationActionsContext( $this->version, $this->solution['assistantSid'] ); } return $this->context; } /** * Fetch the AssistantInitiationActionsInstance * * @return AssistantInitiationActionsInstance Fetched * AssistantInitiationActionsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AssistantInitiationActionsInstance { return $this->proxy()->fetch(); } /** * Update the AssistantInitiationActionsInstance * * @param array|Options $options Optional Arguments * @return AssistantInitiationActionsInstance Updated * AssistantInitiationActionsInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): AssistantInitiationActionsInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Understand.AssistantInitiationActionsInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/ModelBuildInstance.php000064400000011141150515725670021451 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'assistantSid' => Values::array_get($payload, 'assistant_sid'), 'sid' => Values::array_get($payload, 'sid'), 'status' => Values::array_get($payload, 'status'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'url' => Values::array_get($payload, 'url'), 'buildDuration' => Values::array_get($payload, 'build_duration'), 'errorCode' => Values::array_get($payload, 'error_code'), ]; $this->solution = ['assistantSid' => $assistantSid, '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 ModelBuildContext Context for this ModelBuildInstance */ protected function proxy(): ModelBuildContext { if (!$this->context) { $this->context = new ModelBuildContext( $this->version, $this->solution['assistantSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the ModelBuildInstance * * @return ModelBuildInstance Fetched ModelBuildInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ModelBuildInstance { return $this->proxy()->fetch(); } /** * Update the ModelBuildInstance * * @param array|Options $options Optional Arguments * @return ModelBuildInstance Updated ModelBuildInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ModelBuildInstance { return $this->proxy()->update($options); } /** * Delete the ModelBuildInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Understand.ModelBuildInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/FieldTypeContext.php000064400000011257150515725670021206 0ustar00solution = ['assistantSid' => $assistantSid, 'sid' => $sid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/FieldTypes/' . \rawurlencode($sid) . ''; } /** * Fetch the FieldTypeInstance * * @return FieldTypeInstance Fetched FieldTypeInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FieldTypeInstance { $payload = $this->version->fetch('GET', $this->uri); return new FieldTypeInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['sid'] ); } /** * Update the FieldTypeInstance * * @param array|Options $options Optional Arguments * @return FieldTypeInstance Updated FieldTypeInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): FieldTypeInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'UniqueName' => $options['uniqueName'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new FieldTypeInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['sid'] ); } /** * Delete the FieldTypeInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the fieldValues */ protected function getFieldValues(): FieldValueList { if (!$this->_fieldValues) { $this->_fieldValues = new FieldValueList( $this->version, $this->solution['assistantSid'], $this->solution['sid'] ); } return $this->_fieldValues; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Understand.FieldTypeContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/QueryPage.php000064400000002610150515725670017647 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return QueryInstance \Twilio\Rest\Preview\Understand\Assistant\QueryInstance */ public function buildInstance(array $payload): QueryInstance { return new QueryInstance($this->version, $payload, $this->solution['assistantSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Understand.QueryPage]'; } }src/Twilio/Rest/Preview/Understand/Assistant/QueryOptions.php000064400000022654150515725670020440 0ustar00options['language'] = $language; $this->options['modelBuild'] = $modelBuild; $this->options['status'] = $status; } /** * An ISO language-country string of the sample. * * @param string $language An ISO language-country string of the sample. * @return $this Fluent Builder */ public function setLanguage(string $language): self { $this->options['language'] = $language; return $this; } /** * The Model Build Sid or unique name of the Model Build to be queried. * * @param string $modelBuild The Model Build Sid or unique name of the Model * Build to be queried. * @return $this Fluent Builder */ public function setModelBuild(string $modelBuild): self { $this->options['modelBuild'] = $modelBuild; return $this; } /** * A string that described the query status. The values can be: pending_review, reviewed, discarded * * @param string $status A string that described the query status. The values * can be: pending_review, reviewed, discarded * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Understand.ReadQueryOptions ' . $options . ']'; } } class CreateQueryOptions extends Options { /** * @param string $tasks Constraints the query to a set of tasks. Useful when * you need to constrain the paths the user can take. * Tasks should be comma separated task-unique-name-1, * task-unique-name-2 * @param string $modelBuild The Model Build Sid or unique name of the Model * Build to be queried. * @param string $field Constraints the query to a given Field with an task. * Useful when you know the Field you are expecting. It * accepts one field in the format * task-unique-name-1:field-unique-name */ public function __construct(string $tasks = Values::NONE, string $modelBuild = Values::NONE, string $field = Values::NONE) { $this->options['tasks'] = $tasks; $this->options['modelBuild'] = $modelBuild; $this->options['field'] = $field; } /** * Constraints the query to a set of tasks. Useful when you need to constrain the paths the user can take. Tasks should be comma separated *task-unique-name-1*, *task-unique-name-2* * * @param string $tasks Constraints the query to a set of tasks. Useful when * you need to constrain the paths the user can take. * Tasks should be comma separated task-unique-name-1, * task-unique-name-2 * @return $this Fluent Builder */ public function setTasks(string $tasks): self { $this->options['tasks'] = $tasks; return $this; } /** * The Model Build Sid or unique name of the Model Build to be queried. * * @param string $modelBuild The Model Build Sid or unique name of the Model * Build to be queried. * @return $this Fluent Builder */ public function setModelBuild(string $modelBuild): self { $this->options['modelBuild'] = $modelBuild; return $this; } /** * Constraints the query to a given Field with an task. Useful when you know the Field you are expecting. It accepts one field in the format *task-unique-name-1*:*field-unique-name* * * @param string $field Constraints the query to a given Field with an task. * Useful when you know the Field you are expecting. It * accepts one field in the format * task-unique-name-1:field-unique-name * @return $this Fluent Builder */ public function setField(string $field): self { $this->options['field'] = $field; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Understand.CreateQueryOptions ' . $options . ']'; } } class UpdateQueryOptions extends Options { /** * @param string $sampleSid An optional reference to the Sample created from * this query. * @param string $status A string that described the query status. The values * can be: pending_review, reviewed, discarded */ public function __construct(string $sampleSid = Values::NONE, string $status = Values::NONE) { $this->options['sampleSid'] = $sampleSid; $this->options['status'] = $status; } /** * An optional reference to the Sample created from this query. * * @param string $sampleSid An optional reference to the Sample created from * this query. * @return $this Fluent Builder */ public function setSampleSid(string $sampleSid): self { $this->options['sampleSid'] = $sampleSid; return $this; } /** * A string that described the query status. The values can be: pending_review, reviewed, discarded * * @param string $status A string that described the query status. The values * can be: pending_review, reviewed, discarded * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Understand.UpdateQueryOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/AssistantInitiationActionsList.php000064400000002541150515725670024126 0ustar00solution = ['assistantSid' => $assistantSid, ]; } /** * Constructs a AssistantInitiationActionsContext */ public function getContext(): AssistantInitiationActionsContext { return new AssistantInitiationActionsContext($this->version, $this->solution['assistantSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Understand.AssistantInitiationActionsList]'; } }src/Twilio/Rest/Preview/Understand/Assistant/QueryContext.php000064400000005653150515725670020431 0ustar00solution = ['assistantSid' => $assistantSid, 'sid' => $sid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/Queries/' . \rawurlencode($sid) . ''; } /** * Fetch the QueryInstance * * @return QueryInstance Fetched QueryInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): QueryInstance { $payload = $this->version->fetch('GET', $this->uri); return new QueryInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['sid'] ); } /** * Update the QueryInstance * * @param array|Options $options Optional Arguments * @return QueryInstance Updated QueryInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): QueryInstance { $options = new Values($options); $data = Values::of(['SampleSid' => $options['sampleSid'], 'Status' => $options['status'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new QueryInstance( $this->version, $payload, $this->solution['assistantSid'], $this->solution['sid'] ); } /** * Delete the QueryInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Understand.QueryContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/FieldTypePage.php000064400000002640150515725670020432 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return FieldTypeInstance \Twilio\Rest\Preview\Understand\Assistant\FieldTypeInstance */ public function buildInstance(array $payload): FieldTypeInstance { return new FieldTypeInstance($this->version, $payload, $this->solution['assistantSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Understand.FieldTypePage]'; } }src/Twilio/Rest/Preview/Understand/Assistant/FieldTypeOptions.php000064400000011634150515725670021214 0ustar00options['friendlyName'] = $friendlyName; } /** * A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. * * @param string $friendlyName A user-provided string that identifies this * resource. It is non-unique and can up to 255 * characters long. * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Understand.CreateFieldTypeOptions ' . $options . ']'; } } class UpdateFieldTypeOptions extends Options { /** * @param string $friendlyName A user-provided string that identifies this * resource. It is non-unique and can up to 255 * characters long. * @param string $uniqueName A user-provided string that uniquely identifies * this resource as an alternative to the sid. Unique * up to 64 characters long. */ public function __construct(string $friendlyName = Values::NONE, string $uniqueName = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['uniqueName'] = $uniqueName; } /** * A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. * * @param string $friendlyName A user-provided string that identifies this * resource. It is non-unique and can up to 255 * characters long. * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. * * @param string $uniqueName A user-provided string that uniquely identifies * this resource as an alternative to the sid. Unique * up to 64 characters long. * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Understand.UpdateFieldTypeOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/AssistantInitiationActionsOptions.php000064400000003375150515725670024654 0ustar00options['initiationActions'] = $initiationActions; } /** * The initiation_actions * * @param array $initiationActions The initiation_actions * @return $this Fluent Builder */ public function setInitiationActions(array $initiationActions): self { $this->options['initiationActions'] = $initiationActions; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Understand.UpdateAssistantInitiationActionsOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/StyleSheetContext.php000064400000004637150515725670021416 0ustar00solution = ['assistantSid' => $assistantSid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/StyleSheet'; } /** * Fetch the StyleSheetInstance * * @return StyleSheetInstance Fetched StyleSheetInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): StyleSheetInstance { $payload = $this->version->fetch('GET', $this->uri); return new StyleSheetInstance($this->version, $payload, $this->solution['assistantSid']); } /** * Update the StyleSheetInstance * * @param array|Options $options Optional Arguments * @return StyleSheetInstance Updated StyleSheetInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): StyleSheetInstance { $options = new Values($options); $data = Values::of(['StyleSheet' => Serialize::jsonObject($options['styleSheet']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new StyleSheetInstance($this->version, $payload, $this->solution['assistantSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Understand.StyleSheetContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/AssistantInitiationActionsContext.php000064400000005467150515725670024651 0ustar00solution = ['assistantSid' => $assistantSid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/InitiationActions'; } /** * Fetch the AssistantInitiationActionsInstance * * @return AssistantInitiationActionsInstance Fetched * AssistantInitiationActionsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AssistantInitiationActionsInstance { $payload = $this->version->fetch('GET', $this->uri); return new AssistantInitiationActionsInstance( $this->version, $payload, $this->solution['assistantSid'] ); } /** * Update the AssistantInitiationActionsInstance * * @param array|Options $options Optional Arguments * @return AssistantInitiationActionsInstance Updated * AssistantInitiationActionsInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): AssistantInitiationActionsInstance { $options = new Values($options); $data = Values::of(['InitiationActions' => Serialize::jsonObject($options['initiationActions']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new AssistantInitiationActionsInstance( $this->version, $payload, $this->solution['assistantSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Understand.AssistantInitiationActionsContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Understand/Assistant/TaskList.php000064400000013725150515725670017514 0ustar00solution = ['assistantSid' => $assistantSid, ]; $this->uri = '/Assistants/' . \rawurlencode($assistantSid) . '/Tasks'; } /** * Streams TaskInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads TaskInstance 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 TaskInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of TaskInstance 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 TaskPage Page of TaskInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): TaskPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new TaskPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of TaskInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return TaskPage Page of TaskInstance */ public function getPage(string $targetUrl): TaskPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new TaskPage($this->version, $response, $this->solution); } /** * Create the TaskInstance * * @param string $uniqueName A user-provided string that uniquely identifies * this resource as an alternative to the sid. Unique * up to 64 characters long. * @param array|Options $options Optional Arguments * @return TaskInstance Created TaskInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $uniqueName, array $options = []): TaskInstance { $options = new Values($options); $data = Values::of([ 'UniqueName' => $uniqueName, 'FriendlyName' => $options['friendlyName'], 'Actions' => Serialize::jsonObject($options['actions']), 'ActionsUrl' => $options['actionsUrl'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new TaskInstance($this->version, $payload, $this->solution['assistantSid']); } /** * Constructs a TaskContext * * @param string $sid A 34 character string that uniquely identifies this * resource. */ public function getContext(string $sid): TaskContext { return new TaskContext($this->version, $this->solution['assistantSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Understand.TaskList]'; } }src/Twilio/Rest/Preview/Understand/Assistant/TaskPage.php000064400000002602150515725670017445 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return TaskInstance \Twilio\Rest\Preview\Understand\Assistant\TaskInstance */ public function buildInstance(array $payload): TaskInstance { return new TaskInstance($this->version, $payload, $this->solution['assistantSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Understand.TaskPage]'; } }src/Twilio/Rest/Preview/Understand/AssistantContext.php000064400000021030150515725670017307 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Assistants/' . \rawurlencode($sid) . ''; } /** * Fetch the AssistantInstance * * @return AssistantInstance Fetched AssistantInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AssistantInstance { $payload = $this->version->fetch('GET', $this->uri); return new AssistantInstance($this->version, $payload, $this->solution['sid']); } /** * Update the AssistantInstance * * @param array|Options $options Optional Arguments * @return AssistantInstance Updated AssistantInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): AssistantInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'LogQueries' => Serialize::booleanToString($options['logQueries']), 'UniqueName' => $options['uniqueName'], 'CallbackUrl' => $options['callbackUrl'], 'CallbackEvents' => $options['callbackEvents'], 'FallbackActions' => Serialize::jsonObject($options['fallbackActions']), 'InitiationActions' => Serialize::jsonObject($options['initiationActions']), 'StyleSheet' => Serialize::jsonObject($options['styleSheet']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new AssistantInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the AssistantInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the fieldTypes */ protected function getFieldTypes(): FieldTypeList { if (!$this->_fieldTypes) { $this->_fieldTypes = new FieldTypeList($this->version, $this->solution['sid']); } return $this->_fieldTypes; } /** * Access the tasks */ protected function getTasks(): TaskList { if (!$this->_tasks) { $this->_tasks = new TaskList($this->version, $this->solution['sid']); } return $this->_tasks; } /** * Access the modelBuilds */ protected function getModelBuilds(): ModelBuildList { if (!$this->_modelBuilds) { $this->_modelBuilds = new ModelBuildList($this->version, $this->solution['sid']); } return $this->_modelBuilds; } /** * Access the queries */ protected function getQueries(): QueryList { if (!$this->_queries) { $this->_queries = new QueryList($this->version, $this->solution['sid']); } return $this->_queries; } /** * Access the assistantFallbackActions */ protected function getAssistantFallbackActions(): AssistantFallbackActionsList { if (!$this->_assistantFallbackActions) { $this->_assistantFallbackActions = new AssistantFallbackActionsList( $this->version, $this->solution['sid'] ); } return $this->_assistantFallbackActions; } /** * Access the assistantInitiationActions */ protected function getAssistantInitiationActions(): AssistantInitiationActionsList { if (!$this->_assistantInitiationActions) { $this->_assistantInitiationActions = new AssistantInitiationActionsList( $this->version, $this->solution['sid'] ); } return $this->_assistantInitiationActions; } /** * Access the dialogues */ protected function getDialogues(): DialogueList { if (!$this->_dialogues) { $this->_dialogues = new DialogueList($this->version, $this->solution['sid']); } return $this->_dialogues; } /** * Access the styleSheet */ protected function getStyleSheet(): StyleSheetList { if (!$this->_styleSheet) { $this->_styleSheet = new StyleSheetList($this->version, $this->solution['sid']); } return $this->_styleSheet; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Understand.AssistantContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/TrustedComms.php000064400000006424150515725670014325 0ustar00version = 'TrustedComms'; } protected function getBrandedChannels(): BrandedChannelList { if (!$this->_brandedChannels) { $this->_brandedChannels = new BrandedChannelList($this); } return $this->_brandedChannels; } protected function getBrandsInformation(): BrandsInformationList { if (!$this->_brandsInformation) { $this->_brandsInformation = new BrandsInformationList($this); } return $this->_brandsInformation; } protected function getCps(): CpsList { if (!$this->_cps) { $this->_cps = new CpsList($this); } return $this->_cps; } protected function getCurrentCalls(): CurrentCallList { if (!$this->_currentCalls) { $this->_currentCalls = new CurrentCallList($this); } return $this->_currentCalls; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Preview.TrustedComms]'; } }src/Twilio/Rest/Preview/Marketplace.php000064400000005400150515725670014115 0ustar00version = 'marketplace'; } protected function getAvailableAddOns(): AvailableAddOnList { if (!$this->_availableAddOns) { $this->_availableAddOns = new AvailableAddOnList($this); } return $this->_availableAddOns; } protected function getInstalledAddOns(): InstalledAddOnList { if (!$this->_installedAddOns) { $this->_installedAddOns = new InstalledAddOnList($this); } return $this->_installedAddOns; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Preview.Marketplace]'; } }src/Twilio/Rest/Preview/DeployedDevices/FleetPage.php000064400000002542150515725670016575 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return FleetInstance \Twilio\Rest\Preview\DeployedDevices\FleetInstance */ public function buildInstance(array $payload): FleetInstance { return new FleetInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.DeployedDevices.FleetPage]'; } }src/Twilio/Rest/Preview/DeployedDevices/FleetList.php000064400000012426150515725670016636 0ustar00solution = []; $this->uri = '/Fleets'; } /** * Create the FleetInstance * * @param array|Options $options Optional Arguments * @return FleetInstance Created FleetInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): FleetInstance { $options = new Values($options); $data = Values::of(['FriendlyName' => $options['friendlyName'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new FleetInstance($this->version, $payload); } /** * Streams FleetInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads FleetInstance 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 FleetInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of FleetInstance 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 FleetPage Page of FleetInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): FleetPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new FleetPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of FleetInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return FleetPage Page of FleetInstance */ public function getPage(string $targetUrl): FleetPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new FleetPage($this->version, $response, $this->solution); } /** * Constructs a FleetContext * * @param string $sid A string that uniquely identifies the Fleet. */ public function getContext(string $sid): FleetContext { return new FleetContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.DeployedDevices.FleetList]'; } }src/Twilio/Rest/Preview/DeployedDevices/FleetOptions.php000064400000007256150515725670017363 0ustar00options['friendlyName'] = $friendlyName; } /** * Provides a human readable descriptive text for this Fleet, up to 256 characters long. * * @param string $friendlyName A human readable description for this Fleet. * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.DeployedDevices.CreateFleetOptions ' . $options . ']'; } } class UpdateFleetOptions extends Options { /** * @param string $friendlyName A human readable description for this Fleet. * @param string $defaultDeploymentSid A default Deployment SID. */ public function __construct(string $friendlyName = Values::NONE, string $defaultDeploymentSid = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['defaultDeploymentSid'] = $defaultDeploymentSid; } /** * Provides a human readable descriptive text for this Fleet, up to 256 characters long. * * @param string $friendlyName A human readable description for this Fleet. * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provides a string identifier of a Deployment that is going to be used as a default one for this Fleet. * * @param string $defaultDeploymentSid A default Deployment SID. * @return $this Fluent Builder */ public function setDefaultDeploymentSid(string $defaultDeploymentSid): self { $this->options['defaultDeploymentSid'] = $defaultDeploymentSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.DeployedDevices.UpdateFleetOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/DeployedDevices/Fleet/CertificateOptions.php000064400000014411150515725670021574 0ustar00options['friendlyName'] = $friendlyName; $this->options['deviceSid'] = $deviceSid; } /** * Provides a human readable descriptive text for this Certificate credential, up to 256 characters long. * * @param string $friendlyName The human readable description for this * Certificate. * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provides the unique string identifier of an existing Device to become authenticated with this Certificate credential. * * @param string $deviceSid The unique identifier of a Device to be * authenticated. * @return $this Fluent Builder */ public function setDeviceSid(string $deviceSid): self { $this->options['deviceSid'] = $deviceSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.DeployedDevices.CreateCertificateOptions ' . $options . ']'; } } class ReadCertificateOptions extends Options { /** * @param string $deviceSid Find all Certificates authenticating specified * Device. */ public function __construct(string $deviceSid = Values::NONE) { $this->options['deviceSid'] = $deviceSid; } /** * Filters the resulting list of Certificates by a unique string identifier of an authenticated Device. * * @param string $deviceSid Find all Certificates authenticating specified * Device. * @return $this Fluent Builder */ public function setDeviceSid(string $deviceSid): self { $this->options['deviceSid'] = $deviceSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.DeployedDevices.ReadCertificateOptions ' . $options . ']'; } } class UpdateCertificateOptions extends Options { /** * @param string $friendlyName The human readable description for this * Certificate. * @param string $deviceSid The unique identifier of a Device to be * authenticated. */ public function __construct(string $friendlyName = Values::NONE, string $deviceSid = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['deviceSid'] = $deviceSid; } /** * Provides a human readable descriptive text for this Certificate credential, up to 256 characters long. * * @param string $friendlyName The human readable description for this * Certificate. * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provides the unique string identifier of an existing Device to become authenticated with this Certificate credential. * * @param string $deviceSid The unique identifier of a Device to be * authenticated. * @return $this Fluent Builder */ public function setDeviceSid(string $deviceSid): self { $this->options['deviceSid'] = $deviceSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.DeployedDevices.UpdateCertificateOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/DeployedDevices/Fleet/DeploymentList.php000064400000013277150515725670020763 0ustar00solution = ['fleetSid' => $fleetSid, ]; $this->uri = '/Fleets/' . \rawurlencode($fleetSid) . '/Deployments'; } /** * Create the DeploymentInstance * * @param array|Options $options Optional Arguments * @return DeploymentInstance Created DeploymentInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): DeploymentInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'SyncServiceSid' => $options['syncServiceSid'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new DeploymentInstance($this->version, $payload, $this->solution['fleetSid']); } /** * Streams DeploymentInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads DeploymentInstance 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 DeploymentInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of DeploymentInstance 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 DeploymentPage Page of DeploymentInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): DeploymentPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new DeploymentPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of DeploymentInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return DeploymentPage Page of DeploymentInstance */ public function getPage(string $targetUrl): DeploymentPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new DeploymentPage($this->version, $response, $this->solution); } /** * Constructs a DeploymentContext * * @param string $sid A string that uniquely identifies the Deployment. */ public function getContext(string $sid): DeploymentContext { return new DeploymentContext($this->version, $this->solution['fleetSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.DeployedDevices.DeploymentList]'; } }src/Twilio/Rest/Preview/DeployedDevices/Fleet/CertificateList.php000064400000014342150515725670021057 0ustar00solution = ['fleetSid' => $fleetSid, ]; $this->uri = '/Fleets/' . \rawurlencode($fleetSid) . '/Certificates'; } /** * Create the CertificateInstance * * @param string $certificateData The public certificate data. * @param array|Options $options Optional Arguments * @return CertificateInstance Created CertificateInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $certificateData, array $options = []): CertificateInstance { $options = new Values($options); $data = Values::of([ 'CertificateData' => $certificateData, 'FriendlyName' => $options['friendlyName'], 'DeviceSid' => $options['deviceSid'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new CertificateInstance($this->version, $payload, $this->solution['fleetSid']); } /** * Streams CertificateInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads CertificateInstance 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 CertificateInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of CertificateInstance 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 CertificatePage Page of CertificateInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): CertificatePage { $options = new Values($options); $params = Values::of([ 'DeviceSid' => $options['deviceSid'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new CertificatePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of CertificateInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return CertificatePage Page of CertificateInstance */ public function getPage(string $targetUrl): CertificatePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new CertificatePage($this->version, $response, $this->solution); } /** * Constructs a CertificateContext * * @param string $sid A string that uniquely identifies the Certificate. */ public function getContext(string $sid): CertificateContext { return new CertificateContext($this->version, $this->solution['fleetSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.DeployedDevices.CertificateList]'; } }src/Twilio/Rest/Preview/DeployedDevices/Fleet/CertificateInstance.php000064400000011046150515725670021706 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'url' => Values::array_get($payload, 'url'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'fleetSid' => Values::array_get($payload, 'fleet_sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'deviceSid' => Values::array_get($payload, 'device_sid'), 'thumbprint' => Values::array_get($payload, 'thumbprint'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), ]; $this->solution = ['fleetSid' => $fleetSid, '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 CertificateContext Context for this CertificateInstance */ protected function proxy(): CertificateContext { if (!$this->context) { $this->context = new CertificateContext( $this->version, $this->solution['fleetSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the CertificateInstance * * @return CertificateInstance Fetched CertificateInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CertificateInstance { return $this->proxy()->fetch(); } /** * Delete the CertificateInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the CertificateInstance * * @param array|Options $options Optional Arguments * @return CertificateInstance Updated CertificateInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): CertificateInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.DeployedDevices.CertificateInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/DeployedDevices/Fleet/DeviceInstance.php000064400000011462150515725670020665 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'url' => Values::array_get($payload, 'url'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'fleetSid' => Values::array_get($payload, 'fleet_sid'), 'enabled' => Values::array_get($payload, 'enabled'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'identity' => Values::array_get($payload, 'identity'), 'deploymentSid' => Values::array_get($payload, 'deployment_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'dateAuthenticated' => Deserialize::dateTime(Values::array_get($payload, 'date_authenticated')), ]; $this->solution = ['fleetSid' => $fleetSid, '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 DeviceContext Context for this DeviceInstance */ protected function proxy(): DeviceContext { if (!$this->context) { $this->context = new DeviceContext( $this->version, $this->solution['fleetSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the DeviceInstance * * @return DeviceInstance Fetched DeviceInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): DeviceInstance { return $this->proxy()->fetch(); } /** * Delete the DeviceInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the DeviceInstance * * @param array|Options $options Optional Arguments * @return DeviceInstance Updated DeviceInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): DeviceInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.DeployedDevices.DeviceInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/DeployedDevices/Fleet/KeyContext.php000064400000005540150515725670020076 0ustar00solution = ['fleetSid' => $fleetSid, 'sid' => $sid, ]; $this->uri = '/Fleets/' . \rawurlencode($fleetSid) . '/Keys/' . \rawurlencode($sid) . ''; } /** * Fetch the KeyInstance * * @return KeyInstance Fetched KeyInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): KeyInstance { $payload = $this->version->fetch('GET', $this->uri); return new KeyInstance( $this->version, $payload, $this->solution['fleetSid'], $this->solution['sid'] ); } /** * Delete the KeyInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the KeyInstance * * @param array|Options $options Optional Arguments * @return KeyInstance Updated KeyInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): KeyInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'DeviceSid' => $options['deviceSid'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new KeyInstance( $this->version, $payload, $this->solution['fleetSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.DeployedDevices.KeyContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/DeployedDevices/Fleet/DevicePage.php000064400000002621150515725670017772 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return DeviceInstance \Twilio\Rest\Preview\DeployedDevices\Fleet\DeviceInstance */ public function buildInstance(array $payload): DeviceInstance { return new DeviceInstance($this->version, $payload, $this->solution['fleetSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.DeployedDevices.DevicePage]'; } }src/Twilio/Rest/Preview/DeployedDevices/Fleet/KeyList.php000064400000013603150515725670017364 0ustar00solution = ['fleetSid' => $fleetSid, ]; $this->uri = '/Fleets/' . \rawurlencode($fleetSid) . '/Keys'; } /** * Create the KeyInstance * * @param array|Options $options Optional Arguments * @return KeyInstance Created KeyInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): KeyInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'DeviceSid' => $options['deviceSid'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new KeyInstance($this->version, $payload, $this->solution['fleetSid']); } /** * Streams KeyInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads KeyInstance 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 KeyInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of KeyInstance 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 KeyPage Page of KeyInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): KeyPage { $options = new Values($options); $params = Values::of([ 'DeviceSid' => $options['deviceSid'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new KeyPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of KeyInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return KeyPage Page of KeyInstance */ public function getPage(string $targetUrl): KeyPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new KeyPage($this->version, $response, $this->solution); } /** * Constructs a KeyContext * * @param string $sid A string that uniquely identifies the Key. */ public function getContext(string $sid): KeyContext { return new KeyContext($this->version, $this->solution['fleetSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.DeployedDevices.KeyList]'; } }src/Twilio/Rest/Preview/DeployedDevices/Fleet/DeviceOptions.php000064400000021204150515725670020547 0ustar00options['uniqueName'] = $uniqueName; $this->options['friendlyName'] = $friendlyName; $this->options['identity'] = $identity; $this->options['deploymentSid'] = $deploymentSid; $this->options['enabled'] = $enabled; } /** * Provides a unique and addressable name to be assigned to this Device, to be used in addition to SID, up to 128 characters long. * * @param string $uniqueName A unique, addressable name of this Device. * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * Provides a human readable descriptive text to be assigned to this Device, up to 256 characters long. * * @param string $friendlyName A human readable description for this Device. * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provides an arbitrary string identifier representing a human user to be associated with this Device, up to 256 characters long. * * @param string $identity An identifier of the Device user. * @return $this Fluent Builder */ public function setIdentity(string $identity): self { $this->options['identity'] = $identity; return $this; } /** * Specifies the unique string identifier of the Deployment group that this Device is going to be associated with. * * @param string $deploymentSid The unique SID of the Deployment group. * @return $this Fluent Builder */ public function setDeploymentSid(string $deploymentSid): self { $this->options['deploymentSid'] = $deploymentSid; return $this; } /** * The enabled * * @param bool $enabled The enabled * @return $this Fluent Builder */ public function setEnabled(bool $enabled): self { $this->options['enabled'] = $enabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.DeployedDevices.CreateDeviceOptions ' . $options . ']'; } } class ReadDeviceOptions extends Options { /** * @param string $deploymentSid Find all Devices grouped under the specified * Deployment. */ public function __construct(string $deploymentSid = Values::NONE) { $this->options['deploymentSid'] = $deploymentSid; } /** * Filters the resulting list of Devices by a unique string identifier of the Deployment they are associated with. * * @param string $deploymentSid Find all Devices grouped under the specified * Deployment. * @return $this Fluent Builder */ public function setDeploymentSid(string $deploymentSid): self { $this->options['deploymentSid'] = $deploymentSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.DeployedDevices.ReadDeviceOptions ' . $options . ']'; } } class UpdateDeviceOptions extends Options { /** * @param string $friendlyName A human readable description for this Device. * @param string $identity An identifier of the Device user. * @param string $deploymentSid The unique SID of the Deployment group. * @param bool $enabled The enabled */ public function __construct(string $friendlyName = Values::NONE, string $identity = Values::NONE, string $deploymentSid = Values::NONE, bool $enabled = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['identity'] = $identity; $this->options['deploymentSid'] = $deploymentSid; $this->options['enabled'] = $enabled; } /** * Provides a human readable descriptive text to be assigned to this Device, up to 256 characters long. * * @param string $friendlyName A human readable description for this Device. * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provides an arbitrary string identifier representing a human user to be associated with this Device, up to 256 characters long. * * @param string $identity An identifier of the Device user. * @return $this Fluent Builder */ public function setIdentity(string $identity): self { $this->options['identity'] = $identity; return $this; } /** * Specifies the unique string identifier of the Deployment group that this Device is going to be associated with. * * @param string $deploymentSid The unique SID of the Deployment group. * @return $this Fluent Builder */ public function setDeploymentSid(string $deploymentSid): self { $this->options['deploymentSid'] = $deploymentSid; return $this; } /** * The enabled * * @param bool $enabled The enabled * @return $this Fluent Builder */ public function setEnabled(bool $enabled): self { $this->options['enabled'] = $enabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.DeployedDevices.UpdateDeviceOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/DeployedDevices/Fleet/KeyInstance.php000064400000010622150515725670020213 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'url' => Values::array_get($payload, 'url'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'fleetSid' => Values::array_get($payload, 'fleet_sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'deviceSid' => Values::array_get($payload, 'device_sid'), 'secret' => Values::array_get($payload, 'secret'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), ]; $this->solution = ['fleetSid' => $fleetSid, '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 KeyContext Context for this KeyInstance */ protected function proxy(): KeyContext { if (!$this->context) { $this->context = new KeyContext( $this->version, $this->solution['fleetSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the KeyInstance * * @return KeyInstance Fetched KeyInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): KeyInstance { return $this->proxy()->fetch(); } /** * Delete the KeyInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the KeyInstance * * @param array|Options $options Optional Arguments * @return KeyInstance Updated KeyInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): KeyInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.DeployedDevices.KeyInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/DeployedDevices/Fleet/DeploymentContext.php000064400000005732150515725670021471 0ustar00solution = ['fleetSid' => $fleetSid, 'sid' => $sid, ]; $this->uri = '/Fleets/' . \rawurlencode($fleetSid) . '/Deployments/' . \rawurlencode($sid) . ''; } /** * Fetch the DeploymentInstance * * @return DeploymentInstance Fetched DeploymentInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): DeploymentInstance { $payload = $this->version->fetch('GET', $this->uri); return new DeploymentInstance( $this->version, $payload, $this->solution['fleetSid'], $this->solution['sid'] ); } /** * Delete the DeploymentInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the DeploymentInstance * * @param array|Options $options Optional Arguments * @return DeploymentInstance Updated DeploymentInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): DeploymentInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'SyncServiceSid' => $options['syncServiceSid'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new DeploymentInstance( $this->version, $payload, $this->solution['fleetSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.DeployedDevices.DeploymentContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/DeployedDevices/Fleet/CertificateContext.php000064400000005740150515725670021572 0ustar00solution = ['fleetSid' => $fleetSid, 'sid' => $sid, ]; $this->uri = '/Fleets/' . \rawurlencode($fleetSid) . '/Certificates/' . \rawurlencode($sid) . ''; } /** * Fetch the CertificateInstance * * @return CertificateInstance Fetched CertificateInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CertificateInstance { $payload = $this->version->fetch('GET', $this->uri); return new CertificateInstance( $this->version, $payload, $this->solution['fleetSid'], $this->solution['sid'] ); } /** * Delete the CertificateInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the CertificateInstance * * @param array|Options $options Optional Arguments * @return CertificateInstance Updated CertificateInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): CertificateInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'DeviceSid' => $options['deviceSid'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new CertificateInstance( $this->version, $payload, $this->solution['fleetSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.DeployedDevices.CertificateContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/DeployedDevices/Fleet/KeyPage.php000064400000002577150515725670017335 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return KeyInstance \Twilio\Rest\Preview\DeployedDevices\Fleet\KeyInstance */ public function buildInstance(array $payload): KeyInstance { return new KeyInstance($this->version, $payload, $this->solution['fleetSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.DeployedDevices.KeyPage]'; } }src/Twilio/Rest/Preview/DeployedDevices/Fleet/DeploymentPage.php000064400000002651150515725670020716 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return DeploymentInstance \Twilio\Rest\Preview\DeployedDevices\Fleet\DeploymentInstance */ public function buildInstance(array $payload): DeploymentInstance { return new DeploymentInstance($this->version, $payload, $this->solution['fleetSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.DeployedDevices.DeploymentPage]'; } }src/Twilio/Rest/Preview/DeployedDevices/Fleet/CertificatePage.php000064400000002657150515725670021026 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CertificateInstance \Twilio\Rest\Preview\DeployedDevices\Fleet\CertificateInstance */ public function buildInstance(array $payload): CertificateInstance { return new CertificateInstance($this->version, $payload, $this->solution['fleetSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.DeployedDevices.CertificatePage]'; } }src/Twilio/Rest/Preview/DeployedDevices/Fleet/DeploymentOptions.php000064400000011435150515725670021475 0ustar00options['friendlyName'] = $friendlyName; $this->options['syncServiceSid'] = $syncServiceSid; } /** * Provides a human readable descriptive text for this Deployment, up to 256 characters long. * * @param string $friendlyName A human readable description for this Deployment. * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provides the unique string identifier of the Twilio Sync service instance that will be linked to and accessible by this Deployment. * * @param string $syncServiceSid The unique identifier of the Sync service * instance. * @return $this Fluent Builder */ public function setSyncServiceSid(string $syncServiceSid): self { $this->options['syncServiceSid'] = $syncServiceSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.DeployedDevices.CreateDeploymentOptions ' . $options . ']'; } } class UpdateDeploymentOptions extends Options { /** * @param string $friendlyName A human readable description for this Deployment. * @param string $syncServiceSid The unique identifier of the Sync service * instance. */ public function __construct(string $friendlyName = Values::NONE, string $syncServiceSid = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['syncServiceSid'] = $syncServiceSid; } /** * Provides a human readable descriptive text for this Deployment, up to 64 characters long * * @param string $friendlyName A human readable description for this Deployment. * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provides the unique string identifier of the Twilio Sync service instance that will be linked to and accessible by this Deployment. * * @param string $syncServiceSid The unique identifier of the Sync service * instance. * @return $this Fluent Builder */ public function setSyncServiceSid(string $syncServiceSid): self { $this->options['syncServiceSid'] = $syncServiceSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.DeployedDevices.UpdateDeploymentOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/DeployedDevices/Fleet/DeploymentInstance.php000064400000010676150515725670021614 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'url' => Values::array_get($payload, 'url'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'fleetSid' => Values::array_get($payload, 'fleet_sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'syncServiceSid' => Values::array_get($payload, 'sync_service_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), ]; $this->solution = ['fleetSid' => $fleetSid, '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 DeploymentContext Context for this DeploymentInstance */ protected function proxy(): DeploymentContext { if (!$this->context) { $this->context = new DeploymentContext( $this->version, $this->solution['fleetSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the DeploymentInstance * * @return DeploymentInstance Fetched DeploymentInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): DeploymentInstance { return $this->proxy()->fetch(); } /** * Delete the DeploymentInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the DeploymentInstance * * @param array|Options $options Optional Arguments * @return DeploymentInstance Updated DeploymentInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): DeploymentInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.DeployedDevices.DeploymentInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/DeployedDevices/Fleet/KeyOptions.php000064400000013025150515725670020102 0ustar00options['friendlyName'] = $friendlyName; $this->options['deviceSid'] = $deviceSid; } /** * Provides a human readable descriptive text for this Key credential, up to 256 characters long. * * @param string $friendlyName The human readable description for this Key. * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provides the unique string identifier of an existing Device to become authenticated with this Key credential. * * @param string $deviceSid The unique identifier of a Key to be authenticated. * @return $this Fluent Builder */ public function setDeviceSid(string $deviceSid): self { $this->options['deviceSid'] = $deviceSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.DeployedDevices.CreateKeyOptions ' . $options . ']'; } } class ReadKeyOptions extends Options { /** * @param string $deviceSid Find all Keys authenticating specified Device. */ public function __construct(string $deviceSid = Values::NONE) { $this->options['deviceSid'] = $deviceSid; } /** * Filters the resulting list of Keys by a unique string identifier of an authenticated Device. * * @param string $deviceSid Find all Keys authenticating specified Device. * @return $this Fluent Builder */ public function setDeviceSid(string $deviceSid): self { $this->options['deviceSid'] = $deviceSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.DeployedDevices.ReadKeyOptions ' . $options . ']'; } } class UpdateKeyOptions extends Options { /** * @param string $friendlyName The human readable description for this Key. * @param string $deviceSid The unique identifier of a Key to be authenticated. */ public function __construct(string $friendlyName = Values::NONE, string $deviceSid = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['deviceSid'] = $deviceSid; } /** * Provides a human readable descriptive text for this Key credential, up to 256 characters long. * * @param string $friendlyName The human readable description for this Key. * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provides the unique string identifier of an existing Device to become authenticated with this Key credential. * * @param string $deviceSid The unique identifier of a Key to be authenticated. * @return $this Fluent Builder */ public function setDeviceSid(string $deviceSid): self { $this->options['deviceSid'] = $deviceSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.DeployedDevices.UpdateKeyOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/DeployedDevices/Fleet/DeviceList.php000064400000014245150515725670020036 0ustar00solution = ['fleetSid' => $fleetSid, ]; $this->uri = '/Fleets/' . \rawurlencode($fleetSid) . '/Devices'; } /** * Create the DeviceInstance * * @param array|Options $options Optional Arguments * @return DeviceInstance Created DeviceInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): DeviceInstance { $options = new Values($options); $data = Values::of([ 'UniqueName' => $options['uniqueName'], 'FriendlyName' => $options['friendlyName'], 'Identity' => $options['identity'], 'DeploymentSid' => $options['deploymentSid'], 'Enabled' => Serialize::booleanToString($options['enabled']), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new DeviceInstance($this->version, $payload, $this->solution['fleetSid']); } /** * Streams DeviceInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param array|Options $options Optional Arguments * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads DeviceInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param array|Options $options Optional Arguments * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return DeviceInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of DeviceInstance records from the API. * Request is executed immediately * * @param array|Options $options Optional Arguments * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return DevicePage Page of DeviceInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): DevicePage { $options = new Values($options); $params = Values::of([ 'DeploymentSid' => $options['deploymentSid'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new DevicePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of DeviceInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return DevicePage Page of DeviceInstance */ public function getPage(string $targetUrl): DevicePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new DevicePage($this->version, $response, $this->solution); } /** * Constructs a DeviceContext * * @param string $sid A string that uniquely identifies the Device. */ public function getContext(string $sid): DeviceContext { return new DeviceContext($this->version, $this->solution['fleetSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.DeployedDevices.DeviceList]'; } }src/Twilio/Rest/Preview/DeployedDevices/Fleet/DeviceContext.php000064400000006050150515725670020542 0ustar00solution = ['fleetSid' => $fleetSid, 'sid' => $sid, ]; $this->uri = '/Fleets/' . \rawurlencode($fleetSid) . '/Devices/' . \rawurlencode($sid) . ''; } /** * Fetch the DeviceInstance * * @return DeviceInstance Fetched DeviceInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): DeviceInstance { $payload = $this->version->fetch('GET', $this->uri); return new DeviceInstance( $this->version, $payload, $this->solution['fleetSid'], $this->solution['sid'] ); } /** * Delete the DeviceInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the DeviceInstance * * @param array|Options $options Optional Arguments * @return DeviceInstance Updated DeviceInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): DeviceInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'Identity' => $options['identity'], 'DeploymentSid' => $options['deploymentSid'], 'Enabled' => Serialize::booleanToString($options['enabled']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new DeviceInstance( $this->version, $payload, $this->solution['fleetSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.DeployedDevices.DeviceContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/DeployedDevices/FleetInstance.php000064400000012246150515725670017467 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'url' => Values::array_get($payload, 'url'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'defaultDeploymentSid' => Values::array_get($payload, 'default_deployment_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 FleetContext Context for this FleetInstance */ protected function proxy(): FleetContext { if (!$this->context) { $this->context = new FleetContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the FleetInstance * * @return FleetInstance Fetched FleetInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FleetInstance { return $this->proxy()->fetch(); } /** * Delete the FleetInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the FleetInstance * * @param array|Options $options Optional Arguments * @return FleetInstance Updated FleetInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): FleetInstance { return $this->proxy()->update($options); } /** * Access the devices */ protected function getDevices(): DeviceList { return $this->proxy()->devices; } /** * Access the deployments */ protected function getDeployments(): DeploymentList { return $this->proxy()->deployments; } /** * Access the certificates */ protected function getCertificates(): CertificateList { return $this->proxy()->certificates; } /** * Access the keys */ protected function getKeys(): KeyList { return $this->proxy()->keys; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.DeployedDevices.FleetInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/DeployedDevices/FleetContext.php000064400000013175150515725670017351 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Fleets/' . \rawurlencode($sid) . ''; } /** * Fetch the FleetInstance * * @return FleetInstance Fetched FleetInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FleetInstance { $payload = $this->version->fetch('GET', $this->uri); return new FleetInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the FleetInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the FleetInstance * * @param array|Options $options Optional Arguments * @return FleetInstance Updated FleetInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): FleetInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'DefaultDeploymentSid' => $options['defaultDeploymentSid'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new FleetInstance($this->version, $payload, $this->solution['sid']); } /** * Access the devices */ protected function getDevices(): DeviceList { if (!$this->_devices) { $this->_devices = new DeviceList($this->version, $this->solution['sid']); } return $this->_devices; } /** * Access the deployments */ protected function getDeployments(): DeploymentList { if (!$this->_deployments) { $this->_deployments = new DeploymentList($this->version, $this->solution['sid']); } return $this->_deployments; } /** * Access the certificates */ protected function getCertificates(): CertificateList { if (!$this->_certificates) { $this->_certificates = new CertificateList($this->version, $this->solution['sid']); } return $this->_certificates; } /** * Access the keys */ protected function getKeys(): KeyList { if (!$this->_keys) { $this->_keys = new KeyList($this->version, $this->solution['sid']); } return $this->_keys; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.DeployedDevices.FleetContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/HostedNumbers.php000064400000005610150515725670014452 0ustar00version = 'HostedNumbers'; } protected function getAuthorizationDocuments(): AuthorizationDocumentList { if (!$this->_authorizationDocuments) { $this->_authorizationDocuments = new AuthorizationDocumentList($this); } return $this->_authorizationDocuments; } protected function getHostedNumberOrders(): HostedNumberOrderList { if (!$this->_hostedNumberOrders) { $this->_hostedNumberOrders = new HostedNumberOrderList($this); } return $this->_hostedNumberOrders; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Preview.HostedNumbers]'; } }src/Twilio/Rest/Preview/Marketplace/AvailableAddOnPage.php000064400000002614150515725670017504 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return AvailableAddOnInstance \Twilio\Rest\Preview\Marketplace\AvailableAddOnInstance */ public function buildInstance(array $payload): AvailableAddOnInstance { return new AvailableAddOnInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Marketplace.AvailableAddOnPage]'; } }src/Twilio/Rest/Preview/Marketplace/InstalledAddOnPage.php000064400000002614150515725670017543 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return InstalledAddOnInstance \Twilio\Rest\Preview\Marketplace\InstalledAddOnInstance */ public function buildInstance(array $payload): InstalledAddOnInstance { return new InstalledAddOnInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Marketplace.InstalledAddOnPage]'; } }src/Twilio/Rest/Preview/Marketplace/InstalledAddOnContext.php000064400000010720150515725670020310 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/InstalledAddOns/' . \rawurlencode($sid) . ''; } /** * Delete the InstalledAddOnInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Fetch the InstalledAddOnInstance * * @return InstalledAddOnInstance Fetched InstalledAddOnInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): InstalledAddOnInstance { $payload = $this->version->fetch('GET', $this->uri); return new InstalledAddOnInstance($this->version, $payload, $this->solution['sid']); } /** * Update the InstalledAddOnInstance * * @param array|Options $options Optional Arguments * @return InstalledAddOnInstance Updated InstalledAddOnInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): InstalledAddOnInstance { $options = new Values($options); $data = Values::of([ 'Configuration' => Serialize::jsonObject($options['configuration']), 'UniqueName' => $options['uniqueName'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new InstalledAddOnInstance($this->version, $payload, $this->solution['sid']); } /** * Access the extensions */ protected function getExtensions(): InstalledAddOnExtensionList { if (!$this->_extensions) { $this->_extensions = new InstalledAddOnExtensionList($this->version, $this->solution['sid']); } return $this->_extensions; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Marketplace.InstalledAddOnContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Marketplace/AvailableAddOnInstance.php000064400000007353150515725670020401 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'description' => Values::array_get($payload, 'description'), 'pricingType' => Values::array_get($payload, 'pricing_type'), 'configurationSchema' => Values::array_get($payload, 'configuration_schema'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 AvailableAddOnContext Context for this AvailableAddOnInstance */ protected function proxy(): AvailableAddOnContext { if (!$this->context) { $this->context = new AvailableAddOnContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the AvailableAddOnInstance * * @return AvailableAddOnInstance Fetched AvailableAddOnInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AvailableAddOnInstance { return $this->proxy()->fetch(); } /** * Access the extensions */ protected function getExtensions(): AvailableAddOnExtensionList { return $this->proxy()->extensions; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Marketplace.AvailableAddOnInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Marketplace/AvailableAddOnContext.php000064400000006675150515725670020267 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/AvailableAddOns/' . \rawurlencode($sid) . ''; } /** * Fetch the AvailableAddOnInstance * * @return AvailableAddOnInstance Fetched AvailableAddOnInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AvailableAddOnInstance { $payload = $this->version->fetch('GET', $this->uri); return new AvailableAddOnInstance($this->version, $payload, $this->solution['sid']); } /** * Access the extensions */ protected function getExtensions(): AvailableAddOnExtensionList { if (!$this->_extensions) { $this->_extensions = new AvailableAddOnExtensionList($this->version, $this->solution['sid']); } return $this->_extensions; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Marketplace.AvailableAddOnContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Marketplace/AvailableAddOnList.php000064400000011550150515725670017542 0ustar00solution = []; $this->uri = '/AvailableAddOns'; } /** * Streams AvailableAddOnInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads AvailableAddOnInstance 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 AvailableAddOnInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of AvailableAddOnInstance 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 AvailableAddOnPage Page of AvailableAddOnInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): AvailableAddOnPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new AvailableAddOnPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of AvailableAddOnInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return AvailableAddOnPage Page of AvailableAddOnInstance */ public function getPage(string $targetUrl): AvailableAddOnPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new AvailableAddOnPage($this->version, $response, $this->solution); } /** * Constructs a AvailableAddOnContext * * @param string $sid The SID of the AvailableAddOn resource to fetch */ public function getContext(string $sid): AvailableAddOnContext { return new AvailableAddOnContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Marketplace.AvailableAddOnList]'; } }src/Twilio/Rest/Preview/Marketplace/InstalledAddOnList.php000064400000013726150515725670017610 0ustar00solution = []; $this->uri = '/InstalledAddOns'; } /** * Create the InstalledAddOnInstance * * @param string $availableAddOnSid The SID of the AvaliableAddOn to install * @param bool $acceptTermsOfService Whether the Terms of Service were accepted * @param array|Options $options Optional Arguments * @return InstalledAddOnInstance Created InstalledAddOnInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $availableAddOnSid, bool $acceptTermsOfService, array $options = []): InstalledAddOnInstance { $options = new Values($options); $data = Values::of([ 'AvailableAddOnSid' => $availableAddOnSid, 'AcceptTermsOfService' => Serialize::booleanToString($acceptTermsOfService), 'Configuration' => Serialize::jsonObject($options['configuration']), 'UniqueName' => $options['uniqueName'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new InstalledAddOnInstance($this->version, $payload); } /** * Streams InstalledAddOnInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads InstalledAddOnInstance 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 InstalledAddOnInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of InstalledAddOnInstance 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 InstalledAddOnPage Page of InstalledAddOnInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): InstalledAddOnPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new InstalledAddOnPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of InstalledAddOnInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return InstalledAddOnPage Page of InstalledAddOnInstance */ public function getPage(string $targetUrl): InstalledAddOnPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new InstalledAddOnPage($this->version, $response, $this->solution); } /** * Constructs a InstalledAddOnContext * * @param string $sid The SID of the InstalledAddOn resource to fetch */ public function getContext(string $sid): InstalledAddOnContext { return new InstalledAddOnContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Marketplace.InstalledAddOnList]'; } }src/Twilio/Rest/Preview/Marketplace/AvailableAddOn/AvailableAddOnExtensionContext.php000064400000004352150515725670024740 0ustar00solution = ['availableAddOnSid' => $availableAddOnSid, 'sid' => $sid, ]; $this->uri = '/AvailableAddOns/' . \rawurlencode($availableAddOnSid) . '/Extensions/' . \rawurlencode($sid) . ''; } /** * Fetch the AvailableAddOnExtensionInstance * * @return AvailableAddOnExtensionInstance Fetched * AvailableAddOnExtensionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AvailableAddOnExtensionInstance { $payload = $this->version->fetch('GET', $this->uri); return new AvailableAddOnExtensionInstance( $this->version, $payload, $this->solution['availableAddOnSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Marketplace.AvailableAddOnExtensionContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Marketplace/AvailableAddOn/AvailableAddOnExtensionList.php000064400000012647150515725670024235 0ustar00solution = ['availableAddOnSid' => $availableAddOnSid, ]; $this->uri = '/AvailableAddOns/' . \rawurlencode($availableAddOnSid) . '/Extensions'; } /** * Streams AvailableAddOnExtensionInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads AvailableAddOnExtensionInstance 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 AvailableAddOnExtensionInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of AvailableAddOnExtensionInstance 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 AvailableAddOnExtensionPage Page of AvailableAddOnExtensionInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): AvailableAddOnExtensionPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new AvailableAddOnExtensionPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of AvailableAddOnExtensionInstance records from the * API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return AvailableAddOnExtensionPage Page of AvailableAddOnExtensionInstance */ public function getPage(string $targetUrl): AvailableAddOnExtensionPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new AvailableAddOnExtensionPage($this->version, $response, $this->solution); } /** * Constructs a AvailableAddOnExtensionContext * * @param string $sid The SID of the AvailableAddOn Extension resource to fetch */ public function getContext(string $sid): AvailableAddOnExtensionContext { return new AvailableAddOnExtensionContext( $this->version, $this->solution['availableAddOnSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Marketplace.AvailableAddOnExtensionList]'; } }src/Twilio/Rest/Preview/Marketplace/AvailableAddOn/AvailableAddOnExtensionInstance.php000064400000007670150515725670025066 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'availableAddOnSid' => Values::array_get($payload, 'available_add_on_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'productName' => Values::array_get($payload, 'product_name'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'availableAddOnSid' => $availableAddOnSid, '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 AvailableAddOnExtensionContext Context for this * AvailableAddOnExtensionInstance */ protected function proxy(): AvailableAddOnExtensionContext { if (!$this->context) { $this->context = new AvailableAddOnExtensionContext( $this->version, $this->solution['availableAddOnSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the AvailableAddOnExtensionInstance * * @return AvailableAddOnExtensionInstance Fetched * AvailableAddOnExtensionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AvailableAddOnExtensionInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Marketplace.AvailableAddOnExtensionInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Marketplace/AvailableAddOn/AvailableAddOnExtensionPage.php000064400000003064150515725670024167 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return AvailableAddOnExtensionInstance \Twilio\Rest\Preview\Marketplace\AvailableAddOn\AvailableAddOnExtensionInstance */ public function buildInstance(array $payload): AvailableAddOnExtensionInstance { return new AvailableAddOnExtensionInstance( $this->version, $payload, $this->solution['availableAddOnSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Marketplace.AvailableAddOnExtensionPage]'; } }src/Twilio/Rest/Preview/Marketplace/InstalledAddOnOptions.php000064400000011532150515725670020321 0ustar00options['configuration'] = $configuration; $this->options['uniqueName'] = $uniqueName; } /** * The JSON object that represents the configuration of the new Add-on being installed. * * @param array $configuration The JSON object representing the configuration * @return $this Fluent Builder */ public function setConfiguration(array $configuration): self { $this->options['configuration'] = $configuration; return $this; } /** * An application-defined string that uniquely identifies the resource. This value must be unique within the Account. * * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Marketplace.CreateInstalledAddOnOptions ' . $options . ']'; } } class UpdateInstalledAddOnOptions extends Options { /** * @param array $configuration The JSON object representing the configuration * @param string $uniqueName An application-defined string that uniquely * identifies the resource */ public function __construct(array $configuration = Values::ARRAY_NONE, string $uniqueName = Values::NONE) { $this->options['configuration'] = $configuration; $this->options['uniqueName'] = $uniqueName; } /** * Valid JSON object that conform to the configuration schema exposed by the associated AvailableAddOn resource. This is only required by Add-ons that need to be configured * * @param array $configuration The JSON object representing the configuration * @return $this Fluent Builder */ public function setConfiguration(array $configuration): self { $this->options['configuration'] = $configuration; return $this; } /** * An application-defined string that uniquely identifies the resource. This value must be unique within the Account. * * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Marketplace.UpdateInstalledAddOnOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/Marketplace/InstalledAddOn/InstalledAddOnExtensionPage.php000064400000003064150515725670024265 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return InstalledAddOnExtensionInstance \Twilio\Rest\Preview\Marketplace\InstalledAddOn\InstalledAddOnExtensionInstance */ public function buildInstance(array $payload): InstalledAddOnExtensionInstance { return new InstalledAddOnExtensionInstance( $this->version, $payload, $this->solution['installedAddOnSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Marketplace.InstalledAddOnExtensionPage]'; } }src/Twilio/Rest/Preview/Marketplace/InstalledAddOn/InstalledAddOnExtensionInstance.php000064400000010746150515725670025162 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'installedAddOnSid' => Values::array_get($payload, 'installed_add_on_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'productName' => Values::array_get($payload, 'product_name'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'enabled' => Values::array_get($payload, 'enabled'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'installedAddOnSid' => $installedAddOnSid, '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 InstalledAddOnExtensionContext Context for this * InstalledAddOnExtensionInstance */ protected function proxy(): InstalledAddOnExtensionContext { if (!$this->context) { $this->context = new InstalledAddOnExtensionContext( $this->version, $this->solution['installedAddOnSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the InstalledAddOnExtensionInstance * * @return InstalledAddOnExtensionInstance Fetched * InstalledAddOnExtensionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): InstalledAddOnExtensionInstance { return $this->proxy()->fetch(); } /** * Update the InstalledAddOnExtensionInstance * * @param bool $enabled Whether the Extension should be invoked * @return InstalledAddOnExtensionInstance Updated * InstalledAddOnExtensionInstance * @throws TwilioException When an HTTP error occurs. */ public function update(bool $enabled): InstalledAddOnExtensionInstance { return $this->proxy()->update($enabled); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Marketplace.InstalledAddOnExtensionInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Marketplace/InstalledAddOn/InstalledAddOnExtensionContext.php000064400000006006150515725670025034 0ustar00solution = ['installedAddOnSid' => $installedAddOnSid, 'sid' => $sid, ]; $this->uri = '/InstalledAddOns/' . \rawurlencode($installedAddOnSid) . '/Extensions/' . \rawurlencode($sid) . ''; } /** * Fetch the InstalledAddOnExtensionInstance * * @return InstalledAddOnExtensionInstance Fetched * InstalledAddOnExtensionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): InstalledAddOnExtensionInstance { $payload = $this->version->fetch('GET', $this->uri); return new InstalledAddOnExtensionInstance( $this->version, $payload, $this->solution['installedAddOnSid'], $this->solution['sid'] ); } /** * Update the InstalledAddOnExtensionInstance * * @param bool $enabled Whether the Extension should be invoked * @return InstalledAddOnExtensionInstance Updated * InstalledAddOnExtensionInstance * @throws TwilioException When an HTTP error occurs. */ public function update(bool $enabled): InstalledAddOnExtensionInstance { $data = Values::of(['Enabled' => Serialize::booleanToString($enabled), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new InstalledAddOnExtensionInstance( $this->version, $payload, $this->solution['installedAddOnSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Marketplace.InstalledAddOnExtensionContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Marketplace/InstalledAddOn/InstalledAddOnExtensionList.php000064400000012647150515725670024333 0ustar00solution = ['installedAddOnSid' => $installedAddOnSid, ]; $this->uri = '/InstalledAddOns/' . \rawurlencode($installedAddOnSid) . '/Extensions'; } /** * Streams InstalledAddOnExtensionInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads InstalledAddOnExtensionInstance 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 InstalledAddOnExtensionInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of InstalledAddOnExtensionInstance 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 InstalledAddOnExtensionPage Page of InstalledAddOnExtensionInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): InstalledAddOnExtensionPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new InstalledAddOnExtensionPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of InstalledAddOnExtensionInstance records from the * API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return InstalledAddOnExtensionPage Page of InstalledAddOnExtensionInstance */ public function getPage(string $targetUrl): InstalledAddOnExtensionPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new InstalledAddOnExtensionPage($this->version, $response, $this->solution); } /** * Constructs a InstalledAddOnExtensionContext * * @param string $sid The SID of the InstalledAddOn Extension resource to fetch */ public function getContext(string $sid): InstalledAddOnExtensionContext { return new InstalledAddOnExtensionContext( $this->version, $this->solution['installedAddOnSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Marketplace.InstalledAddOnExtensionList]'; } }src/Twilio/Rest/Preview/Marketplace/InstalledAddOnInstance.php000064400000011370150515725670020432 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'description' => Values::array_get($payload, 'description'), 'configuration' => Values::array_get($payload, 'configuration'), 'uniqueName' => Values::array_get($payload, 'unique_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'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 InstalledAddOnContext Context for this InstalledAddOnInstance */ protected function proxy(): InstalledAddOnContext { if (!$this->context) { $this->context = new InstalledAddOnContext($this->version, $this->solution['sid']); } return $this->context; } /** * Delete the InstalledAddOnInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Fetch the InstalledAddOnInstance * * @return InstalledAddOnInstance Fetched InstalledAddOnInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): InstalledAddOnInstance { return $this->proxy()->fetch(); } /** * Update the InstalledAddOnInstance * * @param array|Options $options Optional Arguments * @return InstalledAddOnInstance Updated InstalledAddOnInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): InstalledAddOnInstance { return $this->proxy()->update($options); } /** * Access the extensions */ protected function getExtensions(): InstalledAddOnExtensionList { return $this->proxy()->extensions; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Marketplace.InstalledAddOnInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Sync.php000064400000004261150515725670012605 0ustar00version = 'Sync'; } protected function getServices(): ServiceList { if (!$this->_services) { $this->_services = new ServiceList($this); } return $this->_services; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Preview.Sync]'; } }src/Twilio/Rest/Preview/Wireless.php000064400000005623150515725670013471 0ustar00version = 'wireless'; } protected function getCommands(): CommandList { if (!$this->_commands) { $this->_commands = new CommandList($this); } return $this->_commands; } protected function getRatePlans(): RatePlanList { if (!$this->_ratePlans) { $this->_ratePlans = new RatePlanList($this); } return $this->_ratePlans; } protected function getSims(): SimList { if (!$this->_sims) { $this->_sims = new SimList($this); } return $this->_sims; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Preview.Wireless]'; } }src/Twilio/Rest/Preview/HostedNumbers/HostedNumberOrderPage.php000064400000002644150515725670020646 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return HostedNumberOrderInstance \Twilio\Rest\Preview\HostedNumbers\HostedNumberOrderInstance */ public function buildInstance(array $payload): HostedNumberOrderInstance { return new HostedNumberOrderInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.HostedNumbers.HostedNumberOrderPage]'; } }src/Twilio/Rest/Preview/HostedNumbers/AuthorizationDocumentList.php000064400000015631150515725670021651 0ustar00solution = []; $this->uri = '/AuthorizationDocuments'; } /** * Streams AuthorizationDocumentInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads AuthorizationDocumentInstance 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 AuthorizationDocumentInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of AuthorizationDocumentInstance 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 AuthorizationDocumentPage Page of AuthorizationDocumentInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): AuthorizationDocumentPage { $options = new Values($options); $params = Values::of([ 'Email' => $options['email'], 'Status' => $options['status'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new AuthorizationDocumentPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of AuthorizationDocumentInstance records from the * API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return AuthorizationDocumentPage Page of AuthorizationDocumentInstance */ public function getPage(string $targetUrl): AuthorizationDocumentPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new AuthorizationDocumentPage($this->version, $response, $this->solution); } /** * Create the AuthorizationDocumentInstance * * @param string[] $hostedNumberOrderSids A list of HostedNumberOrder sids. * @param string $addressSid Address sid. * @param string $email Email. * @param string $contactTitle Title of signee of this Authorization Document. * @param string $contactPhoneNumber Authorization Document's signee's phone * number. * @param array|Options $options Optional Arguments * @return AuthorizationDocumentInstance Created AuthorizationDocumentInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $hostedNumberOrderSids, string $addressSid, string $email, string $contactTitle, string $contactPhoneNumber, array $options = []): AuthorizationDocumentInstance { $options = new Values($options); $data = Values::of([ 'HostedNumberOrderSids' => Serialize::map($hostedNumberOrderSids, function($e) { return $e; }), 'AddressSid' => $addressSid, 'Email' => $email, 'ContactTitle' => $contactTitle, 'ContactPhoneNumber' => $contactPhoneNumber, 'CcEmails' => Serialize::map($options['ccEmails'], function($e) { return $e; }), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new AuthorizationDocumentInstance($this->version, $payload); } /** * Constructs a AuthorizationDocumentContext * * @param string $sid AuthorizationDocument sid. */ public function getContext(string $sid): AuthorizationDocumentContext { return new AuthorizationDocumentContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.HostedNumbers.AuthorizationDocumentList]'; } }src/Twilio/Rest/Preview/HostedNumbers/AuthorizationDocument/DependentHostedNumberOrderPage.php000064400000003133150515725670027026 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return DependentHostedNumberOrderInstance \Twilio\Rest\Preview\HostedNumbers\AuthorizationDocument\DependentHostedNumberOrderInstance */ public function buildInstance(array $payload): DependentHostedNumberOrderInstance { return new DependentHostedNumberOrderInstance( $this->version, $payload, $this->solution['signingDocumentSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.HostedNumbers.DependentHostedNumberOrderPage]'; } }src/Twilio/Rest/Preview/HostedNumbers/AuthorizationDocument/DependentHostedNumberOrderOptions.php000064400000011507150515725670027611 0ustar00options['status'] = $status; $this->options['phoneNumber'] = $phoneNumber; $this->options['incomingPhoneNumberSid'] = $incomingPhoneNumberSid; $this->options['friendlyName'] = $friendlyName; $this->options['uniqueName'] = $uniqueName; } /** * Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/api/phone-numbers/hosted-number-authorization-documents#status-values) for more information on each of these statuses. * * @param string $status The Status of this HostedNumberOrder. * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * An E164 formatted phone number hosted by this HostedNumberOrder. * * @param string $phoneNumber An E164 formatted phone number. * @return $this Fluent Builder */ public function setPhoneNumber(string $phoneNumber): self { $this->options['phoneNumber'] = $phoneNumber; return $this; } /** * A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. * * @param string $incomingPhoneNumberSid IncomingPhoneNumber sid. * @return $this Fluent Builder */ public function setIncomingPhoneNumberSid(string $incomingPhoneNumberSid): self { $this->options['incomingPhoneNumberSid'] = $incomingPhoneNumberSid; return $this; } /** * 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(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID. * * @param string $uniqueName A unique, developer assigned name of this * HostedNumberOrder. * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.HostedNumbers.ReadDependentHostedNumberOrderOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/HostedNumbers/AuthorizationDocument/DependentHostedNumberOrderInstance.php000064400000010577150515725670027730 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'incomingPhoneNumberSid' => Values::array_get($payload, 'incoming_phone_number_sid'), 'addressSid' => Values::array_get($payload, 'address_sid'), 'signingDocumentSid' => Values::array_get($payload, 'signing_document_sid'), 'phoneNumber' => Values::array_get($payload, 'phone_number'), 'capabilities' => Values::array_get($payload, 'capabilities'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'status' => Values::array_get($payload, 'status'), 'failureReason' => Values::array_get($payload, 'failure_reason'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'verificationAttempts' => Values::array_get($payload, 'verification_attempts'), 'email' => Values::array_get($payload, 'email'), 'ccEmails' => Values::array_get($payload, 'cc_emails'), 'verificationType' => Values::array_get($payload, 'verification_type'), 'verificationDocumentSid' => Values::array_get($payload, 'verification_document_sid'), 'extension' => Values::array_get($payload, 'extension'), 'callDelay' => Values::array_get($payload, 'call_delay'), 'verificationCode' => Values::array_get($payload, 'verification_code'), 'verificationCallSids' => Values::array_get($payload, 'verification_call_sids'), ]; $this->solution = ['signingDocumentSid' => $signingDocumentSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Preview.HostedNumbers.DependentHostedNumberOrderInstance]'; } }src/Twilio/Rest/Preview/HostedNumbers/AuthorizationDocument/DependentHostedNumberOrderList.php000064400000013356150515725670027075 0ustar00solution = ['signingDocumentSid' => $signingDocumentSid, ]; $this->uri = '/AuthorizationDocuments/' . \rawurlencode($signingDocumentSid) . '/DependentHostedNumberOrders'; } /** * Streams DependentHostedNumberOrderInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads DependentHostedNumberOrderInstance 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 DependentHostedNumberOrderInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of DependentHostedNumberOrderInstance 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 DependentHostedNumberOrderPage Page of * DependentHostedNumberOrderInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): DependentHostedNumberOrderPage { $options = new Values($options); $params = Values::of([ 'Status' => $options['status'], 'PhoneNumber' => $options['phoneNumber'], 'IncomingPhoneNumberSid' => $options['incomingPhoneNumberSid'], 'FriendlyName' => $options['friendlyName'], 'UniqueName' => $options['uniqueName'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new DependentHostedNumberOrderPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of DependentHostedNumberOrderInstance records from * the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return DependentHostedNumberOrderPage Page of * DependentHostedNumberOrderInstance */ public function getPage(string $targetUrl): DependentHostedNumberOrderPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new DependentHostedNumberOrderPage($this->version, $response, $this->solution); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.HostedNumbers.DependentHostedNumberOrderList]'; } }src/Twilio/Rest/Preview/HostedNumbers/HostedNumberOrderList.php000064400000016474150515725670020713 0ustar00solution = []; $this->uri = '/HostedNumberOrders'; } /** * Streams HostedNumberOrderInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads HostedNumberOrderInstance 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 HostedNumberOrderInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of HostedNumberOrderInstance 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 HostedNumberOrderPage Page of HostedNumberOrderInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): HostedNumberOrderPage { $options = new Values($options); $params = Values::of([ 'Status' => $options['status'], 'PhoneNumber' => $options['phoneNumber'], 'IncomingPhoneNumberSid' => $options['incomingPhoneNumberSid'], 'FriendlyName' => $options['friendlyName'], 'UniqueName' => $options['uniqueName'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new HostedNumberOrderPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of HostedNumberOrderInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return HostedNumberOrderPage Page of HostedNumberOrderInstance */ public function getPage(string $targetUrl): HostedNumberOrderPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new HostedNumberOrderPage($this->version, $response, $this->solution); } /** * Create the HostedNumberOrderInstance * * @param string $phoneNumber An E164 formatted phone number. * @param bool $smsCapability Specify SMS capability to host. * @param array|Options $options Optional Arguments * @return HostedNumberOrderInstance Created HostedNumberOrderInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $phoneNumber, bool $smsCapability, array $options = []): HostedNumberOrderInstance { $options = new Values($options); $data = Values::of([ 'PhoneNumber' => $phoneNumber, 'SmsCapability' => Serialize::booleanToString($smsCapability), 'AccountSid' => $options['accountSid'], 'FriendlyName' => $options['friendlyName'], 'UniqueName' => $options['uniqueName'], 'CcEmails' => Serialize::map($options['ccEmails'], function($e) { return $e; }), 'SmsUrl' => $options['smsUrl'], 'SmsMethod' => $options['smsMethod'], 'SmsFallbackUrl' => $options['smsFallbackUrl'], 'SmsFallbackMethod' => $options['smsFallbackMethod'], 'StatusCallbackUrl' => $options['statusCallbackUrl'], 'StatusCallbackMethod' => $options['statusCallbackMethod'], 'SmsApplicationSid' => $options['smsApplicationSid'], 'AddressSid' => $options['addressSid'], 'Email' => $options['email'], 'VerificationType' => $options['verificationType'], 'VerificationDocumentSid' => $options['verificationDocumentSid'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new HostedNumberOrderInstance($this->version, $payload); } /** * Constructs a HostedNumberOrderContext * * @param string $sid HostedNumberOrder sid. */ public function getContext(string $sid): HostedNumberOrderContext { return new HostedNumberOrderContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.HostedNumbers.HostedNumberOrderList]'; } }src/Twilio/Rest/Preview/HostedNumbers/AuthorizationDocumentOptions.php000064400000022075150515725670022371 0ustar00options['hostedNumberOrderSids'] = $hostedNumberOrderSids; $this->options['addressSid'] = $addressSid; $this->options['email'] = $email; $this->options['ccEmails'] = $ccEmails; $this->options['status'] = $status; $this->options['contactTitle'] = $contactTitle; $this->options['contactPhoneNumber'] = $contactPhoneNumber; } /** * A list of HostedNumberOrder sids that this AuthorizationDocument will authorize for hosting phone number capabilities on Twilio's platform. * * @param string[] $hostedNumberOrderSids A list of HostedNumberOrder sids. * @return $this Fluent Builder */ public function setHostedNumberOrderSids(array $hostedNumberOrderSids): self { $this->options['hostedNumberOrderSids'] = $hostedNumberOrderSids; return $this; } /** * A 34 character string that uniquely identifies the Address resource that is associated with this AuthorizationDocument. * * @param string $addressSid Address sid. * @return $this Fluent Builder */ public function setAddressSid(string $addressSid): self { $this->options['addressSid'] = $addressSid; return $this; } /** * Email that this AuthorizationDocument will be sent to for signing. * * @param string $email Email. * @return $this Fluent Builder */ public function setEmail(string $email): self { $this->options['email'] = $email; return $this; } /** * Email recipients who will be informed when an Authorization Document has been sent and signed * * @param string[] $ccEmails A list of emails. * @return $this Fluent Builder */ public function setCcEmails(array $ccEmails): self { $this->options['ccEmails'] = $ccEmails; return $this; } /** * Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/api/phone-numbers/hosted-number-authorization-documents#status-values) for more information on each of these statuses. * * @param string $status The Status of this AuthorizationDocument. * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * The title of the person authorized to sign the Authorization Document for this phone number. * * @param string $contactTitle Title of signee of this Authorization Document. * @return $this Fluent Builder */ public function setContactTitle(string $contactTitle): self { $this->options['contactTitle'] = $contactTitle; return $this; } /** * The contact phone number of the person authorized to sign the Authorization Document. * * @param string $contactPhoneNumber Authorization Document's signee's phone * number. * @return $this Fluent Builder */ public function setContactPhoneNumber(string $contactPhoneNumber): self { $this->options['contactPhoneNumber'] = $contactPhoneNumber; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.HostedNumbers.UpdateAuthorizationDocumentOptions ' . $options . ']'; } } class ReadAuthorizationDocumentOptions extends Options { /** * @param string $email Email. * @param string $status The Status of this AuthorizationDocument. */ public function __construct(string $email = Values::NONE, string $status = Values::NONE) { $this->options['email'] = $email; $this->options['status'] = $status; } /** * Email that this AuthorizationDocument will be sent to for signing. * * @param string $email Email. * @return $this Fluent Builder */ public function setEmail(string $email): self { $this->options['email'] = $email; return $this; } /** * Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/api/phone-numbers/hosted-number-authorization-documents#status-values) for more information on each of these statuses. * * @param string $status The Status of this AuthorizationDocument. * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.HostedNumbers.ReadAuthorizationDocumentOptions ' . $options . ']'; } } class CreateAuthorizationDocumentOptions extends Options { /** * @param string[] $ccEmails A list of emails. */ public function __construct(array $ccEmails = Values::ARRAY_NONE) { $this->options['ccEmails'] = $ccEmails; } /** * Email recipients who will be informed when an Authorization Document has been sent and signed. * * @param string[] $ccEmails A list of emails. * @return $this Fluent Builder */ public function setCcEmails(array $ccEmails): self { $this->options['ccEmails'] = $ccEmails; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.HostedNumbers.CreateAuthorizationDocumentOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/HostedNumbers/AuthorizationDocumentContext.php000064400000011236150515725670022357 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/AuthorizationDocuments/' . \rawurlencode($sid) . ''; } /** * Fetch the AuthorizationDocumentInstance * * @return AuthorizationDocumentInstance Fetched AuthorizationDocumentInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AuthorizationDocumentInstance { $payload = $this->version->fetch('GET', $this->uri); return new AuthorizationDocumentInstance($this->version, $payload, $this->solution['sid']); } /** * Update the AuthorizationDocumentInstance * * @param array|Options $options Optional Arguments * @return AuthorizationDocumentInstance Updated AuthorizationDocumentInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): AuthorizationDocumentInstance { $options = new Values($options); $data = Values::of([ 'HostedNumberOrderSids' => Serialize::map($options['hostedNumberOrderSids'], function($e) { return $e; }), 'AddressSid' => $options['addressSid'], 'Email' => $options['email'], 'CcEmails' => Serialize::map($options['ccEmails'], function($e) { return $e; }), 'Status' => $options['status'], 'ContactTitle' => $options['contactTitle'], 'ContactPhoneNumber' => $options['contactPhoneNumber'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new AuthorizationDocumentInstance($this->version, $payload, $this->solution['sid']); } /** * Access the dependentHostedNumberOrders */ protected function getDependentHostedNumberOrders(): DependentHostedNumberOrderList { if (!$this->_dependentHostedNumberOrders) { $this->_dependentHostedNumberOrders = new DependentHostedNumberOrderList( $this->version, $this->solution['sid'] ); } return $this->_dependentHostedNumberOrders; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.HostedNumbers.AuthorizationDocumentContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/HostedNumbers/AuthorizationDocumentPage.php000064400000002674150515725670021615 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return AuthorizationDocumentInstance \Twilio\Rest\Preview\HostedNumbers\AuthorizationDocumentInstance */ public function buildInstance(array $payload): AuthorizationDocumentInstance { return new AuthorizationDocumentInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.HostedNumbers.AuthorizationDocumentPage]'; } }src/Twilio/Rest/Preview/HostedNumbers/AuthorizationDocumentInstance.php000064400000011053150515725670022474 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'addressSid' => Values::array_get($payload, 'address_sid'), 'status' => Values::array_get($payload, 'status'), 'email' => Values::array_get($payload, 'email'), 'ccEmails' => Values::array_get($payload, 'cc_emails'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 AuthorizationDocumentContext Context for this * AuthorizationDocumentInstance */ protected function proxy(): AuthorizationDocumentContext { if (!$this->context) { $this->context = new AuthorizationDocumentContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the AuthorizationDocumentInstance * * @return AuthorizationDocumentInstance Fetched AuthorizationDocumentInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AuthorizationDocumentInstance { return $this->proxy()->fetch(); } /** * Update the AuthorizationDocumentInstance * * @param array|Options $options Optional Arguments * @return AuthorizationDocumentInstance Updated AuthorizationDocumentInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): AuthorizationDocumentInstance { return $this->proxy()->update($options); } /** * Access the dependentHostedNumberOrders */ protected function getDependentHostedNumberOrders(): DependentHostedNumberOrderList { return $this->proxy()->dependentHostedNumberOrders; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.HostedNumbers.AuthorizationDocumentInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/HostedNumbers/HostedNumberOrderContext.php000064400000006352150515725670021416 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/HostedNumberOrders/' . \rawurlencode($sid) . ''; } /** * Fetch the HostedNumberOrderInstance * * @return HostedNumberOrderInstance Fetched HostedNumberOrderInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): HostedNumberOrderInstance { $payload = $this->version->fetch('GET', $this->uri); return new HostedNumberOrderInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the HostedNumberOrderInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the HostedNumberOrderInstance * * @param array|Options $options Optional Arguments * @return HostedNumberOrderInstance Updated HostedNumberOrderInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): HostedNumberOrderInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'UniqueName' => $options['uniqueName'], 'Email' => $options['email'], 'CcEmails' => Serialize::map($options['ccEmails'], function($e) { return $e; }), 'Status' => $options['status'], 'VerificationCode' => $options['verificationCode'], 'VerificationType' => $options['verificationType'], 'VerificationDocumentSid' => $options['verificationDocumentSid'], 'Extension' => $options['extension'], 'CallDelay' => $options['callDelay'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new HostedNumberOrderInstance($this->version, $payload, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.HostedNumbers.HostedNumberOrderContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/HostedNumbers/HostedNumberOrderInstance.php000064400000013776150515725670021546 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'incomingPhoneNumberSid' => Values::array_get($payload, 'incoming_phone_number_sid'), 'addressSid' => Values::array_get($payload, 'address_sid'), 'signingDocumentSid' => Values::array_get($payload, 'signing_document_sid'), 'phoneNumber' => Values::array_get($payload, 'phone_number'), 'capabilities' => Values::array_get($payload, 'capabilities'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'status' => Values::array_get($payload, 'status'), 'failureReason' => Values::array_get($payload, 'failure_reason'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'verificationAttempts' => Values::array_get($payload, 'verification_attempts'), 'email' => Values::array_get($payload, 'email'), 'ccEmails' => Values::array_get($payload, 'cc_emails'), 'url' => Values::array_get($payload, 'url'), 'verificationType' => Values::array_get($payload, 'verification_type'), 'verificationDocumentSid' => Values::array_get($payload, 'verification_document_sid'), 'extension' => Values::array_get($payload, 'extension'), 'callDelay' => Values::array_get($payload, 'call_delay'), 'verificationCode' => Values::array_get($payload, 'verification_code'), 'verificationCallSids' => Values::array_get($payload, 'verification_call_sids'), ]; $this->solution = ['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 HostedNumberOrderContext Context for this HostedNumberOrderInstance */ protected function proxy(): HostedNumberOrderContext { if (!$this->context) { $this->context = new HostedNumberOrderContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the HostedNumberOrderInstance * * @return HostedNumberOrderInstance Fetched HostedNumberOrderInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): HostedNumberOrderInstance { return $this->proxy()->fetch(); } /** * Delete the HostedNumberOrderInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the HostedNumberOrderInstance * * @param array|Options $options Optional Arguments * @return HostedNumberOrderInstance Updated HostedNumberOrderInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): HostedNumberOrderInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.HostedNumbers.HostedNumberOrderInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/HostedNumbers/HostedNumberOrderOptions.php000064400000055741150515725670021433 0ustar00options['friendlyName'] = $friendlyName; $this->options['uniqueName'] = $uniqueName; $this->options['email'] = $email; $this->options['ccEmails'] = $ccEmails; $this->options['status'] = $status; $this->options['verificationCode'] = $verificationCode; $this->options['verificationType'] = $verificationType; $this->options['verificationDocumentSid'] = $verificationDocumentSid; $this->options['extension'] = $extension; $this->options['callDelay'] = $callDelay; } /** * A 64 character string that is a human readable text that describes this resource. * * @param string $friendlyName A human readable description of this resource. * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID. * * @param string $uniqueName A unique, developer assigned name of this * HostedNumberOrder. * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * Email of the owner of this phone number that is being hosted. * * @param string $email Email. * @return $this Fluent Builder */ public function setEmail(string $email): self { $this->options['email'] = $email; return $this; } /** * Optional. A list of emails that LOA document for this HostedNumberOrder will be carbon copied to. * * @param string[] $ccEmails A list of emails. * @return $this Fluent Builder */ public function setCcEmails(array $ccEmails): self { $this->options['ccEmails'] = $ccEmails; return $this; } /** * User can only post to `pending-verification` status to transition the HostedNumberOrder to initiate a verification call or verification of ownership with a copy of a phone bill. * * @param string $status The Status of this HostedNumberOrder. * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * A verification code that is given to the user via a phone call to the phone number that is being hosted. * * @param string $verificationCode A verification code. * @return $this Fluent Builder */ public function setVerificationCode(string $verificationCode): self { $this->options['verificationCode'] = $verificationCode; return $this; } /** * Optional. The method used for verifying ownership of the number to be hosted. One of phone-call (default) or phone-bill. * * @param string $verificationType Verification Type. * @return $this Fluent Builder */ public function setVerificationType(string $verificationType): self { $this->options['verificationType'] = $verificationType; return $this; } /** * Optional. The unique sid identifier of the Identity Document that represents the document for verifying ownership of the number to be hosted. Required when VerificationType is phone-bill. * * @param string $verificationDocumentSid Verification Document Sid * @return $this Fluent Builder */ public function setVerificationDocumentSid(string $verificationDocumentSid): self { $this->options['verificationDocumentSid'] = $verificationDocumentSid; return $this; } /** * Digits to dial after connecting the verification call. * * @param string $extension Digits to dial after connecting the verification * call. * @return $this Fluent Builder */ public function setExtension(string $extension): self { $this->options['extension'] = $extension; return $this; } /** * The number of seconds, between 0 and 60, to delay before initiating the verification call. Defaults to 0. * * @param int $callDelay The number of seconds, between 0 and 60, to delay * before initiating the verification call. * @return $this Fluent Builder */ public function setCallDelay(int $callDelay): self { $this->options['callDelay'] = $callDelay; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.HostedNumbers.UpdateHostedNumberOrderOptions ' . $options . ']'; } } class ReadHostedNumberOrderOptions extends Options { /** * @param string $status The Status of this HostedNumberOrder. * @param string $phoneNumber An E164 formatted phone number. * @param string $incomingPhoneNumberSid IncomingPhoneNumber sid. * @param string $friendlyName A human readable description of this resource. * @param string $uniqueName A unique, developer assigned name of this * HostedNumberOrder. */ public function __construct(string $status = Values::NONE, string $phoneNumber = Values::NONE, string $incomingPhoneNumberSid = Values::NONE, string $friendlyName = Values::NONE, string $uniqueName = Values::NONE) { $this->options['status'] = $status; $this->options['phoneNumber'] = $phoneNumber; $this->options['incomingPhoneNumberSid'] = $incomingPhoneNumberSid; $this->options['friendlyName'] = $friendlyName; $this->options['uniqueName'] = $uniqueName; } /** * The Status of this HostedNumberOrder. One of `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`. * * @param string $status The Status of this HostedNumberOrder. * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * An E164 formatted phone number hosted by this HostedNumberOrder. * * @param string $phoneNumber An E164 formatted phone number. * @return $this Fluent Builder */ public function setPhoneNumber(string $phoneNumber): self { $this->options['phoneNumber'] = $phoneNumber; return $this; } /** * A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. * * @param string $incomingPhoneNumberSid IncomingPhoneNumber sid. * @return $this Fluent Builder */ public function setIncomingPhoneNumberSid(string $incomingPhoneNumberSid): self { $this->options['incomingPhoneNumberSid'] = $incomingPhoneNumberSid; return $this; } /** * 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(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID. * * @param string $uniqueName A unique, developer assigned name of this * HostedNumberOrder. * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.HostedNumbers.ReadHostedNumberOrderOptions ' . $options . ']'; } } class CreateHostedNumberOrderOptions extends Options { /** * @param string $accountSid Account Sid. * @param string $friendlyName A human readable description of this resource. * @param string $uniqueName A unique, developer assigned name of this * HostedNumberOrder. * @param string[] $ccEmails A list of emails. * @param string $smsUrl SMS URL. * @param string $smsMethod SMS Method. * @param string $smsFallbackUrl SMS Fallback URL. * @param string $smsFallbackMethod SMS Fallback Method. * @param string $statusCallbackUrl Status Callback URL. * @param string $statusCallbackMethod Status Callback Method. * @param string $smsApplicationSid SMS Application Sid. * @param string $addressSid Address sid. * @param string $email Email. * @param string $verificationType Verification Type. * @param string $verificationDocumentSid Verification Document Sid */ public function __construct(string $accountSid = Values::NONE, string $friendlyName = Values::NONE, string $uniqueName = Values::NONE, array $ccEmails = Values::ARRAY_NONE, string $smsUrl = Values::NONE, string $smsMethod = Values::NONE, string $smsFallbackUrl = Values::NONE, string $smsFallbackMethod = Values::NONE, string $statusCallbackUrl = Values::NONE, string $statusCallbackMethod = Values::NONE, string $smsApplicationSid = Values::NONE, string $addressSid = Values::NONE, string $email = Values::NONE, string $verificationType = Values::NONE, string $verificationDocumentSid = Values::NONE) { $this->options['accountSid'] = $accountSid; $this->options['friendlyName'] = $friendlyName; $this->options['uniqueName'] = $uniqueName; $this->options['ccEmails'] = $ccEmails; $this->options['smsUrl'] = $smsUrl; $this->options['smsMethod'] = $smsMethod; $this->options['smsFallbackUrl'] = $smsFallbackUrl; $this->options['smsFallbackMethod'] = $smsFallbackMethod; $this->options['statusCallbackUrl'] = $statusCallbackUrl; $this->options['statusCallbackMethod'] = $statusCallbackMethod; $this->options['smsApplicationSid'] = $smsApplicationSid; $this->options['addressSid'] = $addressSid; $this->options['email'] = $email; $this->options['verificationType'] = $verificationType; $this->options['verificationDocumentSid'] = $verificationDocumentSid; } /** * This defaults to the AccountSid of the authorization the user is using. This can be provided to specify a subaccount to add the HostedNumberOrder to. * * @param string $accountSid Account Sid. * @return $this Fluent Builder */ public function setAccountSid(string $accountSid): self { $this->options['accountSid'] = $accountSid; return $this; } /** * A 64 character string that is a human readable text that describes this resource. * * @param string $friendlyName A human readable description of this resource. * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Optional. Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID. * * @param string $uniqueName A unique, developer assigned name of this * HostedNumberOrder. * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * Optional. A list of emails that the LOA document for this HostedNumberOrder will be carbon copied to. * * @param string[] $ccEmails A list of emails. * @return $this Fluent Builder */ public function setCcEmails(array $ccEmails): self { $this->options['ccEmails'] = $ccEmails; return $this; } /** * The URL that Twilio should request when somebody sends an SMS to the phone number. This will be copied onto the IncomingPhoneNumber resource. * * @param string $smsUrl SMS URL. * @return $this Fluent Builder */ public function setSmsUrl(string $smsUrl): self { $this->options['smsUrl'] = $smsUrl; return $this; } /** * The HTTP method that should be used to request the SmsUrl. Must be either `GET` or `POST`. This will be copied onto the IncomingPhoneNumber resource. * * @param string $smsMethod SMS Method. * @return $this Fluent Builder */ public function setSmsMethod(string $smsMethod): self { $this->options['smsMethod'] = $smsMethod; return $this; } /** * A URL that Twilio will request if an error occurs requesting or executing the TwiML defined by SmsUrl. This will be copied onto the IncomingPhoneNumber resource. * * @param string $smsFallbackUrl SMS Fallback URL. * @return $this Fluent Builder */ public function setSmsFallbackUrl(string $smsFallbackUrl): self { $this->options['smsFallbackUrl'] = $smsFallbackUrl; return $this; } /** * The HTTP method that should be used to request the SmsFallbackUrl. Must be either `GET` or `POST`. This will be copied onto the IncomingPhoneNumber resource. * * @param string $smsFallbackMethod SMS Fallback Method. * @return $this Fluent Builder */ public function setSmsFallbackMethod(string $smsFallbackMethod): self { $this->options['smsFallbackMethod'] = $smsFallbackMethod; return $this; } /** * Optional. The Status Callback URL attached to the IncomingPhoneNumber resource. * * @param string $statusCallbackUrl Status Callback URL. * @return $this Fluent Builder */ public function setStatusCallbackUrl(string $statusCallbackUrl): self { $this->options['statusCallbackUrl'] = $statusCallbackUrl; return $this; } /** * Optional. The Status Callback Method attached to the IncomingPhoneNumber resource. * * @param string $statusCallbackMethod Status Callback Method. * @return $this Fluent Builder */ public function setStatusCallbackMethod(string $statusCallbackMethod): self { $this->options['statusCallbackMethod'] = $statusCallbackMethod; return $this; } /** * Optional. The 34 character sid of the application Twilio should use to handle SMS messages sent to this number. If a `SmsApplicationSid` is present, Twilio will ignore all of the SMS urls above and use those set on the application. * * @param string $smsApplicationSid SMS Application Sid. * @return $this Fluent Builder */ public function setSmsApplicationSid(string $smsApplicationSid): self { $this->options['smsApplicationSid'] = $smsApplicationSid; return $this; } /** * Optional. A 34 character string that uniquely identifies the Address resource that represents the address of the owner of this phone number. * * @param string $addressSid Address sid. * @return $this Fluent Builder */ public function setAddressSid(string $addressSid): self { $this->options['addressSid'] = $addressSid; return $this; } /** * Optional. Email of the owner of this phone number that is being hosted. * * @param string $email Email. * @return $this Fluent Builder */ public function setEmail(string $email): self { $this->options['email'] = $email; return $this; } /** * Optional. The method used for verifying ownership of the number to be hosted. One of phone-call (default) or phone-bill. * * @param string $verificationType Verification Type. * @return $this Fluent Builder */ public function setVerificationType(string $verificationType): self { $this->options['verificationType'] = $verificationType; return $this; } /** * Optional. The unique sid identifier of the Identity Document that represents the document for verifying ownership of the number to be hosted. Required when VerificationType is phone-bill. * * @param string $verificationDocumentSid Verification Document Sid * @return $this Fluent Builder */ public function setVerificationDocumentSid(string $verificationDocumentSid): self { $this->options['verificationDocumentSid'] = $verificationDocumentSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.HostedNumbers.CreateHostedNumberOrderOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/Wireless/CommandOptions.php000064400000014301150515725670016414 0ustar00options['device'] = $device; $this->options['sim'] = $sim; $this->options['status'] = $status; $this->options['direction'] = $direction; } /** * The device * * @param string $device The device * @return $this Fluent Builder */ public function setDevice(string $device): self { $this->options['device'] = $device; return $this; } /** * The sim * * @param string $sim The sim * @return $this Fluent Builder */ public function setSim(string $sim): self { $this->options['sim'] = $sim; return $this; } /** * The status * * @param string $status The status * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * The direction * * @param string $direction The direction * @return $this Fluent Builder */ public function setDirection(string $direction): self { $this->options['direction'] = $direction; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Wireless.ReadCommandOptions ' . $options . ']'; } } class CreateCommandOptions extends Options { /** * @param string $device The device * @param string $sim The sim * @param string $callbackMethod The callback_method * @param string $callbackUrl The callback_url * @param string $commandMode The command_mode * @param string $includeSid The include_sid */ public function __construct(string $device = Values::NONE, string $sim = Values::NONE, string $callbackMethod = Values::NONE, string $callbackUrl = Values::NONE, string $commandMode = Values::NONE, string $includeSid = Values::NONE) { $this->options['device'] = $device; $this->options['sim'] = $sim; $this->options['callbackMethod'] = $callbackMethod; $this->options['callbackUrl'] = $callbackUrl; $this->options['commandMode'] = $commandMode; $this->options['includeSid'] = $includeSid; } /** * The device * * @param string $device The device * @return $this Fluent Builder */ public function setDevice(string $device): self { $this->options['device'] = $device; return $this; } /** * The sim * * @param string $sim The sim * @return $this Fluent Builder */ public function setSim(string $sim): self { $this->options['sim'] = $sim; return $this; } /** * The callback_method * * @param string $callbackMethod The callback_method * @return $this Fluent Builder */ public function setCallbackMethod(string $callbackMethod): self { $this->options['callbackMethod'] = $callbackMethod; return $this; } /** * The callback_url * * @param string $callbackUrl The callback_url * @return $this Fluent Builder */ public function setCallbackUrl(string $callbackUrl): self { $this->options['callbackUrl'] = $callbackUrl; return $this; } /** * The command_mode * * @param string $commandMode The command_mode * @return $this Fluent Builder */ public function setCommandMode(string $commandMode): self { $this->options['commandMode'] = $commandMode; return $this; } /** * The include_sid * * @param string $includeSid The include_sid * @return $this Fluent Builder */ public function setIncludeSid(string $includeSid): self { $this->options['includeSid'] = $includeSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Wireless.CreateCommandOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/Wireless/SimPage.php000064400000002501150515725670015006 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SimInstance \Twilio\Rest\Preview\Wireless\SimInstance */ public function buildInstance(array $payload): SimInstance { return new SimInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Wireless.SimPage]'; } }src/Twilio/Rest/Preview/Wireless/CommandPage.php000064400000002531150515725670015637 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CommandInstance \Twilio\Rest\Preview\Wireless\CommandInstance */ public function buildInstance(array $payload): CommandInstance { return new CommandInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Wireless.CommandPage]'; } }src/Twilio/Rest/Preview/Wireless/SimOptions.php000064400000030746150515725670015601 0ustar00options['status'] = $status; $this->options['iccid'] = $iccid; $this->options['ratePlan'] = $ratePlan; $this->options['eId'] = $eId; $this->options['simRegistrationCode'] = $simRegistrationCode; } /** * The status * * @param string $status The status * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * The iccid * * @param string $iccid The iccid * @return $this Fluent Builder */ public function setIccid(string $iccid): self { $this->options['iccid'] = $iccid; return $this; } /** * The rate_plan * * @param string $ratePlan The rate_plan * @return $this Fluent Builder */ public function setRatePlan(string $ratePlan): self { $this->options['ratePlan'] = $ratePlan; return $this; } /** * The e_id * * @param string $eId The e_id * @return $this Fluent Builder */ public function setEId(string $eId): self { $this->options['eId'] = $eId; return $this; } /** * The sim_registration_code * * @param string $simRegistrationCode The sim_registration_code * @return $this Fluent Builder */ public function setSimRegistrationCode(string $simRegistrationCode): self { $this->options['simRegistrationCode'] = $simRegistrationCode; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Wireless.ReadSimOptions ' . $options . ']'; } } class UpdateSimOptions extends Options { /** * @param string $uniqueName The unique_name * @param string $callbackMethod The callback_method * @param string $callbackUrl The callback_url * @param string $friendlyName The friendly_name * @param string $ratePlan The rate_plan * @param string $status The status * @param string $commandsCallbackMethod The commands_callback_method * @param string $commandsCallbackUrl The commands_callback_url * @param string $smsFallbackMethod The sms_fallback_method * @param string $smsFallbackUrl The sms_fallback_url * @param string $smsMethod The sms_method * @param string $smsUrl The sms_url * @param string $voiceFallbackMethod The voice_fallback_method * @param string $voiceFallbackUrl The voice_fallback_url * @param string $voiceMethod The voice_method * @param string $voiceUrl The voice_url */ public function __construct(string $uniqueName = Values::NONE, string $callbackMethod = Values::NONE, string $callbackUrl = Values::NONE, string $friendlyName = Values::NONE, string $ratePlan = Values::NONE, string $status = Values::NONE, string $commandsCallbackMethod = Values::NONE, string $commandsCallbackUrl = Values::NONE, string $smsFallbackMethod = Values::NONE, string $smsFallbackUrl = Values::NONE, string $smsMethod = Values::NONE, string $smsUrl = Values::NONE, string $voiceFallbackMethod = Values::NONE, string $voiceFallbackUrl = Values::NONE, string $voiceMethod = Values::NONE, string $voiceUrl = Values::NONE) { $this->options['uniqueName'] = $uniqueName; $this->options['callbackMethod'] = $callbackMethod; $this->options['callbackUrl'] = $callbackUrl; $this->options['friendlyName'] = $friendlyName; $this->options['ratePlan'] = $ratePlan; $this->options['status'] = $status; $this->options['commandsCallbackMethod'] = $commandsCallbackMethod; $this->options['commandsCallbackUrl'] = $commandsCallbackUrl; $this->options['smsFallbackMethod'] = $smsFallbackMethod; $this->options['smsFallbackUrl'] = $smsFallbackUrl; $this->options['smsMethod'] = $smsMethod; $this->options['smsUrl'] = $smsUrl; $this->options['voiceFallbackMethod'] = $voiceFallbackMethod; $this->options['voiceFallbackUrl'] = $voiceFallbackUrl; $this->options['voiceMethod'] = $voiceMethod; $this->options['voiceUrl'] = $voiceUrl; } /** * The unique_name * * @param string $uniqueName The unique_name * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * The callback_method * * @param string $callbackMethod The callback_method * @return $this Fluent Builder */ public function setCallbackMethod(string $callbackMethod): self { $this->options['callbackMethod'] = $callbackMethod; return $this; } /** * The callback_url * * @param string $callbackUrl The callback_url * @return $this Fluent Builder */ public function setCallbackUrl(string $callbackUrl): self { $this->options['callbackUrl'] = $callbackUrl; return $this; } /** * The friendly_name * * @param string $friendlyName The friendly_name * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The rate_plan * * @param string $ratePlan The rate_plan * @return $this Fluent Builder */ public function setRatePlan(string $ratePlan): self { $this->options['ratePlan'] = $ratePlan; return $this; } /** * The status * * @param string $status The status * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * The commands_callback_method * * @param string $commandsCallbackMethod The commands_callback_method * @return $this Fluent Builder */ public function setCommandsCallbackMethod(string $commandsCallbackMethod): self { $this->options['commandsCallbackMethod'] = $commandsCallbackMethod; return $this; } /** * The commands_callback_url * * @param string $commandsCallbackUrl The commands_callback_url * @return $this Fluent Builder */ public function setCommandsCallbackUrl(string $commandsCallbackUrl): self { $this->options['commandsCallbackUrl'] = $commandsCallbackUrl; return $this; } /** * The sms_fallback_method * * @param string $smsFallbackMethod The sms_fallback_method * @return $this Fluent Builder */ public function setSmsFallbackMethod(string $smsFallbackMethod): self { $this->options['smsFallbackMethod'] = $smsFallbackMethod; return $this; } /** * The sms_fallback_url * * @param string $smsFallbackUrl The sms_fallback_url * @return $this Fluent Builder */ public function setSmsFallbackUrl(string $smsFallbackUrl): self { $this->options['smsFallbackUrl'] = $smsFallbackUrl; return $this; } /** * The sms_method * * @param string $smsMethod The sms_method * @return $this Fluent Builder */ public function setSmsMethod(string $smsMethod): self { $this->options['smsMethod'] = $smsMethod; return $this; } /** * The sms_url * * @param string $smsUrl The sms_url * @return $this Fluent Builder */ public function setSmsUrl(string $smsUrl): self { $this->options['smsUrl'] = $smsUrl; return $this; } /** * The voice_fallback_method * * @param string $voiceFallbackMethod The voice_fallback_method * @return $this Fluent Builder */ public function setVoiceFallbackMethod(string $voiceFallbackMethod): self { $this->options['voiceFallbackMethod'] = $voiceFallbackMethod; return $this; } /** * The voice_fallback_url * * @param string $voiceFallbackUrl The voice_fallback_url * @return $this Fluent Builder */ public function setVoiceFallbackUrl(string $voiceFallbackUrl): self { $this->options['voiceFallbackUrl'] = $voiceFallbackUrl; return $this; } /** * The voice_method * * @param string $voiceMethod The voice_method * @return $this Fluent Builder */ public function setVoiceMethod(string $voiceMethod): self { $this->options['voiceMethod'] = $voiceMethod; return $this; } /** * The voice_url * * @param string $voiceUrl The voice_url * @return $this Fluent Builder */ public function setVoiceUrl(string $voiceUrl): self { $this->options['voiceUrl'] = $voiceUrl; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Wireless.UpdateSimOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/Wireless/SimContext.php000064400000011070150515725670015557 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Sims/' . \rawurlencode($sid) . ''; } /** * Fetch the SimInstance * * @return SimInstance Fetched SimInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SimInstance { $payload = $this->version->fetch('GET', $this->uri); return new SimInstance($this->version, $payload, $this->solution['sid']); } /** * Update the SimInstance * * @param array|Options $options Optional Arguments * @return SimInstance Updated SimInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SimInstance { $options = new Values($options); $data = Values::of([ 'UniqueName' => $options['uniqueName'], 'CallbackMethod' => $options['callbackMethod'], 'CallbackUrl' => $options['callbackUrl'], 'FriendlyName' => $options['friendlyName'], 'RatePlan' => $options['ratePlan'], 'Status' => $options['status'], 'CommandsCallbackMethod' => $options['commandsCallbackMethod'], 'CommandsCallbackUrl' => $options['commandsCallbackUrl'], 'SmsFallbackMethod' => $options['smsFallbackMethod'], 'SmsFallbackUrl' => $options['smsFallbackUrl'], 'SmsMethod' => $options['smsMethod'], 'SmsUrl' => $options['smsUrl'], 'VoiceFallbackMethod' => $options['voiceFallbackMethod'], 'VoiceFallbackUrl' => $options['voiceFallbackUrl'], 'VoiceMethod' => $options['voiceMethod'], 'VoiceUrl' => $options['voiceUrl'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new SimInstance($this->version, $payload, $this->solution['sid']); } /** * Access the usage */ protected function getUsage(): UsageList { if (!$this->_usage) { $this->_usage = new UsageList($this->version, $this->solution['sid']); } return $this->_usage; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Wireless.SimContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Wireless/RatePlanContext.php000064400000005117150515725670016542 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/RatePlans/' . \rawurlencode($sid) . ''; } /** * Fetch the RatePlanInstance * * @return RatePlanInstance Fetched RatePlanInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RatePlanInstance { $payload = $this->version->fetch('GET', $this->uri); return new RatePlanInstance($this->version, $payload, $this->solution['sid']); } /** * Update the RatePlanInstance * * @param array|Options $options Optional Arguments * @return RatePlanInstance Updated RatePlanInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): RatePlanInstance { $options = new Values($options); $data = Values::of([ 'UniqueName' => $options['uniqueName'], 'FriendlyName' => $options['friendlyName'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new RatePlanInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the RatePlanInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Wireless.RatePlanContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Wireless/RatePlanPage.php000064400000002537150515725670015775 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return RatePlanInstance \Twilio\Rest\Preview\Wireless\RatePlanInstance */ public function buildInstance(array $payload): RatePlanInstance { return new RatePlanInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Wireless.RatePlanPage]'; } }src/Twilio/Rest/Preview/Wireless/SimList.php000064400000012266150515725670015056 0ustar00solution = []; $this->uri = '/Sims'; } /** * Streams SimInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads SimInstance 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 SimInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of SimInstance 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 SimPage Page of SimInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SimPage { $options = new Values($options); $params = Values::of([ 'Status' => $options['status'], 'Iccid' => $options['iccid'], 'RatePlan' => $options['ratePlan'], 'EId' => $options['eId'], 'SimRegistrationCode' => $options['simRegistrationCode'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new SimPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of SimInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return SimPage Page of SimInstance */ public function getPage(string $targetUrl): SimPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new SimPage($this->version, $response, $this->solution); } /** * Constructs a SimContext * * @param string $sid The sid */ public function getContext(string $sid): SimContext { return new SimContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Wireless.SimList]'; } }src/Twilio/Rest/Preview/Wireless/CommandContext.php000064400000003206150515725670016407 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Commands/' . \rawurlencode($sid) . ''; } /** * Fetch the CommandInstance * * @return CommandInstance Fetched CommandInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CommandInstance { $payload = $this->version->fetch('GET', $this->uri); return new CommandInstance($this->version, $payload, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Wireless.CommandContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Wireless/Sim/UsageContext.php000064400000003577150515725670016640 0ustar00solution = ['simSid' => $simSid, ]; $this->uri = '/Sims/' . \rawurlencode($simSid) . '/Usage'; } /** * Fetch the UsageInstance * * @param array|Options $options Optional Arguments * @return UsageInstance Fetched UsageInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): UsageInstance { $options = new Values($options); $params = Values::of(['End' => $options['end'], 'Start' => $options['start'], ]); $payload = $this->version->fetch('GET', $this->uri, $params); return new UsageInstance($this->version, $payload, $this->solution['simSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Wireless.UsageContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Wireless/Sim/UsagePage.php000064400000002560150515725670016057 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return UsageInstance \Twilio\Rest\Preview\Wireless\Sim\UsageInstance */ public function buildInstance(array $payload): UsageInstance { return new UsageInstance($this->version, $payload, $this->solution['simSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Wireless.UsagePage]'; } }src/Twilio/Rest/Preview/Wireless/Sim/UsageOptions.php000064400000003454150515725670016641 0ustar00options['end'] = $end; $this->options['start'] = $start; } /** * The end * * @param string $end The end * @return $this Fluent Builder */ public function setEnd(string $end): self { $this->options['end'] = $end; return $this; } /** * The start * * @param string $start The start * @return $this Fluent Builder */ public function setStart(string $start): self { $this->options['start'] = $start; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Wireless.FetchUsageOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/Wireless/Sim/UsageInstance.php000064400000007155150515725670016754 0ustar00properties = [ 'simSid' => Values::array_get($payload, 'sim_sid'), 'simUniqueName' => Values::array_get($payload, 'sim_unique_name'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'period' => Values::array_get($payload, 'period'), 'commandsUsage' => Values::array_get($payload, 'commands_usage'), 'commandsCosts' => Values::array_get($payload, 'commands_costs'), 'dataUsage' => Values::array_get($payload, 'data_usage'), 'dataCosts' => Values::array_get($payload, 'data_costs'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['simSid' => $simSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return UsageContext Context for this UsageInstance */ protected function proxy(): UsageContext { if (!$this->context) { $this->context = new UsageContext($this->version, $this->solution['simSid']); } return $this->context; } /** * Fetch the UsageInstance * * @param array|Options $options Optional Arguments * @return UsageInstance Fetched UsageInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): UsageInstance { return $this->proxy()->fetch($options); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Wireless.UsageInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Wireless/Sim/UsageList.php000064400000002265150515725670016120 0ustar00solution = ['simSid' => $simSid, ]; } /** * Constructs a UsageContext */ public function getContext(): UsageContext { return new UsageContext($this->version, $this->solution['simSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Wireless.UsageList]'; } }src/Twilio/Rest/Preview/Wireless/CommandInstance.php000064400000007425150515725670016536 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'deviceSid' => Values::array_get($payload, 'device_sid'), 'simSid' => Values::array_get($payload, 'sim_sid'), 'command' => Values::array_get($payload, 'command'), 'commandMode' => Values::array_get($payload, 'command_mode'), 'status' => Values::array_get($payload, 'status'), 'direction' => Values::array_get($payload, 'direction'), '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 = ['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 CommandContext Context for this CommandInstance */ protected function proxy(): CommandContext { if (!$this->context) { $this->context = new CommandContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the CommandInstance * * @return CommandInstance Fetched CommandInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CommandInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Wireless.CommandInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Wireless/CommandList.php000064400000014200150515725670015672 0ustar00solution = []; $this->uri = '/Commands'; } /** * Streams CommandInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param array|Options $options Optional Arguments * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads CommandInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param array|Options $options Optional Arguments * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return CommandInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of CommandInstance records from the API. * Request is executed immediately * * @param array|Options $options Optional Arguments * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return CommandPage Page of CommandInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): CommandPage { $options = new Values($options); $params = Values::of([ 'Device' => $options['device'], 'Sim' => $options['sim'], 'Status' => $options['status'], 'Direction' => $options['direction'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new CommandPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of CommandInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return CommandPage Page of CommandInstance */ public function getPage(string $targetUrl): CommandPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new CommandPage($this->version, $response, $this->solution); } /** * Create the CommandInstance * * @param string $command The command * @param array|Options $options Optional Arguments * @return CommandInstance Created CommandInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $command, array $options = []): CommandInstance { $options = new Values($options); $data = Values::of([ 'Command' => $command, 'Device' => $options['device'], 'Sim' => $options['sim'], 'CallbackMethod' => $options['callbackMethod'], 'CallbackUrl' => $options['callbackUrl'], 'CommandMode' => $options['commandMode'], 'IncludeSid' => $options['includeSid'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new CommandInstance($this->version, $payload); } /** * Constructs a CommandContext * * @param string $sid The sid */ public function getContext(string $sid): CommandContext { return new CommandContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Wireless.CommandList]'; } }src/Twilio/Rest/Preview/Wireless/RatePlanInstance.php000064400000011530150515725670016656 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'dataEnabled' => Values::array_get($payload, 'data_enabled'), 'dataMetering' => Values::array_get($payload, 'data_metering'), 'dataLimit' => Values::array_get($payload, 'data_limit'), 'messagingEnabled' => Values::array_get($payload, 'messaging_enabled'), 'voiceEnabled' => Values::array_get($payload, 'voice_enabled'), 'nationalRoamingEnabled' => Values::array_get($payload, 'national_roaming_enabled'), 'internationalRoaming' => Values::array_get($payload, 'international_roaming'), '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 = ['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 RatePlanContext Context for this RatePlanInstance */ protected function proxy(): RatePlanContext { if (!$this->context) { $this->context = new RatePlanContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the RatePlanInstance * * @return RatePlanInstance Fetched RatePlanInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RatePlanInstance { return $this->proxy()->fetch(); } /** * Update the RatePlanInstance * * @param array|Options $options Optional Arguments * @return RatePlanInstance Updated RatePlanInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): RatePlanInstance { return $this->proxy()->update($options); } /** * Delete the RatePlanInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Wireless.RatePlanInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Wireless/RatePlanList.php000064400000014060150515725670016026 0ustar00solution = []; $this->uri = '/RatePlans'; } /** * Streams RatePlanInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads RatePlanInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return RatePlanInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of RatePlanInstance records from the API. * Request is executed immediately * * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return RatePlanPage Page of RatePlanInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): RatePlanPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new RatePlanPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of RatePlanInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return RatePlanPage Page of RatePlanInstance */ public function getPage(string $targetUrl): RatePlanPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new RatePlanPage($this->version, $response, $this->solution); } /** * Create the RatePlanInstance * * @param array|Options $options Optional Arguments * @return RatePlanInstance Created RatePlanInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): RatePlanInstance { $options = new Values($options); $data = Values::of([ 'UniqueName' => $options['uniqueName'], 'FriendlyName' => $options['friendlyName'], 'DataEnabled' => Serialize::booleanToString($options['dataEnabled']), 'DataLimit' => $options['dataLimit'], 'DataMetering' => $options['dataMetering'], 'MessagingEnabled' => Serialize::booleanToString($options['messagingEnabled']), 'VoiceEnabled' => Serialize::booleanToString($options['voiceEnabled']), 'CommandsEnabled' => Serialize::booleanToString($options['commandsEnabled']), 'NationalRoamingEnabled' => Serialize::booleanToString($options['nationalRoamingEnabled']), 'InternationalRoaming' => Serialize::map($options['internationalRoaming'], function($e) { return $e; }), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new RatePlanInstance($this->version, $payload); } /** * Constructs a RatePlanContext * * @param string $sid The sid */ public function getContext(string $sid): RatePlanContext { return new RatePlanContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Wireless.RatePlanList]'; } }src/Twilio/Rest/Preview/Wireless/RatePlanOptions.php000064400000020213150515725670016543 0ustar00options['uniqueName'] = $uniqueName; $this->options['friendlyName'] = $friendlyName; $this->options['dataEnabled'] = $dataEnabled; $this->options['dataLimit'] = $dataLimit; $this->options['dataMetering'] = $dataMetering; $this->options['messagingEnabled'] = $messagingEnabled; $this->options['voiceEnabled'] = $voiceEnabled; $this->options['commandsEnabled'] = $commandsEnabled; $this->options['nationalRoamingEnabled'] = $nationalRoamingEnabled; $this->options['internationalRoaming'] = $internationalRoaming; } /** * The unique_name * * @param string $uniqueName The unique_name * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * The friendly_name * * @param string $friendlyName The friendly_name * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The data_enabled * * @param bool $dataEnabled The data_enabled * @return $this Fluent Builder */ public function setDataEnabled(bool $dataEnabled): self { $this->options['dataEnabled'] = $dataEnabled; return $this; } /** * The data_limit * * @param int $dataLimit The data_limit * @return $this Fluent Builder */ public function setDataLimit(int $dataLimit): self { $this->options['dataLimit'] = $dataLimit; return $this; } /** * The data_metering * * @param string $dataMetering The data_metering * @return $this Fluent Builder */ public function setDataMetering(string $dataMetering): self { $this->options['dataMetering'] = $dataMetering; return $this; } /** * The messaging_enabled * * @param bool $messagingEnabled The messaging_enabled * @return $this Fluent Builder */ public function setMessagingEnabled(bool $messagingEnabled): self { $this->options['messagingEnabled'] = $messagingEnabled; return $this; } /** * The voice_enabled * * @param bool $voiceEnabled The voice_enabled * @return $this Fluent Builder */ public function setVoiceEnabled(bool $voiceEnabled): self { $this->options['voiceEnabled'] = $voiceEnabled; return $this; } /** * The commands_enabled * * @param bool $commandsEnabled The commands_enabled * @return $this Fluent Builder */ public function setCommandsEnabled(bool $commandsEnabled): self { $this->options['commandsEnabled'] = $commandsEnabled; return $this; } /** * The national_roaming_enabled * * @param bool $nationalRoamingEnabled The national_roaming_enabled * @return $this Fluent Builder */ public function setNationalRoamingEnabled(bool $nationalRoamingEnabled): self { $this->options['nationalRoamingEnabled'] = $nationalRoamingEnabled; return $this; } /** * The international_roaming * * @param string[] $internationalRoaming The international_roaming * @return $this Fluent Builder */ public function setInternationalRoaming(array $internationalRoaming): self { $this->options['internationalRoaming'] = $internationalRoaming; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Wireless.CreateRatePlanOptions ' . $options . ']'; } } class UpdateRatePlanOptions extends Options { /** * @param string $uniqueName The unique_name * @param string $friendlyName The friendly_name */ public function __construct(string $uniqueName = Values::NONE, string $friendlyName = Values::NONE) { $this->options['uniqueName'] = $uniqueName; $this->options['friendlyName'] = $friendlyName; } /** * The unique_name * * @param string $uniqueName The unique_name * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * The friendly_name * * @param string $friendlyName The friendly_name * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Wireless.UpdateRatePlanOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/Wireless/SimInstance.php000064400000012775150515725670015714 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'ratePlanSid' => Values::array_get($payload, 'rate_plan_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'iccid' => Values::array_get($payload, 'iccid'), 'eId' => Values::array_get($payload, 'e_id'), 'status' => Values::array_get($payload, 'status'), 'commandsCallbackUrl' => Values::array_get($payload, 'commands_callback_url'), 'commandsCallbackMethod' => Values::array_get($payload, 'commands_callback_method'), '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'), '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'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 SimContext Context for this SimInstance */ protected function proxy(): SimContext { if (!$this->context) { $this->context = new SimContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the SimInstance * * @return SimInstance Fetched SimInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SimInstance { return $this->proxy()->fetch(); } /** * Update the SimInstance * * @param array|Options $options Optional Arguments * @return SimInstance Updated SimInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SimInstance { return $this->proxy()->update($options); } /** * Access the usage */ protected function getUsage(): UsageList { return $this->proxy()->usage; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Wireless.SimInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Sync/ServiceInstance.php000064400000012005150515725670015665 0ustar00properties = [ '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'), 'webhookUrl' => Values::array_get($payload, 'webhook_url'), 'reachabilityWebhooksEnabled' => Values::array_get($payload, 'reachability_webhooks_enabled'), 'aclEnabled' => Values::array_get($payload, 'acl_enabled'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 ServiceContext Context for this ServiceInstance */ protected function proxy(): ServiceContext { if (!$this->context) { $this->context = new ServiceContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the ServiceInstance * * @return ServiceInstance Fetched ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ServiceInstance { return $this->proxy()->fetch(); } /** * Delete the ServiceInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the ServiceInstance * * @param array|Options $options Optional Arguments * @return ServiceInstance Updated ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ServiceInstance { return $this->proxy()->update($options); } /** * Access the documents */ protected function getDocuments(): DocumentList { return $this->proxy()->documents; } /** * Access the syncLists */ protected function getSyncLists(): SyncListList { return $this->proxy()->syncLists; } /** * Access the syncMaps */ protected function getSyncMaps(): SyncMapList { return $this->proxy()->syncMaps; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Sync.ServiceInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Sync/Service/SyncMapOptions.php000064400000003007150515725670017130 0ustar00options['uniqueName'] = $uniqueName; } /** * The unique_name * * @param string $uniqueName The unique_name * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Sync.CreateSyncMapOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/Sync/Service/DocumentPage.php000064400000002602150515725670016555 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return DocumentInstance \Twilio\Rest\Preview\Sync\Service\DocumentInstance */ public function buildInstance(array $payload): DocumentInstance { return new DocumentInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Sync.DocumentPage]'; } }src/Twilio/Rest/Preview/Sync/Service/DocumentOptions.php000064400000006041150515725670017335 0ustar00options['uniqueName'] = $uniqueName; $this->options['data'] = $data; } /** * The unique_name * * @param string $uniqueName The unique_name * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * The data * * @param array $data The data * @return $this Fluent Builder */ public function setData(array $data): self { $this->options['data'] = $data; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Sync.CreateDocumentOptions ' . $options . ']'; } } class UpdateDocumentOptions extends Options { /** * @param string $ifMatch The If-Match HTTP request header */ public function __construct(string $ifMatch = Values::NONE) { $this->options['ifMatch'] = $ifMatch; } /** * The If-Match HTTP request header * * @param string $ifMatch The If-Match HTTP request header * @return $this Fluent Builder */ public function setIfMatch(string $ifMatch): self { $this->options['ifMatch'] = $ifMatch; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Sync.UpdateDocumentOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/Sync/Service/SyncListInstance.php000064400000011262150515725670017441 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), 'revision' => Values::array_get($payload, 'revision'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'createdBy' => Values::array_get($payload, 'created_by'), ]; $this->solution = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return SyncListContext Context for this SyncListInstance */ protected function proxy(): SyncListContext { if (!$this->context) { $this->context = new SyncListContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the SyncListInstance * * @return SyncListInstance Fetched SyncListInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SyncListInstance { return $this->proxy()->fetch(); } /** * Delete the SyncListInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the syncListItems */ protected function getSyncListItems(): SyncListItemList { return $this->proxy()->syncListItems; } /** * Access the syncListPermissions */ protected function getSyncListPermissions(): SyncListPermissionList { return $this->proxy()->syncListPermissions; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Sync.SyncListInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Sync/Service/SyncMapContext.php000064400000011052150515725670017120 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Maps/' . \rawurlencode($sid) . ''; } /** * Fetch the SyncMapInstance * * @return SyncMapInstance Fetched SyncMapInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SyncMapInstance { $payload = $this->version->fetch('GET', $this->uri); return new SyncMapInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Delete the SyncMapInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the syncMapItems */ protected function getSyncMapItems(): SyncMapItemList { if (!$this->_syncMapItems) { $this->_syncMapItems = new SyncMapItemList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_syncMapItems; } /** * Access the syncMapPermissions */ protected function getSyncMapPermissions(): SyncMapPermissionList { if (!$this->_syncMapPermissions) { $this->_syncMapPermissions = new SyncMapPermissionList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_syncMapPermissions; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Sync.SyncMapContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Sync/Service/SyncMapPage.php000064400000002574150515725670016361 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SyncMapInstance \Twilio\Rest\Preview\Sync\Service\SyncMapInstance */ public function buildInstance(array $payload): SyncMapInstance { return new SyncMapInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Sync.SyncMapPage]'; } }src/Twilio/Rest/Preview/Sync/Service/SyncListList.php000064400000012762150515725670016616 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Lists'; } /** * Create the SyncListInstance * * @param array|Options $options Optional Arguments * @return SyncListInstance Created SyncListInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): SyncListInstance { $options = new Values($options); $data = Values::of(['UniqueName' => $options['uniqueName'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new SyncListInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Streams SyncListInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads SyncListInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return SyncListInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of SyncListInstance records from the API. * Request is executed immediately * * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return SyncListPage Page of SyncListInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SyncListPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new SyncListPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of SyncListInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return SyncListPage Page of SyncListInstance */ public function getPage(string $targetUrl): SyncListPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new SyncListPage($this->version, $response, $this->solution); } /** * Constructs a SyncListContext * * @param string $sid The sid */ public function getContext(string $sid): SyncListContext { return new SyncListContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Sync.SyncListList]'; } }src/Twilio/Rest/Preview/Sync/Service/SyncListPage.php000064400000002602150515725670016547 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SyncListInstance \Twilio\Rest\Preview\Sync\Service\SyncListInstance */ public function buildInstance(array $payload): SyncListInstance { return new SyncListInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Sync.SyncListPage]'; } }src/Twilio/Rest/Preview/Sync/Service/DocumentList.php000064400000013140150515725670016613 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Documents'; } /** * Create the DocumentInstance * * @param array|Options $options Optional Arguments * @return DocumentInstance Created DocumentInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): DocumentInstance { $options = new Values($options); $data = Values::of([ 'UniqueName' => $options['uniqueName'], 'Data' => Serialize::jsonObject($options['data']), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new DocumentInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Streams DocumentInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads DocumentInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return DocumentInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of DocumentInstance records from the API. * Request is executed immediately * * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return DocumentPage Page of DocumentInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): DocumentPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new DocumentPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of DocumentInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return DocumentPage Page of DocumentInstance */ public function getPage(string $targetUrl): DocumentPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new DocumentPage($this->version, $response, $this->solution); } /** * Constructs a DocumentContext * * @param string $sid The sid */ public function getContext(string $sid): DocumentContext { return new DocumentContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Sync.DocumentList]'; } }src/Twilio/Rest/Preview/Sync/Service/DocumentContext.php000064400000011442150515725670017327 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Documents/' . \rawurlencode($sid) . ''; } /** * Fetch the DocumentInstance * * @return DocumentInstance Fetched DocumentInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): DocumentInstance { $payload = $this->version->fetch('GET', $this->uri); return new DocumentInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Delete the DocumentInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the DocumentInstance * * @param array $data The data * @param array|Options $options Optional Arguments * @return DocumentInstance Updated DocumentInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $data, array $options = []): DocumentInstance { $options = new Values($options); $data = Values::of(['Data' => Serialize::jsonObject($data), ]); $headers = Values::of(['If-Match' => $options['ifMatch'], ]); $payload = $this->version->update('POST', $this->uri, [], $data, $headers); return new DocumentInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Access the documentPermissions */ protected function getDocumentPermissions(): DocumentPermissionList { if (!$this->_documentPermissions) { $this->_documentPermissions = new DocumentPermissionList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_documentPermissions; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Sync.DocumentContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Sync/Service/SyncMapInstance.php000064400000011230150515725670017236 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), 'revision' => Values::array_get($payload, 'revision'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'createdBy' => Values::array_get($payload, 'created_by'), ]; $this->solution = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return SyncMapContext Context for this SyncMapInstance */ protected function proxy(): SyncMapContext { if (!$this->context) { $this->context = new SyncMapContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the SyncMapInstance * * @return SyncMapInstance Fetched SyncMapInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SyncMapInstance { return $this->proxy()->fetch(); } /** * Delete the SyncMapInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the syncMapItems */ protected function getSyncMapItems(): SyncMapItemList { return $this->proxy()->syncMapItems; } /** * Access the syncMapPermissions */ protected function getSyncMapPermissions(): SyncMapPermissionList { return $this->proxy()->syncMapPermissions; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Sync.SyncMapInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListPermissionContext.php000064400000006732150515725670023150 0ustar00solution = ['serviceSid' => $serviceSid, 'listSid' => $listSid, 'identity' => $identity, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Lists/' . \rawurlencode($listSid) . '/Permissions/' . \rawurlencode($identity) . ''; } /** * Fetch the SyncListPermissionInstance * * @return SyncListPermissionInstance Fetched SyncListPermissionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SyncListPermissionInstance { $payload = $this->version->fetch('GET', $this->uri); return new SyncListPermissionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['listSid'], $this->solution['identity'] ); } /** * Delete the SyncListPermissionInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the SyncListPermissionInstance * * @param bool $read Read access. * @param bool $write Write access. * @param bool $manage Manage access. * @return SyncListPermissionInstance Updated SyncListPermissionInstance * @throws TwilioException When an HTTP error occurs. */ public function update(bool $read, bool $write, bool $manage): SyncListPermissionInstance { $data = Values::of([ 'Read' => Serialize::booleanToString($read), 'Write' => Serialize::booleanToString($write), 'Manage' => Serialize::booleanToString($manage), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new SyncListPermissionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['listSid'], $this->solution['identity'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Sync.SyncListPermissionContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListPermissionList.php000064400000012600150515725670022426 0ustar00solution = ['serviceSid' => $serviceSid, 'listSid' => $listSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Lists/' . \rawurlencode($listSid) . '/Permissions'; } /** * Streams SyncListPermissionInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads SyncListPermissionInstance 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 SyncListPermissionInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of SyncListPermissionInstance 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 SyncListPermissionPage Page of SyncListPermissionInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SyncListPermissionPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new SyncListPermissionPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of SyncListPermissionInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return SyncListPermissionPage Page of SyncListPermissionInstance */ public function getPage(string $targetUrl): SyncListPermissionPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new SyncListPermissionPage($this->version, $response, $this->solution); } /** * Constructs a SyncListPermissionContext * * @param string $identity Identity of the user to whom the Sync List * Permission applies. */ public function getContext(string $identity): SyncListPermissionContext { return new SyncListPermissionContext( $this->version, $this->solution['serviceSid'], $this->solution['listSid'], $identity ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Sync.SyncListPermissionList]'; } }src/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListItemContext.php000064400000006653150515725670021720 0ustar00solution = ['serviceSid' => $serviceSid, 'listSid' => $listSid, 'index' => $index, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Lists/' . \rawurlencode($listSid) . '/Items/' . \rawurlencode($index) . ''; } /** * Fetch the SyncListItemInstance * * @return SyncListItemInstance Fetched SyncListItemInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SyncListItemInstance { $payload = $this->version->fetch('GET', $this->uri); return new SyncListItemInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['listSid'], $this->solution['index'] ); } /** * Delete the SyncListItemInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { $options = new Values($options); $headers = Values::of(['If-Match' => $options['ifMatch'], ]); return $this->version->delete('DELETE', $this->uri, [], [], $headers); } /** * Update the SyncListItemInstance * * @param array $data The data * @param array|Options $options Optional Arguments * @return SyncListItemInstance Updated SyncListItemInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $data, array $options = []): SyncListItemInstance { $options = new Values($options); $data = Values::of(['Data' => Serialize::jsonObject($data), ]); $headers = Values::of(['If-Match' => $options['ifMatch'], ]); $payload = $this->version->update('POST', $this->uri, [], $data, $headers); return new SyncListItemInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['listSid'], $this->solution['index'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Sync.SyncListItemContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListItemOptions.php000064400000011062150515725670021715 0ustar00options['ifMatch'] = $ifMatch; } /** * The If-Match HTTP request header * * @param string $ifMatch The If-Match HTTP request header * @return $this Fluent Builder */ public function setIfMatch(string $ifMatch): self { $this->options['ifMatch'] = $ifMatch; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Sync.DeleteSyncListItemOptions ' . $options . ']'; } } class ReadSyncListItemOptions extends Options { /** * @param string $order The order * @param string $from The from * @param string $bounds The bounds */ public function __construct(string $order = Values::NONE, string $from = Values::NONE, string $bounds = Values::NONE) { $this->options['order'] = $order; $this->options['from'] = $from; $this->options['bounds'] = $bounds; } /** * The order * * @param string $order The order * @return $this Fluent Builder */ public function setOrder(string $order): self { $this->options['order'] = $order; return $this; } /** * The from * * @param string $from The from * @return $this Fluent Builder */ public function setFrom(string $from): self { $this->options['from'] = $from; return $this; } /** * The bounds * * @param string $bounds The bounds * @return $this Fluent Builder */ public function setBounds(string $bounds): self { $this->options['bounds'] = $bounds; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Sync.ReadSyncListItemOptions ' . $options . ']'; } } class UpdateSyncListItemOptions extends Options { /** * @param string $ifMatch The If-Match HTTP request header */ public function __construct(string $ifMatch = Values::NONE) { $this->options['ifMatch'] = $ifMatch; } /** * The If-Match HTTP request header * * @param string $ifMatch The If-Match HTTP request header * @return $this Fluent Builder */ public function setIfMatch(string $ifMatch): self { $this->options['ifMatch'] = $ifMatch; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Sync.UpdateSyncListItemOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListItemInstance.php000064400000011574150515725670022036 0ustar00properties = [ 'index' => Values::array_get($payload, 'index'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'listSid' => Values::array_get($payload, 'list_sid'), 'url' => Values::array_get($payload, 'url'), 'revision' => Values::array_get($payload, 'revision'), 'data' => Values::array_get($payload, 'data'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'createdBy' => Values::array_get($payload, 'created_by'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'listSid' => $listSid, 'index' => $index ?: $this->properties['index'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return SyncListItemContext Context for this SyncListItemInstance */ protected function proxy(): SyncListItemContext { if (!$this->context) { $this->context = new SyncListItemContext( $this->version, $this->solution['serviceSid'], $this->solution['listSid'], $this->solution['index'] ); } return $this->context; } /** * Fetch the SyncListItemInstance * * @return SyncListItemInstance Fetched SyncListItemInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SyncListItemInstance { return $this->proxy()->fetch(); } /** * Delete the SyncListItemInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { return $this->proxy()->delete($options); } /** * Update the SyncListItemInstance * * @param array $data The data * @param array|Options $options Optional Arguments * @return SyncListItemInstance Updated SyncListItemInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $data, array $options = []): SyncListItemInstance { return $this->proxy()->update($data, $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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Sync.SyncListItemInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListItemPage.php000064400000003002150515725670021131 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SyncListItemInstance \Twilio\Rest\Preview\Sync\Service\SyncList\SyncListItemInstance */ public function buildInstance(array $payload): SyncListItemInstance { return new SyncListItemInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['listSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Sync.SyncListItemPage]'; } }src/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListPermissionInstance.php000064400000011351150515725670023261 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'listSid' => Values::array_get($payload, 'list_sid'), 'identity' => Values::array_get($payload, 'identity'), 'read' => Values::array_get($payload, 'read'), 'write' => Values::array_get($payload, 'write'), 'manage' => Values::array_get($payload, 'manage'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'listSid' => $listSid, 'identity' => $identity ?: $this->properties['identity'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return SyncListPermissionContext Context for this SyncListPermissionInstance */ protected function proxy(): SyncListPermissionContext { if (!$this->context) { $this->context = new SyncListPermissionContext( $this->version, $this->solution['serviceSid'], $this->solution['listSid'], $this->solution['identity'] ); } return $this->context; } /** * Fetch the SyncListPermissionInstance * * @return SyncListPermissionInstance Fetched SyncListPermissionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SyncListPermissionInstance { return $this->proxy()->fetch(); } /** * Delete the SyncListPermissionInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the SyncListPermissionInstance * * @param bool $read Read access. * @param bool $write Write access. * @param bool $manage Manage access. * @return SyncListPermissionInstance Updated SyncListPermissionInstance * @throws TwilioException When an HTTP error occurs. */ public function update(bool $read, bool $write, bool $manage): SyncListPermissionInstance { return $this->proxy()->update($read, $write, $manage); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Sync.SyncListPermissionInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListPermissionPage.php000064400000003046150515725670022373 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SyncListPermissionInstance \Twilio\Rest\Preview\Sync\Service\SyncList\SyncListPermissionInstance */ public function buildInstance(array $payload): SyncListPermissionInstance { return new SyncListPermissionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['listSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Sync.SyncListPermissionPage]'; } }src/Twilio/Rest/Preview/Sync/Service/SyncList/SyncListItemList.php000064400000014441150515725670021201 0ustar00solution = ['serviceSid' => $serviceSid, 'listSid' => $listSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Lists/' . \rawurlencode($listSid) . '/Items'; } /** * Create the SyncListItemInstance * * @param array $data The data * @return SyncListItemInstance Created SyncListItemInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $data): SyncListItemInstance { $data = Values::of(['Data' => Serialize::jsonObject($data), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new SyncListItemInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['listSid'] ); } /** * Streams SyncListItemInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param array|Options $options Optional Arguments * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads SyncListItemInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param array|Options $options Optional Arguments * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return SyncListItemInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of SyncListItemInstance records from the API. * Request is executed immediately * * @param array|Options $options Optional Arguments * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return SyncListItemPage Page of SyncListItemInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SyncListItemPage { $options = new Values($options); $params = Values::of([ 'Order' => $options['order'], 'From' => $options['from'], 'Bounds' => $options['bounds'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new SyncListItemPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of SyncListItemInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return SyncListItemPage Page of SyncListItemInstance */ public function getPage(string $targetUrl): SyncListItemPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new SyncListItemPage($this->version, $response, $this->solution); } /** * Constructs a SyncListItemContext * * @param int $index The index */ public function getContext(int $index): SyncListItemContext { return new SyncListItemContext( $this->version, $this->solution['serviceSid'], $this->solution['listSid'], $index ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Sync.SyncListItemList]'; } }src/Twilio/Rest/Preview/Sync/Service/SyncMapList.php000064400000012731150515725670016414 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Maps'; } /** * Create the SyncMapInstance * * @param array|Options $options Optional Arguments * @return SyncMapInstance Created SyncMapInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): SyncMapInstance { $options = new Values($options); $data = Values::of(['UniqueName' => $options['uniqueName'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new SyncMapInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Streams SyncMapInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads SyncMapInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return SyncMapInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of SyncMapInstance records from the API. * Request is executed immediately * * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return SyncMapPage Page of SyncMapInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SyncMapPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new SyncMapPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of SyncMapInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return SyncMapPage Page of SyncMapInstance */ public function getPage(string $targetUrl): SyncMapPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new SyncMapPage($this->version, $response, $this->solution); } /** * Constructs a SyncMapContext * * @param string $sid The sid */ public function getContext(string $sid): SyncMapContext { return new SyncMapContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Sync.SyncMapList]'; } }src/Twilio/Rest/Preview/Sync/Service/SyncListOptions.php000064400000003015150515725670017325 0ustar00options['uniqueName'] = $uniqueName; } /** * The unique_name * * @param string $uniqueName The unique_name * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Sync.CreateSyncListOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapItemList.php000064400000014473150515725670020612 0ustar00solution = ['serviceSid' => $serviceSid, 'mapSid' => $mapSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Maps/' . \rawurlencode($mapSid) . '/Items'; } /** * Create the SyncMapItemInstance * * @param string $key The key * @param array $data The data * @return SyncMapItemInstance Created SyncMapItemInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $key, array $data): SyncMapItemInstance { $data = Values::of(['Key' => $key, 'Data' => Serialize::jsonObject($data), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new SyncMapItemInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['mapSid'] ); } /** * Streams SyncMapItemInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param array|Options $options Optional Arguments * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads SyncMapItemInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param array|Options $options Optional Arguments * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return SyncMapItemInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of SyncMapItemInstance records from the API. * Request is executed immediately * * @param array|Options $options Optional Arguments * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return SyncMapItemPage Page of SyncMapItemInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SyncMapItemPage { $options = new Values($options); $params = Values::of([ 'Order' => $options['order'], 'From' => $options['from'], 'Bounds' => $options['bounds'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new SyncMapItemPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of SyncMapItemInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return SyncMapItemPage Page of SyncMapItemInstance */ public function getPage(string $targetUrl): SyncMapItemPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new SyncMapItemPage($this->version, $response, $this->solution); } /** * Constructs a SyncMapItemContext * * @param string $key The key */ public function getContext(string $key): SyncMapItemContext { return new SyncMapItemContext( $this->version, $this->solution['serviceSid'], $this->solution['mapSid'], $key ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Sync.SyncMapItemList]'; } }src/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapPermissionPage.php000064400000003035150515725670021775 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SyncMapPermissionInstance \Twilio\Rest\Preview\Sync\Service\SyncMap\SyncMapPermissionInstance */ public function buildInstance(array $payload): SyncMapPermissionInstance { return new SyncMapPermissionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['mapSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Sync.SyncMapPermissionPage]'; } }src/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapPermissionList.php000064400000012534150515725670022040 0ustar00solution = ['serviceSid' => $serviceSid, 'mapSid' => $mapSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Maps/' . \rawurlencode($mapSid) . '/Permissions'; } /** * Streams SyncMapPermissionInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads SyncMapPermissionInstance 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 SyncMapPermissionInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of SyncMapPermissionInstance 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 SyncMapPermissionPage Page of SyncMapPermissionInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SyncMapPermissionPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new SyncMapPermissionPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of SyncMapPermissionInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return SyncMapPermissionPage Page of SyncMapPermissionInstance */ public function getPage(string $targetUrl): SyncMapPermissionPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new SyncMapPermissionPage($this->version, $response, $this->solution); } /** * Constructs a SyncMapPermissionContext * * @param string $identity Identity of the user to whom the Sync Map Permission * applies. */ public function getContext(string $identity): SyncMapPermissionContext { return new SyncMapPermissionContext( $this->version, $this->solution['serviceSid'], $this->solution['mapSid'], $identity ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Sync.SyncMapPermissionList]'; } }src/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapItemContext.php000064400000006606150515725670021322 0ustar00solution = ['serviceSid' => $serviceSid, 'mapSid' => $mapSid, 'key' => $key, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Maps/' . \rawurlencode($mapSid) . '/Items/' . \rawurlencode($key) . ''; } /** * Fetch the SyncMapItemInstance * * @return SyncMapItemInstance Fetched SyncMapItemInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SyncMapItemInstance { $payload = $this->version->fetch('GET', $this->uri); return new SyncMapItemInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['mapSid'], $this->solution['key'] ); } /** * Delete the SyncMapItemInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { $options = new Values($options); $headers = Values::of(['If-Match' => $options['ifMatch'], ]); return $this->version->delete('DELETE', $this->uri, [], [], $headers); } /** * Update the SyncMapItemInstance * * @param array $data The data * @param array|Options $options Optional Arguments * @return SyncMapItemInstance Updated SyncMapItemInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $data, array $options = []): SyncMapItemInstance { $options = new Values($options); $data = Values::of(['Data' => Serialize::jsonObject($data), ]); $headers = Values::of(['If-Match' => $options['ifMatch'], ]); $payload = $this->version->update('POST', $this->uri, [], $data, $headers); return new SyncMapItemInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['mapSid'], $this->solution['key'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Sync.SyncMapItemContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapPermissionContext.php000064400000006701150515725670022550 0ustar00solution = ['serviceSid' => $serviceSid, 'mapSid' => $mapSid, 'identity' => $identity, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Maps/' . \rawurlencode($mapSid) . '/Permissions/' . \rawurlencode($identity) . ''; } /** * Fetch the SyncMapPermissionInstance * * @return SyncMapPermissionInstance Fetched SyncMapPermissionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SyncMapPermissionInstance { $payload = $this->version->fetch('GET', $this->uri); return new SyncMapPermissionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['mapSid'], $this->solution['identity'] ); } /** * Delete the SyncMapPermissionInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the SyncMapPermissionInstance * * @param bool $read Read access. * @param bool $write Write access. * @param bool $manage Manage access. * @return SyncMapPermissionInstance Updated SyncMapPermissionInstance * @throws TwilioException When an HTTP error occurs. */ public function update(bool $read, bool $write, bool $manage): SyncMapPermissionInstance { $data = Values::of([ 'Read' => Serialize::booleanToString($read), 'Write' => Serialize::booleanToString($write), 'Manage' => Serialize::booleanToString($manage), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new SyncMapPermissionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['mapSid'], $this->solution['identity'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Sync.SyncMapPermissionContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapItemOptions.php000064400000011041150515725670021316 0ustar00options['ifMatch'] = $ifMatch; } /** * The If-Match HTTP request header * * @param string $ifMatch The If-Match HTTP request header * @return $this Fluent Builder */ public function setIfMatch(string $ifMatch): self { $this->options['ifMatch'] = $ifMatch; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Sync.DeleteSyncMapItemOptions ' . $options . ']'; } } class ReadSyncMapItemOptions extends Options { /** * @param string $order The order * @param string $from The from * @param string $bounds The bounds */ public function __construct(string $order = Values::NONE, string $from = Values::NONE, string $bounds = Values::NONE) { $this->options['order'] = $order; $this->options['from'] = $from; $this->options['bounds'] = $bounds; } /** * The order * * @param string $order The order * @return $this Fluent Builder */ public function setOrder(string $order): self { $this->options['order'] = $order; return $this; } /** * The from * * @param string $from The from * @return $this Fluent Builder */ public function setFrom(string $from): self { $this->options['from'] = $from; return $this; } /** * The bounds * * @param string $bounds The bounds * @return $this Fluent Builder */ public function setBounds(string $bounds): self { $this->options['bounds'] = $bounds; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Sync.ReadSyncMapItemOptions ' . $options . ']'; } } class UpdateSyncMapItemOptions extends Options { /** * @param string $ifMatch The If-Match HTTP request header */ public function __construct(string $ifMatch = Values::NONE) { $this->options['ifMatch'] = $ifMatch; } /** * The If-Match HTTP request header * * @param string $ifMatch The If-Match HTTP request header * @return $this Fluent Builder */ public function setIfMatch(string $ifMatch): self { $this->options['ifMatch'] = $ifMatch; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Sync.UpdateSyncMapItemOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapItemPage.php000064400000002771150515725670020551 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SyncMapItemInstance \Twilio\Rest\Preview\Sync\Service\SyncMap\SyncMapItemInstance */ public function buildInstance(array $payload): SyncMapItemInstance { return new SyncMapItemInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['mapSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Sync.SyncMapItemPage]'; } }src/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapItemInstance.php000064400000011527150515725670021440 0ustar00properties = [ 'key' => Values::array_get($payload, 'key'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'mapSid' => Values::array_get($payload, 'map_sid'), 'url' => Values::array_get($payload, 'url'), 'revision' => Values::array_get($payload, 'revision'), 'data' => Values::array_get($payload, 'data'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'createdBy' => Values::array_get($payload, 'created_by'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'mapSid' => $mapSid, 'key' => $key ?: $this->properties['key'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return SyncMapItemContext Context for this SyncMapItemInstance */ protected function proxy(): SyncMapItemContext { if (!$this->context) { $this->context = new SyncMapItemContext( $this->version, $this->solution['serviceSid'], $this->solution['mapSid'], $this->solution['key'] ); } return $this->context; } /** * Fetch the SyncMapItemInstance * * @return SyncMapItemInstance Fetched SyncMapItemInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SyncMapItemInstance { return $this->proxy()->fetch(); } /** * Delete the SyncMapItemInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { return $this->proxy()->delete($options); } /** * Update the SyncMapItemInstance * * @param array $data The data * @param array|Options $options Optional Arguments * @return SyncMapItemInstance Updated SyncMapItemInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $data, array $options = []): SyncMapItemInstance { return $this->proxy()->update($data, $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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Sync.SyncMapItemInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Sync/Service/SyncMap/SyncMapPermissionInstance.php000064400000011316150515725670022666 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'mapSid' => Values::array_get($payload, 'map_sid'), 'identity' => Values::array_get($payload, 'identity'), 'read' => Values::array_get($payload, 'read'), 'write' => Values::array_get($payload, 'write'), 'manage' => Values::array_get($payload, 'manage'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'mapSid' => $mapSid, 'identity' => $identity ?: $this->properties['identity'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return SyncMapPermissionContext Context for this SyncMapPermissionInstance */ protected function proxy(): SyncMapPermissionContext { if (!$this->context) { $this->context = new SyncMapPermissionContext( $this->version, $this->solution['serviceSid'], $this->solution['mapSid'], $this->solution['identity'] ); } return $this->context; } /** * Fetch the SyncMapPermissionInstance * * @return SyncMapPermissionInstance Fetched SyncMapPermissionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SyncMapPermissionInstance { return $this->proxy()->fetch(); } /** * Delete the SyncMapPermissionInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the SyncMapPermissionInstance * * @param bool $read Read access. * @param bool $write Write access. * @param bool $manage Manage access. * @return SyncMapPermissionInstance Updated SyncMapPermissionInstance * @throws TwilioException When an HTTP error occurs. */ public function update(bool $read, bool $write, bool $manage): SyncMapPermissionInstance { return $this->proxy()->update($read, $write, $manage); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Sync.SyncMapPermissionInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Sync/Service/DocumentInstance.php000064400000011660150515725670017451 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), 'revision' => Values::array_get($payload, 'revision'), 'data' => Values::array_get($payload, 'data'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'createdBy' => Values::array_get($payload, 'created_by'), ]; $this->solution = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return DocumentContext Context for this DocumentInstance */ protected function proxy(): DocumentContext { if (!$this->context) { $this->context = new DocumentContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the DocumentInstance * * @return DocumentInstance Fetched DocumentInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): DocumentInstance { return $this->proxy()->fetch(); } /** * Delete the DocumentInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the DocumentInstance * * @param array $data The data * @param array|Options $options Optional Arguments * @return DocumentInstance Updated DocumentInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $data, array $options = []): DocumentInstance { return $this->proxy()->update($data, $options); } /** * Access the documentPermissions */ protected function getDocumentPermissions(): DocumentPermissionList { return $this->proxy()->documentPermissions; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Sync.DocumentInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Sync/Service/Document/DocumentPermissionContext.php000064400000007057150515725670023165 0ustar00solution = [ 'serviceSid' => $serviceSid, 'documentSid' => $documentSid, 'identity' => $identity, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Documents/' . \rawurlencode($documentSid) . '/Permissions/' . \rawurlencode($identity) . ''; } /** * Fetch the DocumentPermissionInstance * * @return DocumentPermissionInstance Fetched DocumentPermissionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): DocumentPermissionInstance { $payload = $this->version->fetch('GET', $this->uri); return new DocumentPermissionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['documentSid'], $this->solution['identity'] ); } /** * Delete the DocumentPermissionInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the DocumentPermissionInstance * * @param bool $read Read access. * @param bool $write Write access. * @param bool $manage Manage access. * @return DocumentPermissionInstance Updated DocumentPermissionInstance * @throws TwilioException When an HTTP error occurs. */ public function update(bool $read, bool $write, bool $manage): DocumentPermissionInstance { $data = Values::of([ 'Read' => Serialize::booleanToString($read), 'Write' => Serialize::booleanToString($write), 'Manage' => Serialize::booleanToString($manage), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new DocumentPermissionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['documentSid'], $this->solution['identity'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Sync.DocumentPermissionContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Sync/Service/Document/DocumentPermissionPage.php000064400000003052150515725670022404 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return DocumentPermissionInstance \Twilio\Rest\Preview\Sync\Service\Document\DocumentPermissionInstance */ public function buildInstance(array $payload): DocumentPermissionInstance { return new DocumentPermissionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['documentSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Sync.DocumentPermissionPage]'; } }src/Twilio/Rest/Preview/Sync/Service/Document/DocumentPermissionInstance.php000064400000011421150515725670023273 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'documentSid' => Values::array_get($payload, 'document_sid'), 'identity' => Values::array_get($payload, 'identity'), 'read' => Values::array_get($payload, 'read'), 'write' => Values::array_get($payload, 'write'), 'manage' => Values::array_get($payload, 'manage'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'documentSid' => $documentSid, 'identity' => $identity ?: $this->properties['identity'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return DocumentPermissionContext Context for this DocumentPermissionInstance */ protected function proxy(): DocumentPermissionContext { if (!$this->context) { $this->context = new DocumentPermissionContext( $this->version, $this->solution['serviceSid'], $this->solution['documentSid'], $this->solution['identity'] ); } return $this->context; } /** * Fetch the DocumentPermissionInstance * * @return DocumentPermissionInstance Fetched DocumentPermissionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): DocumentPermissionInstance { return $this->proxy()->fetch(); } /** * Delete the DocumentPermissionInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the DocumentPermissionInstance * * @param bool $read Read access. * @param bool $write Write access. * @param bool $manage Manage access. * @return DocumentPermissionInstance Updated DocumentPermissionInstance * @throws TwilioException When an HTTP error occurs. */ public function update(bool $read, bool $write, bool $manage): DocumentPermissionInstance { return $this->proxy()->update($read, $write, $manage); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Sync.DocumentPermissionInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Sync/Service/Document/DocumentPermissionList.php000064400000012644150515725670022452 0ustar00solution = ['serviceSid' => $serviceSid, 'documentSid' => $documentSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Documents/' . \rawurlencode($documentSid) . '/Permissions'; } /** * Streams DocumentPermissionInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads DocumentPermissionInstance 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 DocumentPermissionInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of DocumentPermissionInstance 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 DocumentPermissionPage Page of DocumentPermissionInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): DocumentPermissionPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new DocumentPermissionPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of DocumentPermissionInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return DocumentPermissionPage Page of DocumentPermissionInstance */ public function getPage(string $targetUrl): DocumentPermissionPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new DocumentPermissionPage($this->version, $response, $this->solution); } /** * Constructs a DocumentPermissionContext * * @param string $identity Identity of the user to whom the Sync Document * Permission applies. */ public function getContext(string $identity): DocumentPermissionContext { return new DocumentPermissionContext( $this->version, $this->solution['serviceSid'], $this->solution['documentSid'], $identity ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Sync.DocumentPermissionList]'; } }src/Twilio/Rest/Preview/Sync/Service/SyncListContext.php000064400000011121150515725670017313 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Lists/' . \rawurlencode($sid) . ''; } /** * Fetch the SyncListInstance * * @return SyncListInstance Fetched SyncListInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SyncListInstance { $payload = $this->version->fetch('GET', $this->uri); return new SyncListInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Delete the SyncListInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the syncListItems */ protected function getSyncListItems(): SyncListItemList { if (!$this->_syncListItems) { $this->_syncListItems = new SyncListItemList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_syncListItems; } /** * Access the syncListPermissions */ protected function getSyncListPermissions(): SyncListPermissionList { if (!$this->_syncListPermissions) { $this->_syncListPermissions = new SyncListPermissionList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_syncListPermissions; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Sync.SyncListContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Sync/ServiceContext.php000064400000012420150515725670015546 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($sid) . ''; } /** * Fetch the ServiceInstance * * @return ServiceInstance Fetched ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ServiceInstance { $payload = $this->version->fetch('GET', $this->uri); return new ServiceInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the ServiceInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the ServiceInstance * * @param array|Options $options Optional Arguments * @return ServiceInstance Updated ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ServiceInstance { $options = new Values($options); $data = Values::of([ 'WebhookUrl' => $options['webhookUrl'], 'FriendlyName' => $options['friendlyName'], 'ReachabilityWebhooksEnabled' => Serialize::booleanToString($options['reachabilityWebhooksEnabled']), 'AclEnabled' => Serialize::booleanToString($options['aclEnabled']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ServiceInstance($this->version, $payload, $this->solution['sid']); } /** * Access the documents */ protected function getDocuments(): DocumentList { if (!$this->_documents) { $this->_documents = new DocumentList($this->version, $this->solution['sid']); } return $this->_documents; } /** * Access the syncLists */ protected function getSyncLists(): SyncListList { if (!$this->_syncLists) { $this->_syncLists = new SyncListList($this->version, $this->solution['sid']); } return $this->_syncLists; } /** * Access the syncMaps */ protected function getSyncMaps(): SyncMapList { if (!$this->_syncMaps) { $this->_syncMaps = new SyncMapList($this->version, $this->solution['sid']); } return $this->_syncMaps; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.Sync.ServiceContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/Sync/ServiceOptions.php000064400000014153150515725670015562 0ustar00options['friendlyName'] = $friendlyName; $this->options['webhookUrl'] = $webhookUrl; $this->options['reachabilityWebhooksEnabled'] = $reachabilityWebhooksEnabled; $this->options['aclEnabled'] = $aclEnabled; } /** * The friendly_name * * @param string $friendlyName The friendly_name * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The webhook_url * * @param string $webhookUrl The webhook_url * @return $this Fluent Builder */ public function setWebhookUrl(string $webhookUrl): self { $this->options['webhookUrl'] = $webhookUrl; return $this; } /** * The reachability_webhooks_enabled * * @param bool $reachabilityWebhooksEnabled The reachability_webhooks_enabled * @return $this Fluent Builder */ public function setReachabilityWebhooksEnabled(bool $reachabilityWebhooksEnabled): self { $this->options['reachabilityWebhooksEnabled'] = $reachabilityWebhooksEnabled; return $this; } /** * The acl_enabled * * @param bool $aclEnabled The acl_enabled * @return $this Fluent Builder */ public function setAclEnabled(bool $aclEnabled): self { $this->options['aclEnabled'] = $aclEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Sync.CreateServiceOptions ' . $options . ']'; } } class UpdateServiceOptions extends Options { /** * @param string $webhookUrl The webhook_url * @param string $friendlyName The friendly_name * @param bool $reachabilityWebhooksEnabled The reachability_webhooks_enabled * @param bool $aclEnabled The acl_enabled */ public function __construct(string $webhookUrl = Values::NONE, string $friendlyName = Values::NONE, bool $reachabilityWebhooksEnabled = Values::NONE, bool $aclEnabled = Values::NONE) { $this->options['webhookUrl'] = $webhookUrl; $this->options['friendlyName'] = $friendlyName; $this->options['reachabilityWebhooksEnabled'] = $reachabilityWebhooksEnabled; $this->options['aclEnabled'] = $aclEnabled; } /** * The webhook_url * * @param string $webhookUrl The webhook_url * @return $this Fluent Builder */ public function setWebhookUrl(string $webhookUrl): self { $this->options['webhookUrl'] = $webhookUrl; return $this; } /** * The friendly_name * * @param string $friendlyName The friendly_name * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The reachability_webhooks_enabled * * @param bool $reachabilityWebhooksEnabled The reachability_webhooks_enabled * @return $this Fluent Builder */ public function setReachabilityWebhooksEnabled(bool $reachabilityWebhooksEnabled): self { $this->options['reachabilityWebhooksEnabled'] = $reachabilityWebhooksEnabled; return $this; } /** * The acl_enabled * * @param bool $aclEnabled The acl_enabled * @return $this Fluent Builder */ public function setAclEnabled(bool $aclEnabled): self { $this->options['aclEnabled'] = $aclEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.Sync.UpdateServiceOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/Sync/ServicePage.php000064400000002515150515725670015002 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ServiceInstance \Twilio\Rest\Preview\Sync\ServiceInstance */ public function buildInstance(array $payload): ServiceInstance { return new ServiceInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Sync.ServicePage]'; } }src/Twilio/Rest/Preview/Sync/ServiceList.php000064400000013056150515725670015043 0ustar00solution = []; $this->uri = '/Services'; } /** * Create the ServiceInstance * * @param array|Options $options Optional Arguments * @return ServiceInstance Created ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): ServiceInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'WebhookUrl' => $options['webhookUrl'], 'ReachabilityWebhooksEnabled' => Serialize::booleanToString($options['reachabilityWebhooksEnabled']), 'AclEnabled' => Serialize::booleanToString($options['aclEnabled']), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ServiceInstance($this->version, $payload); } /** * Streams ServiceInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ServiceInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return ServiceInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of ServiceInstance records from the API. * Request is executed immediately * * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return ServicePage Page of ServiceInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ServicePage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ServicePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ServiceInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ServicePage Page of ServiceInstance */ public function getPage(string $targetUrl): ServicePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ServicePage($this->version, $response, $this->solution); } /** * Constructs a ServiceContext * * @param string $sid The sid */ public function getContext(string $sid): ServiceContext { return new ServiceContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.Sync.ServiceList]'; } }src/Twilio/Rest/Preview/DeployedDevices.php000064400000004333150515725670014741 0ustar00version = 'DeployedDevices'; } protected function getFleets(): FleetList { if (!$this->_fleets) { $this->_fleets = new FleetList($this); } return $this->_fleets; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Preview.DeployedDevices]'; } }src/Twilio/Rest/Preview/Understand.php000064400000004355150515725670014004 0ustar00version = 'understand'; } protected function getAssistants(): AssistantList { if (!$this->_assistants) { $this->_assistants = new AssistantList($this); } return $this->_assistants; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Preview.Understand]'; } }src/Twilio/Rest/Preview/BulkExports.php000064400000005347150515725670014161 0ustar00version = 'BulkExports'; } protected function getExports(): ExportList { if (!$this->_exports) { $this->_exports = new ExportList($this); } return $this->_exports; } protected function getExportConfiguration(): ExportConfigurationList { if (!$this->_exportConfiguration) { $this->_exportConfiguration = new ExportConfigurationList($this); } return $this->_exportConfiguration; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Preview.BulkExports]'; } }src/Twilio/Rest/Preview/TrustedComms/CpsOptions.php000064400000003400150515725670016415 0ustar00options['xXcnamSensitivePhoneNumber'] = $xXcnamSensitivePhoneNumber; } /** * Phone number used to retrieve its corresponding CPS. * * @param string $xXcnamSensitivePhoneNumber Phone number to retrieve CPS. * @return $this Fluent Builder */ public function setXXcnamSensitivePhoneNumber(string $xXcnamSensitivePhoneNumber): self { $this->options['xXcnamSensitivePhoneNumber'] = $xXcnamSensitivePhoneNumber; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.TrustedComms.FetchCpsOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/TrustedComms/CpsPage.php000064400000002515150515725670015644 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CpsInstance \Twilio\Rest\Preview\TrustedComms\CpsInstance */ public function buildInstance(array $payload): CpsInstance { return new CpsInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.TrustedComms.CpsPage]'; } }src/Twilio/Rest/Preview/TrustedComms/CurrentCallList.php000064400000002164150515725670017374 0ustar00solution = []; } /** * Constructs a CurrentCallContext */ public function getContext(): CurrentCallContext { return new CurrentCallContext($this->version); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.TrustedComms.CurrentCallList]'; } }src/Twilio/Rest/Preview/TrustedComms/BrandsInformationInstance.php000064400000006331150515725670021426 0ustar00properties = [ 'updateTime' => Deserialize::dateTime(Values::array_get($payload, 'update_time')), 'fileLink' => Values::array_get($payload, 'file_link'), 'fileLinkTtlInSeconds' => Values::array_get($payload, 'file_link_ttl_in_seconds'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = []; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return BrandsInformationContext Context for this BrandsInformationInstance */ protected function proxy(): BrandsInformationContext { if (!$this->context) { $this->context = new BrandsInformationContext($this->version); } return $this->context; } /** * Fetch the BrandsInformationInstance * * @param array|Options $options Optional Arguments * @return BrandsInformationInstance Fetched BrandsInformationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): BrandsInformationInstance { return $this->proxy()->fetch($options); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.TrustedComms.BrandsInformationInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/TrustedComms/BrandedChannelPage.php000064400000002617150515725670017752 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return BrandedChannelInstance \Twilio\Rest\Preview\TrustedComms\BrandedChannelInstance */ public function buildInstance(array $payload): BrandedChannelInstance { return new BrandedChannelInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.TrustedComms.BrandedChannelPage]'; } }src/Twilio/Rest/Preview/TrustedComms/BrandedChannel/ChannelInstance.php000064400000005102150515725670022202 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'businessSid' => Values::array_get($payload, 'business_sid'), 'brandSid' => Values::array_get($payload, 'brand_sid'), 'brandedChannelSid' => Values::array_get($payload, 'branded_channel_sid'), 'phoneNumberSid' => Values::array_get($payload, 'phone_number_sid'), 'phoneNumber' => Values::array_get($payload, 'phone_number'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['brandedChannelSid' => $brandedChannelSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Preview.TrustedComms.ChannelInstance]'; } }src/Twilio/Rest/Preview/TrustedComms/BrandedChannel/ChannelPage.php000064400000002651150515725670021320 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ChannelInstance \Twilio\Rest\Preview\TrustedComms\BrandedChannel\ChannelInstance */ public function buildInstance(array $payload): ChannelInstance { return new ChannelInstance($this->version, $payload, $this->solution['brandedChannelSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.TrustedComms.ChannelPage]'; } }src/Twilio/Rest/Preview/TrustedComms/BrandedChannel/ChannelList.php000064400000003426150515725670021360 0ustar00solution = ['brandedChannelSid' => $brandedChannelSid, ]; $this->uri = '/BrandedChannels/' . \rawurlencode($brandedChannelSid) . '/Channels'; } /** * Create the ChannelInstance * * @param string $phoneNumberSid Phone Number Sid to be branded. * @return ChannelInstance Created ChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $phoneNumberSid): ChannelInstance { $data = Values::of(['PhoneNumberSid' => $phoneNumberSid, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ChannelInstance($this->version, $payload, $this->solution['brandedChannelSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.TrustedComms.ChannelList]'; } }src/Twilio/Rest/Preview/TrustedComms/CurrentCallContext.php000064400000003714150515725670020107 0ustar00solution = []; $this->uri = '/CurrentCall'; } /** * Fetch the CurrentCallInstance * * @param array|Options $options Optional Arguments * @return CurrentCallInstance Fetched CurrentCallInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): CurrentCallInstance { $options = new Values($options); $headers = Values::of([ 'X-Xcnam-Sensitive-Phone-Number-From' => $options['xXcnamSensitivePhoneNumberFrom'], 'X-Xcnam-Sensitive-Phone-Number-To' => $options['xXcnamSensitivePhoneNumberTo'], ]); $payload = $this->version->fetch('GET', $this->uri, [], [], $headers); return new CurrentCallInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.TrustedComms.CurrentCallContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/TrustedComms/BrandedChannelList.php000064400000002315150515725670020004 0ustar00solution = []; } /** * Constructs a BrandedChannelContext * * @param string $sid Branded Channel Sid. */ public function getContext(string $sid): BrandedChannelContext { return new BrandedChannelContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.TrustedComms.BrandedChannelList]'; } }src/Twilio/Rest/Preview/TrustedComms/CurrentCallPage.php000064400000002575150515725670017343 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CurrentCallInstance \Twilio\Rest\Preview\TrustedComms\CurrentCallInstance */ public function buildInstance(array $payload): CurrentCallInstance { return new CurrentCallInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.TrustedComms.CurrentCallPage]'; } }src/Twilio/Rest/Preview/TrustedComms/CpsList.php000064400000002104150515725670015675 0ustar00solution = []; } /** * Constructs a CpsContext */ public function getContext(): CpsContext { return new CpsContext($this->version); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.TrustedComms.CpsList]'; } }src/Twilio/Rest/Preview/TrustedComms/BrandedChannelContext.php000064400000006345150515725670020524 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/BrandedChannels/' . \rawurlencode($sid) . ''; } /** * Fetch the BrandedChannelInstance * * @return BrandedChannelInstance Fetched BrandedChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): BrandedChannelInstance { $payload = $this->version->fetch('GET', $this->uri); return new BrandedChannelInstance($this->version, $payload, $this->solution['sid']); } /** * Access the channels */ protected function getChannels(): ChannelList { if (!$this->_channels) { $this->_channels = new ChannelList($this->version, $this->solution['sid']); } return $this->_channels; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.TrustedComms.BrandedChannelContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/TrustedComms/BrandedChannelInstance.php000064400000007033150515725670020637 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'businessSid' => Values::array_get($payload, 'business_sid'), 'brandSid' => Values::array_get($payload, 'brand_sid'), 'sid' => Values::array_get($payload, 'sid'), 'links' => Values::array_get($payload, 'links'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['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 BrandedChannelContext Context for this BrandedChannelInstance */ protected function proxy(): BrandedChannelContext { if (!$this->context) { $this->context = new BrandedChannelContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the BrandedChannelInstance * * @return BrandedChannelInstance Fetched BrandedChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): BrandedChannelInstance { return $this->proxy()->fetch(); } /** * Access the channels */ protected function getChannels(): ChannelList { return $this->proxy()->channels; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.TrustedComms.BrandedChannelInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/TrustedComms/CpsContext.php000064400000003411150515725670016410 0ustar00solution = []; $this->uri = '/CPS'; } /** * Fetch the CpsInstance * * @param array|Options $options Optional Arguments * @return CpsInstance Fetched CpsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): CpsInstance { $options = new Values($options); $headers = Values::of(['X-Xcnam-Sensitive-Phone-Number' => $options['xXcnamSensitivePhoneNumber'], ]); $payload = $this->version->fetch('GET', $this->uri, [], [], $headers); return new CpsInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.TrustedComms.CpsContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/TrustedComms/CurrentCallOptions.php000064400000005512150515725670020114 0ustar00options['xXcnamSensitivePhoneNumberFrom'] = $xXcnamSensitivePhoneNumberFrom; $this->options['xXcnamSensitivePhoneNumberTo'] = $xXcnamSensitivePhoneNumberTo; } /** * The originating Phone Number, given in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). This phone number should be a Twilio number, otherwise it will return an error with HTTP Status Code 400. * * @param string $xXcnamSensitivePhoneNumberFrom The originating Phone Number * @return $this Fluent Builder */ public function setXXcnamSensitivePhoneNumberFrom(string $xXcnamSensitivePhoneNumberFrom): self { $this->options['xXcnamSensitivePhoneNumberFrom'] = $xXcnamSensitivePhoneNumberFrom; return $this; } /** * The terminating Phone Number, given in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). * * @param string $xXcnamSensitivePhoneNumberTo The terminating Phone Number * @return $this Fluent Builder */ public function setXXcnamSensitivePhoneNumberTo(string $xXcnamSensitivePhoneNumberTo): self { $this->options['xXcnamSensitivePhoneNumberTo'] = $xXcnamSensitivePhoneNumberTo; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.TrustedComms.FetchCurrentCallOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/TrustedComms/CpsInstance.php000064400000005601150515725670016533 0ustar00properties = [ 'cpsUrl' => Values::array_get($payload, 'cps_url'), 'phoneNumber' => Values::array_get($payload, 'phone_number'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = []; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return CpsContext Context for this CpsInstance */ protected function proxy(): CpsContext { if (!$this->context) { $this->context = new CpsContext($this->version); } return $this->context; } /** * Fetch the CpsInstance * * @param array|Options $options Optional Arguments * @return CpsInstance Fetched CpsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): CpsInstance { return $this->proxy()->fetch($options); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.TrustedComms.CpsInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/TrustedComms/BrandsInformationOptions.php000064400000003413150515725670021313 0ustar00options['ifNoneMatch'] = $ifNoneMatch; } /** * Standard `If-None-Match` HTTP header. For more information visit: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-None-Match. * * @param string $ifNoneMatch Standard `If-None-Match` HTTP header * @return $this Fluent Builder */ public function setIfNoneMatch(string $ifNoneMatch): self { $this->options['ifNoneMatch'] = $ifNoneMatch; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Preview.TrustedComms.FetchBrandsInformationOptions ' . $options . ']'; } }src/Twilio/Rest/Preview/TrustedComms/CurrentCallInstance.php000064400000007753150515725670020236 0ustar00properties = [ 'bgColor' => Values::array_get($payload, 'bg_color'), 'caller' => Values::array_get($payload, 'caller'), 'createdAt' => Deserialize::dateTime(Values::array_get($payload, 'created_at')), 'fontColor' => Values::array_get($payload, 'font_color'), 'from' => Values::array_get($payload, 'from'), 'logo' => Values::array_get($payload, 'logo'), 'manager' => Values::array_get($payload, 'manager'), 'reason' => Values::array_get($payload, 'reason'), 'shieldImg' => Values::array_get($payload, 'shield_img'), 'sid' => Values::array_get($payload, 'sid'), 'status' => Values::array_get($payload, 'status'), 'to' => Values::array_get($payload, 'to'), 'url' => Values::array_get($payload, 'url'), 'useCase' => Values::array_get($payload, 'use_case'), ]; $this->solution = []; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return CurrentCallContext Context for this CurrentCallInstance */ protected function proxy(): CurrentCallContext { if (!$this->context) { $this->context = new CurrentCallContext($this->version); } return $this->context; } /** * Fetch the CurrentCallInstance * * @param array|Options $options Optional Arguments * @return CurrentCallInstance Fetched CurrentCallInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): CurrentCallInstance { return $this->proxy()->fetch($options); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.TrustedComms.CurrentCallInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/TrustedComms/BrandsInformationContext.php000064400000003547150515725670021314 0ustar00solution = []; $this->uri = '/BrandsInformation'; } /** * Fetch the BrandsInformationInstance * * @param array|Options $options Optional Arguments * @return BrandsInformationInstance Fetched BrandsInformationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): BrandsInformationInstance { $options = new Values($options); $headers = Values::of(['If-None-Match' => $options['ifNoneMatch'], ]); $payload = $this->version->fetch('GET', $this->uri, [], [], $headers); return new BrandsInformationInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Preview.TrustedComms.BrandsInformationContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Preview/TrustedComms/BrandsInformationList.php000064400000002230150515725670020567 0ustar00solution = []; } /** * Constructs a BrandsInformationContext */ public function getContext(): BrandsInformationContext { return new BrandsInformationContext($this->version); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.TrustedComms.BrandsInformationList]'; } }src/Twilio/Rest/Preview/TrustedComms/BrandsInformationPage.php000064400000002641150515725670020536 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return BrandsInformationInstance \Twilio\Rest\Preview\TrustedComms\BrandsInformationInstance */ public function buildInstance(array $payload): BrandsInformationInstance { return new BrandsInformationInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview.TrustedComms.BrandsInformationPage]'; } }src/Twilio/Rest/Api.php000064400000033574150515725670010772 0ustar00baseUrl = 'https://api.twilio.com'; } /** * @return V2010 Version v2010 of api */ protected function getV2010(): V2010 { 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 TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_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(): \Twilio\Rest\Api\V2010\AccountContext { return $this->v2010->account; } protected function getAccounts(): \Twilio\Rest\Api\V2010\AccountList { return $this->v2010->accounts; } /** * @param string $sid Fetch by unique Account Sid */ protected function contextAccounts(string $sid): \Twilio\Rest\Api\V2010\AccountContext { return $this->v2010->accounts($sid); } protected function getAddresses(): \Twilio\Rest\Api\V2010\Account\AddressList { return $this->v2010->account->addresses; } /** * @param string $sid The unique string that identifies the resource */ protected function contextAddresses(string $sid): \Twilio\Rest\Api\V2010\Account\AddressContext { return $this->v2010->account->addresses($sid); } protected function getApplications(): \Twilio\Rest\Api\V2010\Account\ApplicationList { return $this->v2010->account->applications; } /** * @param string $sid The unique string that identifies the resource */ protected function contextApplications(string $sid): \Twilio\Rest\Api\V2010\Account\ApplicationContext { return $this->v2010->account->applications($sid); } protected function getAuthorizedConnectApps(): \Twilio\Rest\Api\V2010\Account\AuthorizedConnectAppList { return $this->v2010->account->authorizedConnectApps; } /** * @param string $connectAppSid The SID of the Connect App to fetch */ protected function contextAuthorizedConnectApps(string $connectAppSid): \Twilio\Rest\Api\V2010\Account\AuthorizedConnectAppContext { return $this->v2010->account->authorizedConnectApps($connectAppSid); } protected function getAvailablePhoneNumbers(): \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountryList { return $this->v2010->account->availablePhoneNumbers; } /** * @param string $countryCode The ISO country code of the country to fetch * available phone number information about */ protected function contextAvailablePhoneNumbers(string $countryCode): \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountryContext { return $this->v2010->account->availablePhoneNumbers($countryCode); } protected function getBalance(): \Twilio\Rest\Api\V2010\Account\BalanceList { return $this->v2010->account->balance; } protected function getCalls(): \Twilio\Rest\Api\V2010\Account\CallList { return $this->v2010->account->calls; } /** * @param string $sid The SID of the Call resource to fetch */ protected function contextCalls(string $sid): \Twilio\Rest\Api\V2010\Account\CallContext { return $this->v2010->account->calls($sid); } protected function getConferences(): \Twilio\Rest\Api\V2010\Account\ConferenceList { return $this->v2010->account->conferences; } /** * @param string $sid The unique string that identifies this resource */ protected function contextConferences(string $sid): \Twilio\Rest\Api\V2010\Account\ConferenceContext { return $this->v2010->account->conferences($sid); } protected function getConnectApps(): \Twilio\Rest\Api\V2010\Account\ConnectAppList { return $this->v2010->account->connectApps; } /** * @param string $sid The unique string that identifies the resource */ protected function contextConnectApps(string $sid): \Twilio\Rest\Api\V2010\Account\ConnectAppContext { return $this->v2010->account->connectApps($sid); } protected function getIncomingPhoneNumbers(): \Twilio\Rest\Api\V2010\Account\IncomingPhoneNumberList { return $this->v2010->account->incomingPhoneNumbers; } /** * @param string $sid The unique string that identifies the resource */ protected function contextIncomingPhoneNumbers(string $sid): \Twilio\Rest\Api\V2010\Account\IncomingPhoneNumberContext { return $this->v2010->account->incomingPhoneNumbers($sid); } protected function getKeys(): \Twilio\Rest\Api\V2010\Account\KeyList { return $this->v2010->account->keys; } /** * @param string $sid The unique string that identifies the resource */ protected function contextKeys(string $sid): \Twilio\Rest\Api\V2010\Account\KeyContext { return $this->v2010->account->keys($sid); } protected function getMessages(): \Twilio\Rest\Api\V2010\Account\MessageList { return $this->v2010->account->messages; } /** * @param string $sid The unique string that identifies the resource */ protected function contextMessages(string $sid): \Twilio\Rest\Api\V2010\Account\MessageContext { return $this->v2010->account->messages($sid); } protected function getNewKeys(): \Twilio\Rest\Api\V2010\Account\NewKeyList { return $this->v2010->account->newKeys; } protected function getNewSigningKeys(): \Twilio\Rest\Api\V2010\Account\NewSigningKeyList { return $this->v2010->account->newSigningKeys; } protected function getNotifications(): \Twilio\Rest\Api\V2010\Account\NotificationList { return $this->v2010->account->notifications; } /** * @param string $sid The unique string that identifies the resource */ protected function contextNotifications(string $sid): \Twilio\Rest\Api\V2010\Account\NotificationContext { return $this->v2010->account->notifications($sid); } protected function getOutgoingCallerIds(): \Twilio\Rest\Api\V2010\Account\OutgoingCallerIdList { return $this->v2010->account->outgoingCallerIds; } /** * @param string $sid The unique string that identifies the resource */ protected function contextOutgoingCallerIds(string $sid): \Twilio\Rest\Api\V2010\Account\OutgoingCallerIdContext { return $this->v2010->account->outgoingCallerIds($sid); } protected function getQueues(): \Twilio\Rest\Api\V2010\Account\QueueList { return $this->v2010->account->queues; } /** * @param string $sid The unique string that identifies this resource */ protected function contextQueues(string $sid): \Twilio\Rest\Api\V2010\Account\QueueContext { return $this->v2010->account->queues($sid); } protected function getRecordings(): \Twilio\Rest\Api\V2010\Account\RecordingList { return $this->v2010->account->recordings; } /** * @param string $sid The unique string that identifies the resource */ protected function contextRecordings(string $sid): \Twilio\Rest\Api\V2010\Account\RecordingContext { return $this->v2010->account->recordings($sid); } protected function getSigningKeys(): \Twilio\Rest\Api\V2010\Account\SigningKeyList { return $this->v2010->account->signingKeys; } /** * @param string $sid The sid */ protected function contextSigningKeys(string $sid): \Twilio\Rest\Api\V2010\Account\SigningKeyContext { return $this->v2010->account->signingKeys($sid); } protected function getSip(): \Twilio\Rest\Api\V2010\Account\SipList { return $this->v2010->account->sip; } protected function getShortCodes(): \Twilio\Rest\Api\V2010\Account\ShortCodeList { return $this->v2010->account->shortCodes; } /** * @param string $sid The unique string that identifies this resource */ protected function contextShortCodes(string $sid): \Twilio\Rest\Api\V2010\Account\ShortCodeContext { return $this->v2010->account->shortCodes($sid); } protected function getTokens(): \Twilio\Rest\Api\V2010\Account\TokenList { return $this->v2010->account->tokens; } protected function getTranscriptions(): \Twilio\Rest\Api\V2010\Account\TranscriptionList { return $this->v2010->account->transcriptions; } /** * @param string $sid The unique string that identifies the resource */ protected function contextTranscriptions(string $sid): \Twilio\Rest\Api\V2010\Account\TranscriptionContext { return $this->v2010->account->transcriptions($sid); } protected function getUsage(): \Twilio\Rest\Api\V2010\Account\UsageList { return $this->v2010->account->usage; } protected function getValidationRequests(): \Twilio\Rest\Api\V2010\Account\ValidationRequestList { return $this->v2010->account->validationRequests; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Api]'; } }src/Twilio/Rest/Chat.php000064400000006331150515725670011127 0ustar00baseUrl = 'https://chat.twilio.com'; } /** * @return V1 Version v1 of chat */ protected function getV1(): V1 { if (!$this->_v1) { $this->_v1 = new V1($this); } return $this->_v1; } /** * @return V2 Version v2 of chat */ protected function getV2(): V2 { if (!$this->_v2) { $this->_v2 = new V2($this); } return $this->_v2; } /** * Magic getter to lazy load version * * @param string $name Version to return * @return \Twilio\Version The requested version * @throws TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } protected function getCredentials(): \Twilio\Rest\Chat\V2\CredentialList { return $this->v2->credentials; } /** * @param string $sid The SID of the Credential resource to fetch */ protected function contextCredentials(string $sid): \Twilio\Rest\Chat\V2\CredentialContext { return $this->v2->credentials($sid); } protected function getServices(): \Twilio\Rest\Chat\V2\ServiceList { return $this->v2->services; } /** * @param string $sid The SID of the Service resource to fetch */ protected function contextServices(string $sid): \Twilio\Rest\Chat\V2\ServiceContext { return $this->v2->services($sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat]'; } }src/Twilio/Rest/Pricing/V1/Messaging/CountryContext.php000064400000002773150515725670017064 0ustar00solution = ['isoCountry' => $isoCountry, ]; $this->uri = '/Messaging/Countries/' . \rawurlencode($isoCountry) . ''; } /** * Fetch the CountryInstance * * @return CountryInstance Fetched CountryInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CountryInstance { $payload = $this->version->fetch('GET', $this->uri); return new CountryInstance($this->version, $payload, $this->solution['isoCountry']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Pricing.V1.CountryContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Pricing/V1/Messaging/CountryList.php000064400000011016150515725670016341 0ustar00solution = []; $this->uri = '/Messaging/Countries'; } /** * Streams CountryInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads CountryInstance 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 CountryInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of CountryInstance 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 CountryPage Page of CountryInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): CountryPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new CountryPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of CountryInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return CountryPage Page of CountryInstance */ public function getPage(string $targetUrl): CountryPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new CountryPage($this->version, $response, $this->solution); } /** * Constructs a CountryContext * * @param string $isoCountry The ISO country code */ public function getContext(string $isoCountry): CountryContext { return new CountryContext($this->version, $isoCountry); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Pricing.V1.CountryList]'; } }src/Twilio/Rest/Pricing/V1/Messaging/CountryPage.php000064400000002220150515725670016277 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CountryInstance \Twilio\Rest\Pricing\V1\Messaging\CountryInstance */ public function buildInstance(array $payload): CountryInstance { return new CountryInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Pricing.V1.CountryPage]'; } }src/Twilio/Rest/Pricing/V1/Messaging/CountryInstance.php000064400000006207150515725670017200 0ustar00properties = [ 'country' => Values::array_get($payload, 'country'), 'isoCountry' => Values::array_get($payload, 'iso_country'), 'outboundSmsPrices' => Values::array_get($payload, 'outbound_sms_prices'), 'inboundSmsPrices' => Values::array_get($payload, 'inbound_sms_prices'), 'priceUnit' => Values::array_get($payload, 'price_unit'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['isoCountry' => $isoCountry ?: $this->properties['isoCountry'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return CountryContext Context for this CountryInstance */ protected function proxy(): CountryContext { if (!$this->context) { $this->context = new CountryContext($this->version, $this->solution['isoCountry']); } return $this->context; } /** * Fetch the CountryInstance * * @return CountryInstance Fetched CountryInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CountryInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Pricing.V1.CountryInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Pricing/V1/Voice/NumberList.php000064400000001722150515725670015261 0ustar00solution = []; } /** * Constructs a NumberContext * * @param string $number The phone number to fetch */ public function getContext(string $number): NumberContext { return new NumberContext($this->version, $number); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Pricing.V1.NumberList]'; } }src/Twilio/Rest/Pricing/V1/Voice/CountryContext.php000064400000002763150515725670016213 0ustar00solution = ['isoCountry' => $isoCountry, ]; $this->uri = '/Voice/Countries/' . \rawurlencode($isoCountry) . ''; } /** * Fetch the CountryInstance * * @return CountryInstance Fetched CountryInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CountryInstance { $payload = $this->version->fetch('GET', $this->uri); return new CountryInstance($this->version, $payload, $this->solution['isoCountry']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Pricing.V1.CountryContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Pricing/V1/Voice/CountryList.php000064400000011006150515725670015470 0ustar00solution = []; $this->uri = '/Voice/Countries'; } /** * Streams CountryInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads CountryInstance 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 CountryInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of CountryInstance 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 CountryPage Page of CountryInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): CountryPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new CountryPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of CountryInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return CountryPage Page of CountryInstance */ public function getPage(string $targetUrl): CountryPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new CountryPage($this->version, $response, $this->solution); } /** * Constructs a CountryContext * * @param string $isoCountry The ISO country code */ public function getContext(string $isoCountry): CountryContext { return new CountryContext($this->version, $isoCountry); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Pricing.V1.CountryList]'; } }src/Twilio/Rest/Pricing/V1/Voice/NumberContext.php000064400000002726150515725670015777 0ustar00solution = ['number' => $number, ]; $this->uri = '/Voice/Numbers/' . \rawurlencode($number) . ''; } /** * Fetch the NumberInstance * * @return NumberInstance Fetched NumberInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): NumberInstance { $payload = $this->version->fetch('GET', $this->uri); return new NumberInstance($this->version, $payload, $this->solution['number']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Pricing.V1.NumberContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Pricing/V1/Voice/CountryPage.php000064400000002210150515725670015426 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CountryInstance \Twilio\Rest\Pricing\V1\Voice\CountryInstance */ public function buildInstance(array $payload): CountryInstance { return new CountryInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Pricing.V1.CountryPage]'; } }src/Twilio/Rest/Pricing/V1/Voice/NumberInstance.php000064400000006274150515725670016121 0ustar00properties = [ 'number' => Values::array_get($payload, 'number'), 'country' => Values::array_get($payload, 'country'), 'isoCountry' => Values::array_get($payload, 'iso_country'), 'outboundCallPrice' => Values::array_get($payload, 'outbound_call_price'), 'inboundCallPrice' => Values::array_get($payload, 'inbound_call_price'), 'priceUnit' => Values::array_get($payload, 'price_unit'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['number' => $number ?: $this->properties['number'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return NumberContext Context for this NumberInstance */ protected function proxy(): NumberContext { if (!$this->context) { $this->context = new NumberContext($this->version, $this->solution['number']); } return $this->context; } /** * Fetch the NumberInstance * * @return NumberInstance Fetched NumberInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): NumberInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Pricing.V1.NumberInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Pricing/V1/Voice/CountryInstance.php000064400000006217150515725670016331 0ustar00properties = [ 'country' => Values::array_get($payload, 'country'), 'isoCountry' => Values::array_get($payload, 'iso_country'), 'outboundPrefixPrices' => Values::array_get($payload, 'outbound_prefix_prices'), 'inboundCallPrices' => Values::array_get($payload, 'inbound_call_prices'), 'priceUnit' => Values::array_get($payload, 'price_unit'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['isoCountry' => $isoCountry ?: $this->properties['isoCountry'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return CountryContext Context for this CountryInstance */ protected function proxy(): CountryContext { if (!$this->context) { $this->context = new CountryContext($this->version, $this->solution['isoCountry']); } return $this->context; } /** * Fetch the CountryInstance * * @return CountryInstance Fetched CountryInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CountryInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Pricing.V1.CountryInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Pricing/V1/Voice/NumberPage.php000064400000002202150515725670015214 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return NumberInstance \Twilio\Rest\Pricing\V1\Voice\NumberInstance */ public function buildInstance(array $payload): NumberInstance { return new NumberInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Pricing.V1.NumberPage]'; } }src/Twilio/Rest/Pricing/V1/VoiceList.php000064400000005355150515725670014037 0ustar00solution = []; } /** * Access the numbers */ protected function getNumbers(): NumberList { if (!$this->_numbers) { $this->_numbers = new NumberList($this->version); } return $this->_numbers; } /** * Access the countries */ protected function getCountries(): CountryList { if (!$this->_countries) { $this->_countries = new CountryList($this->version); } return $this->_countries; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return \Twilio\ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Pricing.V1.VoiceList]'; } }src/Twilio/Rest/Pricing/V1/VoicePage.php000064400000002160150515725670013767 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return VoiceInstance \Twilio\Rest\Pricing\V1\VoiceInstance */ public function buildInstance(array $payload): VoiceInstance { return new VoiceInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Pricing.V1.VoicePage]'; } }src/Twilio/Rest/Pricing/V1/PhoneNumber/CountryContext.php000064400000003000150515725670017351 0ustar00solution = ['isoCountry' => $isoCountry, ]; $this->uri = '/PhoneNumbers/Countries/' . \rawurlencode($isoCountry) . ''; } /** * Fetch the CountryInstance * * @return CountryInstance Fetched CountryInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CountryInstance { $payload = $this->version->fetch('GET', $this->uri); return new CountryInstance($this->version, $payload, $this->solution['isoCountry']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Pricing.V1.CountryContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Pricing/V1/PhoneNumber/CountryList.php000064400000011023150515725670016644 0ustar00solution = []; $this->uri = '/PhoneNumbers/Countries'; } /** * Streams CountryInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads CountryInstance 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 CountryInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of CountryInstance 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 CountryPage Page of CountryInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): CountryPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new CountryPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of CountryInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return CountryPage Page of CountryInstance */ public function getPage(string $targetUrl): CountryPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new CountryPage($this->version, $response, $this->solution); } /** * Constructs a CountryContext * * @param string $isoCountry The ISO country code */ public function getContext(string $isoCountry): CountryContext { return new CountryContext($this->version, $isoCountry); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Pricing.V1.CountryList]'; } }src/Twilio/Rest/Pricing/V1/PhoneNumber/CountryPage.php000064400000002224150515725670016610 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CountryInstance \Twilio\Rest\Pricing\V1\PhoneNumber\CountryInstance */ public function buildInstance(array $payload): CountryInstance { return new CountryInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Pricing.V1.CountryPage]'; } }src/Twilio/Rest/Pricing/V1/PhoneNumber/CountryInstance.php000064400000006014150515725670017501 0ustar00properties = [ 'country' => Values::array_get($payload, 'country'), 'isoCountry' => Values::array_get($payload, 'iso_country'), 'phoneNumberPrices' => Values::array_get($payload, 'phone_number_prices'), 'priceUnit' => Values::array_get($payload, 'price_unit'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['isoCountry' => $isoCountry ?: $this->properties['isoCountry'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return CountryContext Context for this CountryInstance */ protected function proxy(): CountryContext { if (!$this->context) { $this->context = new CountryContext($this->version, $this->solution['isoCountry']); } return $this->context; } /** * Fetch the CountryInstance * * @return CountryInstance Fetched CountryInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CountryInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Pricing.V1.CountryInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Pricing/V1/MessagingList.php000064400000004530150515725670014701 0ustar00solution = []; } /** * Access the countries */ protected function getCountries(): CountryList { if (!$this->_countries) { $this->_countries = new CountryList($this->version); } return $this->_countries; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return \Twilio\ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Pricing.V1.MessagingList]'; } }src/Twilio/Rest/Pricing/V1/PhoneNumberPage.php000064400000002224150515725670015145 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return PhoneNumberInstance \Twilio\Rest\Pricing\V1\PhoneNumberInstance */ public function buildInstance(array $payload): PhoneNumberInstance { return new PhoneNumberInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Pricing.V1.PhoneNumberPage]'; } }src/Twilio/Rest/Pricing/V1/MessagingInstance.php000064400000003365150515725670015537 0ustar00properties = [ 'name' => Values::array_get($payload, 'name'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = []; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Pricing.V1.MessagingInstance]'; } }src/Twilio/Rest/Pricing/V1/VoiceInstance.php000064400000003351150515725670014662 0ustar00properties = [ 'name' => Values::array_get($payload, 'name'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = []; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Pricing.V1.VoiceInstance]'; } }src/Twilio/Rest/Pricing/V1/PhoneNumberInstance.php000064400000003373150515725670016043 0ustar00properties = [ 'name' => Values::array_get($payload, 'name'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = []; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Pricing.V1.PhoneNumberInstance]'; } }src/Twilio/Rest/Pricing/V1/MessagingPage.php000064400000002210150515725670014633 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return MessagingInstance \Twilio\Rest\Pricing\V1\MessagingInstance */ public function buildInstance(array $payload): MessagingInstance { return new MessagingInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Pricing.V1.MessagingPage]'; } }src/Twilio/Rest/Pricing/V1/PhoneNumberList.php000064400000004542150515725670015211 0ustar00solution = []; } /** * Access the countries */ protected function getCountries(): CountryList { if (!$this->_countries) { $this->_countries = new CountryList($this->version); } return $this->_countries; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return \Twilio\ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Pricing.V1.PhoneNumberList]'; } }src/Twilio/Rest/Pricing/V1.php000064400000005277150515725670012141 0ustar00version = 'v1'; } protected function getMessaging(): MessagingList { if (!$this->_messaging) { $this->_messaging = new MessagingList($this); } return $this->_messaging; } protected function getPhoneNumbers(): PhoneNumberList { if (!$this->_phoneNumbers) { $this->_phoneNumbers = new PhoneNumberList($this); } return $this->_phoneNumbers; } protected function getVoice(): VoiceList { if (!$this->_voice) { $this->_voice = new VoiceList($this); } return $this->_voice; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Pricing.V1]'; } }src/Twilio/Rest/Pricing/V2.php000064400000005451150515725670012134 0ustar00version = 'v2'; } protected function getCountries(): CountryList { if (!$this->_countries) { $this->_countries = new CountryList($this); } return $this->_countries; } protected function getNumbers(): NumberList { if (!$this->_numbers) { $this->_numbers = new NumberList($this); } return $this->_numbers; } protected function getVoice(): VoiceList { if (!$this->_voice) { $this->_voice = new VoiceList($this); } return $this->_voice; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Pricing.V2]'; } }src/Twilio/Rest/Pricing/V2/Voice/NumberList.php000064400000002077150515725670015266 0ustar00solution = []; } /** * Constructs a NumberContext * * @param string $destinationNumber The destination number for which to fetch * pricing information */ public function getContext(string $destinationNumber): NumberContext { return new NumberContext($this->version, $destinationNumber); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Pricing.V2.NumberList]'; } }src/Twilio/Rest/Pricing/V2/Voice/CountryContext.php000064400000003070150515725670016204 0ustar00solution = ['isoCountry' => $isoCountry, ]; $this->uri = '/Voice/Countries/' . \rawurlencode($isoCountry) . ''; } /** * Fetch the CountryInstance * * @return CountryInstance Fetched CountryInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CountryInstance { $payload = $this->version->fetch('GET', $this->uri); return new CountryInstance($this->version, $payload, $this->solution['isoCountry']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Pricing.V2.CountryContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Pricing/V2/Voice/CountryList.php000064400000011113150515725670015470 0ustar00solution = []; $this->uri = '/Voice/Countries'; } /** * Streams CountryInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads CountryInstance 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 CountryInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of CountryInstance 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 CountryPage Page of CountryInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): CountryPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new CountryPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of CountryInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return CountryPage Page of CountryInstance */ public function getPage(string $targetUrl): CountryPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new CountryPage($this->version, $response, $this->solution); } /** * Constructs a CountryContext * * @param string $isoCountry The ISO country code of the pricing information to * fetch */ public function getContext(string $isoCountry): CountryContext { return new CountryContext($this->version, $isoCountry); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Pricing.V2.CountryList]'; } }src/Twilio/Rest/Pricing/V2/Voice/NumberContext.php000064400000003517150515725670015777 0ustar00solution = ['destinationNumber' => $destinationNumber, ]; $this->uri = '/Voice/Numbers/' . \rawurlencode($destinationNumber) . ''; } /** * Fetch the NumberInstance * * @param array|Options $options Optional Arguments * @return NumberInstance Fetched NumberInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): NumberInstance { $options = new Values($options); $params = Values::of(['OriginationNumber' => $options['originationNumber'], ]); $payload = $this->version->fetch('GET', $this->uri, $params); return new NumberInstance($this->version, $payload, $this->solution['destinationNumber']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Pricing.V2.NumberContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Pricing/V2/Voice/CountryPage.php000064400000002210150515725670015427 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CountryInstance \Twilio\Rest\Pricing\V2\Voice\CountryInstance */ public function buildInstance(array $payload): CountryInstance { return new CountryInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Pricing.V2.CountryPage]'; } }src/Twilio/Rest/Pricing/V2/Voice/NumberOptions.php000064400000003541150515725670016003 0ustar00options['originationNumber'] = $originationNumber; } /** * The origination phone number, in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, for which to fetch the origin-based voice pricing information. E.164 format consists of a + followed by the country code and subscriber number. * * @param string $originationNumber The origination number for which to fetch * pricing information * @return $this Fluent Builder */ public function setOriginationNumber(string $originationNumber): self { $this->options['originationNumber'] = $originationNumber; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Pricing.V2.FetchNumberOptions ' . $options . ']'; } }src/Twilio/Rest/Pricing/V2/Voice/NumberInstance.php000064400000007152150515725670016116 0ustar00properties = [ 'destinationNumber' => Values::array_get($payload, 'destination_number'), 'originationNumber' => Values::array_get($payload, 'origination_number'), 'country' => Values::array_get($payload, 'country'), 'isoCountry' => Values::array_get($payload, 'iso_country'), 'outboundCallPrices' => Values::array_get($payload, 'outbound_call_prices'), 'inboundCallPrice' => Values::array_get($payload, 'inbound_call_price'), 'priceUnit' => Values::array_get($payload, 'price_unit'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'destinationNumber' => $destinationNumber ?: $this->properties['destinationNumber'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return NumberContext Context for this NumberInstance */ protected function proxy(): NumberContext { if (!$this->context) { $this->context = new NumberContext($this->version, $this->solution['destinationNumber']); } return $this->context; } /** * Fetch the NumberInstance * * @param array|Options $options Optional Arguments * @return NumberInstance Fetched NumberInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): NumberInstance { return $this->proxy()->fetch($options); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Pricing.V2.NumberInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Pricing/V2/Voice/CountryInstance.php000064400000006324150515725670016331 0ustar00properties = [ 'country' => Values::array_get($payload, 'country'), 'isoCountry' => Values::array_get($payload, 'iso_country'), 'outboundPrefixPrices' => Values::array_get($payload, 'outbound_prefix_prices'), 'inboundCallPrices' => Values::array_get($payload, 'inbound_call_prices'), 'priceUnit' => Values::array_get($payload, 'price_unit'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['isoCountry' => $isoCountry ?: $this->properties['isoCountry'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return CountryContext Context for this CountryInstance */ protected function proxy(): CountryContext { if (!$this->context) { $this->context = new CountryContext($this->version, $this->solution['isoCountry']); } return $this->context; } /** * Fetch the CountryInstance * * @return CountryInstance Fetched CountryInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CountryInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Pricing.V2.CountryInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Pricing/V2/Voice/NumberPage.php000064400000002202150515725670015215 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return NumberInstance \Twilio\Rest\Pricing\V2\Voice\NumberInstance */ public function buildInstance(array $payload): NumberInstance { return new NumberInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Pricing.V2.NumberPage]'; } }src/Twilio/Rest/Pricing/V2/VoiceList.php000064400000005370150515725670014035 0ustar00solution = []; } /** * Access the countries */ protected function getCountries(): CountryList { if (!$this->_countries) { $this->_countries = new CountryList($this->version); } return $this->_countries; } /** * Access the numbers */ protected function getNumbers(): NumberList { if (!$this->_numbers) { $this->_numbers = new NumberList($this->version); } return $this->_numbers; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return \Twilio\ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Pricing.V2.VoiceList]'; } }src/Twilio/Rest/Pricing/V2/NumberList.php000064400000002071150515725670014213 0ustar00solution = []; } /** * Constructs a NumberContext * * @param string $destinationNumber The destination number for which to fetch * pricing information */ public function getContext(string $destinationNumber): NumberContext { return new NumberContext($this->version, $destinationNumber); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Pricing.V2.NumberList]'; } }src/Twilio/Rest/Pricing/V2/CountryContext.php000064400000003065150515725670015143 0ustar00solution = ['isoCountry' => $isoCountry, ]; $this->uri = '/Trunking/Countries/' . \rawurlencode($isoCountry) . ''; } /** * Fetch the CountryInstance * * @return CountryInstance Fetched CountryInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CountryInstance { $payload = $this->version->fetch('GET', $this->uri); return new CountryInstance($this->version, $payload, $this->solution['isoCountry']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Pricing.V2.CountryContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Pricing/V2/VoicePage.php000064400000002160150515725670013770 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return VoiceInstance \Twilio\Rest\Pricing\V2\VoiceInstance */ public function buildInstance(array $payload): VoiceInstance { return new VoiceInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Pricing.V2.VoicePage]'; } }src/Twilio/Rest/Pricing/V2/CountryList.php000064400000011110150515725670014420 0ustar00solution = []; $this->uri = '/Trunking/Countries'; } /** * Streams CountryInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads CountryInstance 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 CountryInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of CountryInstance 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 CountryPage Page of CountryInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): CountryPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new CountryPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of CountryInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return CountryPage Page of CountryInstance */ public function getPage(string $targetUrl): CountryPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new CountryPage($this->version, $response, $this->solution); } /** * Constructs a CountryContext * * @param string $isoCountry The ISO country code of the pricing information to * fetch */ public function getContext(string $isoCountry): CountryContext { return new CountryContext($this->version, $isoCountry); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Pricing.V2.CountryList]'; } }src/Twilio/Rest/Pricing/V2/NumberContext.php000064400000003514150515725670014727 0ustar00solution = ['destinationNumber' => $destinationNumber, ]; $this->uri = '/Trunking/Numbers/' . \rawurlencode($destinationNumber) . ''; } /** * Fetch the NumberInstance * * @param array|Options $options Optional Arguments * @return NumberInstance Fetched NumberInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): NumberInstance { $options = new Values($options); $params = Values::of(['OriginationNumber' => $options['originationNumber'], ]); $payload = $this->version->fetch('GET', $this->uri, $params); return new NumberInstance($this->version, $payload, $this->solution['destinationNumber']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Pricing.V2.NumberContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Pricing/V2/CountryPage.php000064400000002174150515725670014373 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CountryInstance \Twilio\Rest\Pricing\V2\CountryInstance */ public function buildInstance(array $payload): CountryInstance { return new CountryInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Pricing.V2.CountryPage]'; } }src/Twilio/Rest/Pricing/V2/NumberOptions.php000064400000003533150515725670014737 0ustar00options['originationNumber'] = $originationNumber; } /** * The origination phone number, in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, for which to fetch the origin-based voice pricing information. E.164 format consists of a + followed by the country code and subscriber number. * * @param string $originationNumber The origination number for which to fetch * pricing information * @return $this Fluent Builder */ public function setOriginationNumber(string $originationNumber): self { $this->options['originationNumber'] = $originationNumber; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Pricing.V2.FetchNumberOptions ' . $options . ']'; } }src/Twilio/Rest/Pricing/V2/NumberInstance.php000064400000007177150515725670015060 0ustar00properties = [ 'destinationNumber' => Values::array_get($payload, 'destination_number'), 'originationNumber' => Values::array_get($payload, 'origination_number'), 'country' => Values::array_get($payload, 'country'), 'isoCountry' => Values::array_get($payload, 'iso_country'), 'terminatingPrefixPrices' => Values::array_get($payload, 'terminating_prefix_prices'), 'originatingCallPrice' => Values::array_get($payload, 'originating_call_price'), 'priceUnit' => Values::array_get($payload, 'price_unit'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'destinationNumber' => $destinationNumber ?: $this->properties['destinationNumber'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return NumberContext Context for this NumberInstance */ protected function proxy(): NumberContext { if (!$this->context) { $this->context = new NumberContext($this->version, $this->solution['destinationNumber']); } return $this->context; } /** * Fetch the NumberInstance * * @param array|Options $options Optional Arguments * @return NumberInstance Fetched NumberInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): NumberInstance { return $this->proxy()->fetch($options); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Pricing.V2.NumberInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Pricing/V2/VoiceInstance.php000064400000003351150515725670014663 0ustar00properties = [ 'name' => Values::array_get($payload, 'name'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = []; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Pricing.V2.VoiceInstance]'; } }src/Twilio/Rest/Pricing/V2/CountryInstance.php000064400000006343150515725670015265 0ustar00properties = [ 'country' => Values::array_get($payload, 'country'), 'isoCountry' => Values::array_get($payload, 'iso_country'), 'terminatingPrefixPrices' => Values::array_get($payload, 'terminating_prefix_prices'), 'originatingCallPrices' => Values::array_get($payload, 'originating_call_prices'), 'priceUnit' => Values::array_get($payload, 'price_unit'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['isoCountry' => $isoCountry ?: $this->properties['isoCountry'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return CountryContext Context for this CountryInstance */ protected function proxy(): CountryContext { if (!$this->context) { $this->context = new CountryContext($this->version, $this->solution['isoCountry']); } return $this->context; } /** * Fetch the CountryInstance * * @return CountryInstance Fetched CountryInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CountryInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Pricing.V2.CountryInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Pricing/V2/NumberPage.php000064400000002166150515725670014161 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return NumberInstance \Twilio\Rest\Pricing\V2\NumberInstance */ public function buildInstance(array $payload): NumberInstance { return new NumberInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Pricing.V2.NumberPage]'; } }src/Twilio/Rest/Conversations.php000064400000012545150515725670013111 0ustar00baseUrl = 'https://conversations.twilio.com'; } /** * @return V1 Version v1 of conversations */ protected function getV1(): V1 { 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 TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } protected function getConfiguration(): \Twilio\Rest\Conversations\V1\ConfigurationList { return $this->v1->configuration; } protected function contextConfiguration(): \Twilio\Rest\Conversations\V1\ConfigurationContext { return $this->v1->configuration(); } protected function getConversations(): \Twilio\Rest\Conversations\V1\ConversationList { return $this->v1->conversations; } /** * @param string $sid A 34 character string that uniquely identifies this * resource. */ protected function contextConversations(string $sid): \Twilio\Rest\Conversations\V1\ConversationContext { return $this->v1->conversations($sid); } protected function getCredentials(): \Twilio\Rest\Conversations\V1\CredentialList { return $this->v1->credentials; } /** * @param string $sid A 34 character string that uniquely identifies this * resource. */ protected function contextCredentials(string $sid): \Twilio\Rest\Conversations\V1\CredentialContext { return $this->v1->credentials($sid); } protected function getParticipantConversations(): \Twilio\Rest\Conversations\V1\ParticipantConversationList { return $this->v1->participantConversations; } protected function getRoles(): \Twilio\Rest\Conversations\V1\RoleList { return $this->v1->roles; } /** * @param string $sid The SID of the Role resource to fetch */ protected function contextRoles(string $sid): \Twilio\Rest\Conversations\V1\RoleContext { return $this->v1->roles($sid); } protected function getServices(): \Twilio\Rest\Conversations\V1\ServiceList { return $this->v1->services; } /** * @param string $sid A 34 character string that uniquely identifies this * resource. */ protected function contextServices(string $sid): \Twilio\Rest\Conversations\V1\ServiceContext { return $this->v1->services($sid); } protected function getUsers(): \Twilio\Rest\Conversations\V1\UserList { return $this->v1->users; } /** * @param string $sid The SID of the User resource to fetch */ protected function contextUsers(string $sid): \Twilio\Rest\Conversations\V1\UserContext { return $this->v1->users($sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations]'; } }src/Twilio/Rest/Preview.php000064400000033426150515725670011676 0ustar00baseUrl = 'https://preview.twilio.com'; } /** * @return PreviewBulkExports Version bulkExports of preview */ protected function getBulkExports(): PreviewBulkExports { if (!$this->_bulkExports) { $this->_bulkExports = new PreviewBulkExports($this); } return $this->_bulkExports; } /** * @return PreviewDeployedDevices Version deployedDevices of preview */ protected function getDeployedDevices(): PreviewDeployedDevices { if (!$this->_deployedDevices) { $this->_deployedDevices = new PreviewDeployedDevices($this); } return $this->_deployedDevices; } /** * @return PreviewHostedNumbers Version hostedNumbers of preview */ protected function getHostedNumbers(): PreviewHostedNumbers { if (!$this->_hostedNumbers) { $this->_hostedNumbers = new PreviewHostedNumbers($this); } return $this->_hostedNumbers; } /** * @return PreviewMarketplace Version marketplace of preview */ protected function getMarketplace(): PreviewMarketplace { if (!$this->_marketplace) { $this->_marketplace = new PreviewMarketplace($this); } return $this->_marketplace; } /** * @return PreviewSync Version sync of preview */ protected function getSync(): PreviewSync { if (!$this->_sync) { $this->_sync = new PreviewSync($this); } return $this->_sync; } /** * @return PreviewUnderstand Version understand of preview */ protected function getUnderstand(): PreviewUnderstand { if (!$this->_understand) { $this->_understand = new PreviewUnderstand($this); } return $this->_understand; } /** * @return PreviewWireless Version wireless of preview */ protected function getWireless(): PreviewWireless { if (!$this->_wireless) { $this->_wireless = new PreviewWireless($this); } return $this->_wireless; } /** * @return PreviewTrustedComms Version trustedComms of preview */ protected function getTrustedComms(): PreviewTrustedComms { if (!$this->_trustedComms) { $this->_trustedComms = new PreviewTrustedComms($this); } return $this->_trustedComms; } /** * Magic getter to lazy load version * * @param string $name Version to return * @return \Twilio\Version The requested version * @throws TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } protected function getExports(): \Twilio\Rest\Preview\BulkExports\ExportList { return $this->bulkExports->exports; } /** * @param string $resourceType The type of communication – Messages, Calls, * Conferences, and Participants */ protected function contextExports(string $resourceType): \Twilio\Rest\Preview\BulkExports\ExportContext { return $this->bulkExports->exports($resourceType); } protected function getExportConfiguration(): \Twilio\Rest\Preview\BulkExports\ExportConfigurationList { return $this->bulkExports->exportConfiguration; } /** * @param string $resourceType The type of communication – Messages, Calls, * Conferences, and Participants */ protected function contextExportConfiguration(string $resourceType): \Twilio\Rest\Preview\BulkExports\ExportConfigurationContext { return $this->bulkExports->exportConfiguration($resourceType); } protected function getFleets(): \Twilio\Rest\Preview\DeployedDevices\FleetList { return $this->deployedDevices->fleets; } /** * @param string $sid A string that uniquely identifies the Fleet. */ protected function contextFleets(string $sid): \Twilio\Rest\Preview\DeployedDevices\FleetContext { return $this->deployedDevices->fleets($sid); } protected function getAuthorizationDocuments(): \Twilio\Rest\Preview\HostedNumbers\AuthorizationDocumentList { return $this->hostedNumbers->authorizationDocuments; } /** * @param string $sid AuthorizationDocument sid. */ protected function contextAuthorizationDocuments(string $sid): \Twilio\Rest\Preview\HostedNumbers\AuthorizationDocumentContext { return $this->hostedNumbers->authorizationDocuments($sid); } protected function getHostedNumberOrders(): \Twilio\Rest\Preview\HostedNumbers\HostedNumberOrderList { return $this->hostedNumbers->hostedNumberOrders; } /** * @param string $sid HostedNumberOrder sid. */ protected function contextHostedNumberOrders(string $sid): \Twilio\Rest\Preview\HostedNumbers\HostedNumberOrderContext { return $this->hostedNumbers->hostedNumberOrders($sid); } protected function getAvailableAddOns(): \Twilio\Rest\Preview\Marketplace\AvailableAddOnList { return $this->marketplace->availableAddOns; } /** * @param string $sid The SID of the AvailableAddOn resource to fetch */ protected function contextAvailableAddOns(string $sid): \Twilio\Rest\Preview\Marketplace\AvailableAddOnContext { return $this->marketplace->availableAddOns($sid); } protected function getInstalledAddOns(): \Twilio\Rest\Preview\Marketplace\InstalledAddOnList { return $this->marketplace->installedAddOns; } /** * @param string $sid The SID of the InstalledAddOn resource to fetch */ protected function contextInstalledAddOns(string $sid): \Twilio\Rest\Preview\Marketplace\InstalledAddOnContext { return $this->marketplace->installedAddOns($sid); } protected function getServices(): \Twilio\Rest\Preview\Sync\ServiceList { return $this->sync->services; } /** * @param string $sid The sid */ protected function contextServices(string $sid): \Twilio\Rest\Preview\Sync\ServiceContext { return $this->sync->services($sid); } protected function getAssistants(): \Twilio\Rest\Preview\Understand\AssistantList { return $this->understand->assistants; } /** * @param string $sid A 34 character string that uniquely identifies this * resource. */ protected function contextAssistants(string $sid): \Twilio\Rest\Preview\Understand\AssistantContext { return $this->understand->assistants($sid); } protected function getCommands(): \Twilio\Rest\Preview\Wireless\CommandList { return $this->wireless->commands; } /** * @param string $sid The sid */ protected function contextCommands(string $sid): \Twilio\Rest\Preview\Wireless\CommandContext { return $this->wireless->commands($sid); } protected function getRatePlans(): \Twilio\Rest\Preview\Wireless\RatePlanList { return $this->wireless->ratePlans; } /** * @param string $sid The sid */ protected function contextRatePlans(string $sid): \Twilio\Rest\Preview\Wireless\RatePlanContext { return $this->wireless->ratePlans($sid); } protected function getSims(): \Twilio\Rest\Preview\Wireless\SimList { return $this->wireless->sims; } /** * @param string $sid The sid */ protected function contextSims(string $sid): \Twilio\Rest\Preview\Wireless\SimContext { return $this->wireless->sims($sid); } protected function getBrandedChannels(): \Twilio\Rest\Preview\TrustedComms\BrandedChannelList { return $this->trustedComms->brandedChannels; } /** * @param string $sid Branded Channel Sid. */ protected function contextBrandedChannels(string $sid): \Twilio\Rest\Preview\TrustedComms\BrandedChannelContext { return $this->trustedComms->brandedChannels($sid); } protected function getBrandsInformation(): \Twilio\Rest\Preview\TrustedComms\BrandsInformationList { return $this->trustedComms->brandsInformation; } protected function contextBrandsInformation(): \Twilio\Rest\Preview\TrustedComms\BrandsInformationContext { return $this->trustedComms->brandsInformation(); } protected function getCps(): \Twilio\Rest\Preview\TrustedComms\CpsList { return $this->trustedComms->cps; } protected function contextCps(): \Twilio\Rest\Preview\TrustedComms\CpsContext { return $this->trustedComms->cps(); } protected function getCurrentCalls(): \Twilio\Rest\Preview\TrustedComms\CurrentCallList { return $this->trustedComms->currentCalls; } protected function contextCurrentCalls(): \Twilio\Rest\Preview\TrustedComms\CurrentCallContext { return $this->trustedComms->currentCalls(); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Preview]'; } }src/Twilio/Rest/Taskrouter.php000064400000005032150515725670012410 0ustar00baseUrl = 'https://taskrouter.twilio.com'; } /** * @return V1 Version v1 of taskrouter */ protected function getV1(): V1 { 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 TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } protected function getWorkspaces(): \Twilio\Rest\Taskrouter\V1\WorkspaceList { return $this->v1->workspaces; } /** * @param string $sid The SID of the resource to fetch */ protected function contextWorkspaces(string $sid): \Twilio\Rest\Taskrouter\V1\WorkspaceContext { return $this->v1->workspaces($sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter]'; } }src/Twilio/Rest/IpMessaging/V1/ServiceInstance.php000064400000014171150515725670016032 0ustar00properties = [ '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')), 'defaultServiceRoleSid' => Values::array_get($payload, 'default_service_role_sid'), 'defaultChannelRoleSid' => Values::array_get($payload, 'default_channel_role_sid'), 'defaultChannelCreatorRoleSid' => Values::array_get($payload, 'default_channel_creator_role_sid'), 'readStatusEnabled' => Values::array_get($payload, 'read_status_enabled'), 'reachabilityEnabled' => Values::array_get($payload, 'reachability_enabled'), 'typingIndicatorTimeout' => Values::array_get($payload, 'typing_indicator_timeout'), 'consumptionReportInterval' => Values::array_get($payload, 'consumption_report_interval'), 'limits' => Values::array_get($payload, 'limits'), 'webhooks' => Values::array_get($payload, 'webhooks'), 'preWebhookUrl' => Values::array_get($payload, 'pre_webhook_url'), 'postWebhookUrl' => Values::array_get($payload, 'post_webhook_url'), 'webhookMethod' => Values::array_get($payload, 'webhook_method'), 'webhookFilters' => Values::array_get($payload, 'webhook_filters'), 'notifications' => Values::array_get($payload, 'notifications'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 ServiceContext Context for this ServiceInstance */ protected function proxy(): ServiceContext { if (!$this->context) { $this->context = new ServiceContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the ServiceInstance * * @return ServiceInstance Fetched ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ServiceInstance { return $this->proxy()->fetch(); } /** * Delete the ServiceInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the ServiceInstance * * @param array|Options $options Optional Arguments * @return ServiceInstance Updated ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ServiceInstance { return $this->proxy()->update($options); } /** * Access the channels */ protected function getChannels(): ChannelList { return $this->proxy()->channels; } /** * Access the roles */ protected function getRoles(): RoleList { return $this->proxy()->roles; } /** * Access the users */ protected function getUsers(): UserList { return $this->proxy()->users; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V1.ServiceInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V1/CredentialList.php000064400000013027150515725670015652 0ustar00solution = []; $this->uri = '/Credentials'; } /** * Streams CredentialInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads CredentialInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return CredentialInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of CredentialInstance records from the API. * Request is executed immediately * * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return CredentialPage Page of CredentialInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): CredentialPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new CredentialPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of CredentialInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return CredentialPage Page of CredentialInstance */ public function getPage(string $targetUrl): CredentialPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new CredentialPage($this->version, $response, $this->solution); } /** * Create the CredentialInstance * * @param string $type The type * @param array|Options $options Optional Arguments * @return CredentialInstance Created CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $type, array $options = []): CredentialInstance { $options = new Values($options); $data = Values::of([ 'Type' => $type, 'FriendlyName' => $options['friendlyName'], 'Certificate' => $options['certificate'], 'PrivateKey' => $options['privateKey'], 'Sandbox' => Serialize::booleanToString($options['sandbox']), 'ApiKey' => $options['apiKey'], 'Secret' => $options['secret'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new CredentialInstance($this->version, $payload); } /** * Constructs a CredentialContext * * @param string $sid The sid */ public function getContext(string $sid): CredentialContext { return new CredentialContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V1.CredentialList]'; } }src/Twilio/Rest/IpMessaging/V1/CredentialContext.php000064400000005214150515725670016362 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Credentials/' . \rawurlencode($sid) . ''; } /** * Fetch the CredentialInstance * * @return CredentialInstance Fetched CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CredentialInstance { $payload = $this->version->fetch('GET', $this->uri); return new CredentialInstance($this->version, $payload, $this->solution['sid']); } /** * Update the CredentialInstance * * @param array|Options $options Optional Arguments * @return CredentialInstance Updated CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): CredentialInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'Certificate' => $options['certificate'], 'PrivateKey' => $options['privateKey'], 'Sandbox' => Serialize::booleanToString($options['sandbox']), 'ApiKey' => $options['apiKey'], 'Secret' => $options['secret'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new CredentialInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the CredentialInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V1.CredentialContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V1/Service/ChannelContext.php000064400000013012150515725670017253 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($sid) . ''; } /** * Fetch the ChannelInstance * * @return ChannelInstance Fetched ChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ChannelInstance { $payload = $this->version->fetch('GET', $this->uri); return new ChannelInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Delete the ChannelInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the ChannelInstance * * @param array|Options $options Optional Arguments * @return ChannelInstance Updated ChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ChannelInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'UniqueName' => $options['uniqueName'], 'Attributes' => $options['attributes'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ChannelInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Access the members */ protected function getMembers(): MemberList { if (!$this->_members) { $this->_members = new MemberList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_members; } /** * Access the messages */ protected function getMessages(): MessageList { if (!$this->_messages) { $this->_messages = new MessageList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_messages; } /** * Access the invites */ protected function getInvites(): InviteList { if (!$this->_invites) { $this->_invites = new InviteList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_invites; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V1.ChannelContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V1/Service/UserPage.php000064400000002245150515725670016057 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return UserInstance \Twilio\Rest\IpMessaging\V1\Service\UserInstance */ public function buildInstance(array $payload): UserInstance { return new UserInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V1.UserPage]'; } }src/Twilio/Rest/IpMessaging/V1/Service/ChannelOptions.php000064400000013502150515725670017266 0ustar00options['friendlyName'] = $friendlyName; $this->options['uniqueName'] = $uniqueName; $this->options['attributes'] = $attributes; $this->options['type'] = $type; } /** * The friendly_name * * @param string $friendlyName The friendly_name * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The unique_name * * @param string $uniqueName The unique_name * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * The attributes * * @param string $attributes The attributes * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The type * * @param string $type The type * @return $this Fluent Builder */ public function setType(string $type): self { $this->options['type'] = $type; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V1.CreateChannelOptions ' . $options . ']'; } } class ReadChannelOptions extends Options { /** * @param string[] $type The type */ public function __construct(array $type = Values::ARRAY_NONE) { $this->options['type'] = $type; } /** * The type * * @param string[] $type The type * @return $this Fluent Builder */ public function setType(array $type): self { $this->options['type'] = $type; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V1.ReadChannelOptions ' . $options . ']'; } } class UpdateChannelOptions extends Options { /** * @param string $friendlyName The friendly_name * @param string $uniqueName The unique_name * @param string $attributes The attributes */ public function __construct(string $friendlyName = Values::NONE, string $uniqueName = Values::NONE, string $attributes = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['uniqueName'] = $uniqueName; $this->options['attributes'] = $attributes; } /** * The friendly_name * * @param string $friendlyName The friendly_name * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The unique_name * * @param string $uniqueName The unique_name * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * The attributes * * @param string $attributes The attributes * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V1.UpdateChannelOptions ' . $options . ']'; } }src/Twilio/Rest/IpMessaging/V1/Service/UserContext.php000064400000010504150515725670016624 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Users/' . \rawurlencode($sid) . ''; } /** * Fetch the UserInstance * * @return UserInstance Fetched UserInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): UserInstance { $payload = $this->version->fetch('GET', $this->uri); return new UserInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Delete the UserInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the UserInstance * * @param array|Options $options Optional Arguments * @return UserInstance Updated UserInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): UserInstance { $options = new Values($options); $data = Values::of([ 'RoleSid' => $options['roleSid'], 'Attributes' => $options['attributes'], 'FriendlyName' => $options['friendlyName'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new UserInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Access the userChannels */ protected function getUserChannels(): UserChannelList { if (!$this->_userChannels) { $this->_userChannels = new UserChannelList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_userChannels; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V1.UserContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V1/Service/RoleList.php000064400000012631150515725670016101 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Roles'; } /** * Create the RoleInstance * * @param string $friendlyName The friendly_name * @param string $type The type * @param string[] $permission The permission * @return RoleInstance Created RoleInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, string $type, array $permission): RoleInstance { $data = Values::of([ 'FriendlyName' => $friendlyName, 'Type' => $type, 'Permission' => Serialize::map($permission, function($e) { return $e; }), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new RoleInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Streams RoleInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads RoleInstance 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 RoleInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of RoleInstance 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 RolePage Page of RoleInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): RolePage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new RolePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of RoleInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return RolePage Page of RoleInstance */ public function getPage(string $targetUrl): RolePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new RolePage($this->version, $response, $this->solution); } /** * Constructs a RoleContext * * @param string $sid The sid */ public function getContext(string $sid): RoleContext { return new RoleContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V1.RoleList]'; } }src/Twilio/Rest/IpMessaging/V1/Service/UserOptions.php000064400000010467150515725670016643 0ustar00options['roleSid'] = $roleSid; $this->options['attributes'] = $attributes; $this->options['friendlyName'] = $friendlyName; } /** * The role_sid * * @param string $roleSid The role_sid * @return $this Fluent Builder */ public function setRoleSid(string $roleSid): self { $this->options['roleSid'] = $roleSid; return $this; } /** * The attributes * * @param string $attributes The attributes * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The friendly_name * * @param string $friendlyName The friendly_name * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V1.CreateUserOptions ' . $options . ']'; } } class UpdateUserOptions extends Options { /** * @param string $roleSid The role_sid * @param string $attributes The attributes * @param string $friendlyName The friendly_name */ public function __construct(string $roleSid = Values::NONE, string $attributes = Values::NONE, string $friendlyName = Values::NONE) { $this->options['roleSid'] = $roleSid; $this->options['attributes'] = $attributes; $this->options['friendlyName'] = $friendlyName; } /** * The role_sid * * @param string $roleSid The role_sid * @return $this Fluent Builder */ public function setRoleSid(string $roleSid): self { $this->options['roleSid'] = $roleSid; return $this; } /** * The attributes * * @param string $attributes The attributes * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The friendly_name * * @param string $friendlyName The friendly_name * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V1.UpdateUserOptions ' . $options . ']'; } }src/Twilio/Rest/IpMessaging/V1/Service/RoleContext.php000064400000005052150515725670016611 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Roles/' . \rawurlencode($sid) . ''; } /** * Fetch the RoleInstance * * @return RoleInstance Fetched RoleInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RoleInstance { $payload = $this->version->fetch('GET', $this->uri); return new RoleInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Delete the RoleInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the RoleInstance * * @param string[] $permission The permission * @return RoleInstance Updated RoleInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $permission): RoleInstance { $data = Values::of(['Permission' => Serialize::map($permission, function($e) { return $e; }), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new RoleInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V1.RoleContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V1/Service/RoleInstance.php000064400000010215150515725670016726 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'type' => Values::array_get($payload, 'type'), 'permissions' => Values::array_get($payload, 'permissions'), '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 = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return RoleContext Context for this RoleInstance */ protected function proxy(): RoleContext { if (!$this->context) { $this->context = new RoleContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the RoleInstance * * @return RoleInstance Fetched RoleInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RoleInstance { return $this->proxy()->fetch(); } /** * Delete the RoleInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the RoleInstance * * @param string[] $permission The permission * @return RoleInstance Updated RoleInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $permission): RoleInstance { return $this->proxy()->update($permission); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V1.RoleInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V1/Service/ChannelInstance.php000064400000012562150515725670017404 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'attributes' => Values::array_get($payload, 'attributes'), 'type' => Values::array_get($payload, 'type'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'createdBy' => Values::array_get($payload, 'created_by'), 'membersCount' => Values::array_get($payload, 'members_count'), 'messagesCount' => Values::array_get($payload, 'messages_count'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return ChannelContext Context for this ChannelInstance */ protected function proxy(): ChannelContext { if (!$this->context) { $this->context = new ChannelContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the ChannelInstance * * @return ChannelInstance Fetched ChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ChannelInstance { return $this->proxy()->fetch(); } /** * Delete the ChannelInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the ChannelInstance * * @param array|Options $options Optional Arguments * @return ChannelInstance Updated ChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ChannelInstance { return $this->proxy()->update($options); } /** * Access the members */ protected function getMembers(): MemberList { return $this->proxy()->members; } /** * Access the messages */ protected function getMessages(): MessageList { return $this->proxy()->messages; } /** * Access the invites */ protected function getInvites(): InviteList { return $this->proxy()->invites; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V1.ChannelInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V1/Service/Channel/InvitePage.php000064400000002432150515725670017745 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return InviteInstance \Twilio\Rest\IpMessaging\V1\Service\Channel\InviteInstance */ public function buildInstance(array $payload): InviteInstance { return new InviteInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V1.InvitePage]'; } }src/Twilio/Rest/IpMessaging/V1/Service/Channel/MemberOptions.php000064400000010060150515725670020471 0ustar00options['roleSid'] = $roleSid; } /** * The role_sid * * @param string $roleSid The role_sid * @return $this Fluent Builder */ public function setRoleSid(string $roleSid): self { $this->options['roleSid'] = $roleSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V1.CreateMemberOptions ' . $options . ']'; } } class ReadMemberOptions extends Options { /** * @param string[] $identity The identity */ public function __construct(array $identity = Values::ARRAY_NONE) { $this->options['identity'] = $identity; } /** * The identity * * @param string[] $identity The identity * @return $this Fluent Builder */ public function setIdentity(array $identity): self { $this->options['identity'] = $identity; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V1.ReadMemberOptions ' . $options . ']'; } } class UpdateMemberOptions extends Options { /** * @param string $roleSid The role_sid * @param int $lastConsumedMessageIndex The last_consumed_message_index */ public function __construct(string $roleSid = Values::NONE, int $lastConsumedMessageIndex = Values::NONE) { $this->options['roleSid'] = $roleSid; $this->options['lastConsumedMessageIndex'] = $lastConsumedMessageIndex; } /** * The role_sid * * @param string $roleSid The role_sid * @return $this Fluent Builder */ public function setRoleSid(string $roleSid): self { $this->options['roleSid'] = $roleSid; return $this; } /** * The last_consumed_message_index * * @param int $lastConsumedMessageIndex The last_consumed_message_index * @return $this Fluent Builder */ public function setLastConsumedMessageIndex(int $lastConsumedMessageIndex): self { $this->options['lastConsumedMessageIndex'] = $lastConsumedMessageIndex; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V1.UpdateMemberOptions ' . $options . ']'; } }src/Twilio/Rest/IpMessaging/V1/Service/Channel/InviteInstance.php000064400000010175150515725670020640 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'channelSid' => Values::array_get($payload, 'channel_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'identity' => Values::array_get($payload, 'identity'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'roleSid' => Values::array_get($payload, 'role_sid'), 'createdBy' => Values::array_get($payload, 'created_by'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'channelSid' => $channelSid, '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 InviteContext Context for this InviteInstance */ protected function proxy(): InviteContext { if (!$this->context) { $this->context = new InviteContext( $this->version, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the InviteInstance * * @return InviteInstance Fetched InviteInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): InviteInstance { return $this->proxy()->fetch(); } /** * Delete the InviteInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V1.InviteInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V1/Service/Channel/MessageInstance.php000064400000011355150515725670020767 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'attributes' => Values::array_get($payload, 'attributes'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'to' => Values::array_get($payload, 'to'), 'channelSid' => Values::array_get($payload, 'channel_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'wasEdited' => Values::array_get($payload, 'was_edited'), 'from' => Values::array_get($payload, 'from'), 'body' => Values::array_get($payload, 'body'), 'index' => Values::array_get($payload, 'index'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'channelSid' => $channelSid, '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 MessageContext Context for this MessageInstance */ protected function proxy(): MessageContext { if (!$this->context) { $this->context = new MessageContext( $this->version, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the MessageInstance * * @return MessageInstance Fetched MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MessageInstance { return $this->proxy()->fetch(); } /** * Delete the MessageInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the MessageInstance * * @param array|Options $options Optional Arguments * @return MessageInstance Updated MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): MessageInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V1.MessageInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V1/Service/Channel/MessageList.php000064400000014146150515725670020137 0ustar00solution = ['serviceSid' => $serviceSid, 'channelSid' => $channelSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($channelSid) . '/Messages'; } /** * Create the MessageInstance * * @param string $body The body * @param array|Options $options Optional Arguments * @return MessageInstance Created MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $body, array $options = []): MessageInstance { $options = new Values($options); $data = Values::of([ 'Body' => $body, 'From' => $options['from'], 'Attributes' => $options['attributes'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new MessageInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'] ); } /** * Streams MessageInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads MessageInstance 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 MessageInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of MessageInstance 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 MessagePage Page of MessageInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): MessagePage { $options = new Values($options); $params = Values::of([ 'Order' => $options['order'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new MessagePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of MessageInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return MessagePage Page of MessageInstance */ public function getPage(string $targetUrl): MessagePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new MessagePage($this->version, $response, $this->solution); } /** * Constructs a MessageContext * * @param string $sid The sid */ public function getContext(string $sid): MessageContext { return new MessageContext( $this->version, $this->solution['serviceSid'], $this->solution['channelSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V1.MessageList]'; } }src/Twilio/Rest/IpMessaging/V1/Service/Channel/MessageContext.php000064400000005546150515725670020654 0ustar00solution = ['serviceSid' => $serviceSid, 'channelSid' => $channelSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($channelSid) . '/Messages/' . \rawurlencode($sid) . ''; } /** * Fetch the MessageInstance * * @return MessageInstance Fetched MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MessageInstance { $payload = $this->version->fetch('GET', $this->uri); return new MessageInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } /** * Delete the MessageInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the MessageInstance * * @param array|Options $options Optional Arguments * @return MessageInstance Updated MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): MessageInstance { $options = new Values($options); $data = Values::of(['Body' => $options['body'], 'Attributes' => $options['attributes'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new MessageInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V1.MessageContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V1/Service/Channel/MemberList.php000064400000014133150515725670017756 0ustar00solution = ['serviceSid' => $serviceSid, 'channelSid' => $channelSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($channelSid) . '/Members'; } /** * Create the MemberInstance * * @param string $identity The identity * @param array|Options $options Optional Arguments * @return MemberInstance Created MemberInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $identity, array $options = []): MemberInstance { $options = new Values($options); $data = Values::of(['Identity' => $identity, 'RoleSid' => $options['roleSid'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new MemberInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'] ); } /** * Streams MemberInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads MemberInstance 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 MemberInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of MemberInstance 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 MemberPage Page of MemberInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): MemberPage { $options = new Values($options); $params = Values::of([ 'Identity' => Serialize::map($options['identity'], function($e) { return $e; }), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new MemberPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of MemberInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return MemberPage Page of MemberInstance */ public function getPage(string $targetUrl): MemberPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new MemberPage($this->version, $response, $this->solution); } /** * Constructs a MemberContext * * @param string $sid The sid */ public function getContext(string $sid): MemberContext { return new MemberContext( $this->version, $this->solution['serviceSid'], $this->solution['channelSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V1.MemberList]'; } }src/Twilio/Rest/IpMessaging/V1/Service/Channel/MemberContext.php000064400000005632150515725670020473 0ustar00solution = ['serviceSid' => $serviceSid, 'channelSid' => $channelSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($channelSid) . '/Members/' . \rawurlencode($sid) . ''; } /** * Fetch the MemberInstance * * @return MemberInstance Fetched MemberInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MemberInstance { $payload = $this->version->fetch('GET', $this->uri); return new MemberInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } /** * Delete the MemberInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the MemberInstance * * @param array|Options $options Optional Arguments * @return MemberInstance Updated MemberInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): MemberInstance { $options = new Values($options); $data = Values::of([ 'RoleSid' => $options['roleSid'], 'LastConsumedMessageIndex' => $options['lastConsumedMessageIndex'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new MemberInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V1.MemberContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V1/Service/Channel/InviteOptions.php000064400000004500150515725670020522 0ustar00options['roleSid'] = $roleSid; } /** * The role_sid * * @param string $roleSid The role_sid * @return $this Fluent Builder */ public function setRoleSid(string $roleSid): self { $this->options['roleSid'] = $roleSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V1.CreateInviteOptions ' . $options . ']'; } } class ReadInviteOptions extends Options { /** * @param string[] $identity The identity */ public function __construct(array $identity = Values::ARRAY_NONE) { $this->options['identity'] = $identity; } /** * The identity * * @param string[] $identity The identity * @return $this Fluent Builder */ public function setIdentity(array $identity): self { $this->options['identity'] = $identity; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V1.ReadInviteOptions ' . $options . ']'; } }src/Twilio/Rest/IpMessaging/V1/Service/Channel/MessageOptions.php000064400000010266150515725670020656 0ustar00options['from'] = $from; $this->options['attributes'] = $attributes; } /** * The from * * @param string $from The from * @return $this Fluent Builder */ public function setFrom(string $from): self { $this->options['from'] = $from; return $this; } /** * The attributes * * @param string $attributes The attributes * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V1.CreateMessageOptions ' . $options . ']'; } } class ReadMessageOptions extends Options { /** * @param string $order The order */ public function __construct(string $order = Values::NONE) { $this->options['order'] = $order; } /** * The order * * @param string $order The order * @return $this Fluent Builder */ public function setOrder(string $order): self { $this->options['order'] = $order; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V1.ReadMessageOptions ' . $options . ']'; } } class UpdateMessageOptions extends Options { /** * @param string $body The body * @param string $attributes The attributes */ public function __construct(string $body = Values::NONE, string $attributes = Values::NONE) { $this->options['body'] = $body; $this->options['attributes'] = $attributes; } /** * The body * * @param string $body The body * @return $this Fluent Builder */ public function setBody(string $body): self { $this->options['body'] = $body; return $this; } /** * The attributes * * @param string $attributes The attributes * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V1.UpdateMessageOptions ' . $options . ']'; } }src/Twilio/Rest/IpMessaging/V1/Service/Channel/InviteList.php000064400000014133150515725670020005 0ustar00solution = ['serviceSid' => $serviceSid, 'channelSid' => $channelSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($channelSid) . '/Invites'; } /** * Create the InviteInstance * * @param string $identity The identity * @param array|Options $options Optional Arguments * @return InviteInstance Created InviteInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $identity, array $options = []): InviteInstance { $options = new Values($options); $data = Values::of(['Identity' => $identity, 'RoleSid' => $options['roleSid'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new InviteInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'] ); } /** * Streams InviteInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads InviteInstance 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 InviteInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of InviteInstance 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 InvitePage Page of InviteInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): InvitePage { $options = new Values($options); $params = Values::of([ 'Identity' => Serialize::map($options['identity'], function($e) { return $e; }), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new InvitePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of InviteInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return InvitePage Page of InviteInstance */ public function getPage(string $targetUrl): InvitePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new InvitePage($this->version, $response, $this->solution); } /** * Constructs a InviteContext * * @param string $sid The sid */ public function getContext(string $sid): InviteContext { return new InviteContext( $this->version, $this->solution['serviceSid'], $this->solution['channelSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V1.InviteList]'; } }src/Twilio/Rest/IpMessaging/V1/Service/Channel/InviteContext.php000064400000004150150515725670020514 0ustar00solution = ['serviceSid' => $serviceSid, 'channelSid' => $channelSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($channelSid) . '/Invites/' . \rawurlencode($sid) . ''; } /** * Fetch the InviteInstance * * @return InviteInstance Fetched InviteInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): InviteInstance { $payload = $this->version->fetch('GET', $this->uri); return new InviteInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } /** * Delete the InviteInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V1.InviteContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V1/Service/Channel/MemberPage.php000064400000002432150515725670017716 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return MemberInstance \Twilio\Rest\IpMessaging\V1\Service\Channel\MemberInstance */ public function buildInstance(array $payload): MemberInstance { return new MemberInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V1.MemberPage]'; } }src/Twilio/Rest/IpMessaging/V1/Service/Channel/MemberInstance.php000064400000011303150515725670020603 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'channelSid' => Values::array_get($payload, 'channel_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'identity' => Values::array_get($payload, 'identity'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'roleSid' => Values::array_get($payload, 'role_sid'), 'lastConsumedMessageIndex' => Values::array_get($payload, 'last_consumed_message_index'), 'lastConsumptionTimestamp' => Deserialize::dateTime(Values::array_get($payload, 'last_consumption_timestamp')), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'channelSid' => $channelSid, '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 MemberContext Context for this MemberInstance */ protected function proxy(): MemberContext { if (!$this->context) { $this->context = new MemberContext( $this->version, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the MemberInstance * * @return MemberInstance Fetched MemberInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MemberInstance { return $this->proxy()->fetch(); } /** * Delete the MemberInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the MemberInstance * * @param array|Options $options Optional Arguments * @return MemberInstance Updated MemberInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): MemberInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V1.MemberInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V1/Service/Channel/MessagePage.php000064400000002440150515725670020072 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return MessageInstance \Twilio\Rest\IpMessaging\V1\Service\Channel\MessageInstance */ public function buildInstance(array $payload): MessageInstance { return new MessageInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V1.MessagePage]'; } }src/Twilio/Rest/IpMessaging/V1/Service/User/UserChannelPage.php000064400000002457150515725670020273 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return UserChannelInstance \Twilio\Rest\IpMessaging\V1\Service\User\UserChannelInstance */ public function buildInstance(array $payload): UserChannelInstance { return new UserChannelInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['userSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V1.UserChannelPage]'; } }src/Twilio/Rest/IpMessaging/V1/Service/User/UserChannelInstance.php000064400000005043150515725670021155 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'channelSid' => Values::array_get($payload, 'channel_sid'), 'memberSid' => Values::array_get($payload, 'member_sid'), 'status' => Values::array_get($payload, 'status'), 'lastConsumedMessageIndex' => Values::array_get($payload, 'last_consumed_message_index'), 'unreadMessagesCount' => Values::array_get($payload, 'unread_messages_count'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['serviceSid' => $serviceSid, 'userSid' => $userSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.IpMessaging.V1.UserChannelInstance]'; } }src/Twilio/Rest/IpMessaging/V1/Service/User/UserChannelList.php000064400000011124150515725670020321 0ustar00solution = ['serviceSid' => $serviceSid, 'userSid' => $userSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Users/' . \rawurlencode($userSid) . '/Channels'; } /** * Streams UserChannelInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads UserChannelInstance 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 UserChannelInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of UserChannelInstance 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 UserChannelPage Page of UserChannelInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): UserChannelPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new UserChannelPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of UserChannelInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return UserChannelPage Page of UserChannelInstance */ public function getPage(string $targetUrl): UserChannelPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new UserChannelPage($this->version, $response, $this->solution); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V1.UserChannelList]'; } }src/Twilio/Rest/IpMessaging/V1/Service/ChannelPage.php000064400000002267150515725670016515 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ChannelInstance \Twilio\Rest\IpMessaging\V1\Service\ChannelInstance */ public function buildInstance(array $payload): ChannelInstance { return new ChannelInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V1.ChannelPage]'; } }src/Twilio/Rest/IpMessaging/V1/Service/RolePage.php000064400000002245150515725670016042 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return RoleInstance \Twilio\Rest\IpMessaging\V1\Service\RoleInstance */ public function buildInstance(array $payload): RoleInstance { return new RoleInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V1.RolePage]'; } }src/Twilio/Rest/IpMessaging/V1/Service/ChannelList.php000064400000013574150515725670016557 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels'; } /** * Create the ChannelInstance * * @param array|Options $options Optional Arguments * @return ChannelInstance Created ChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): ChannelInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'UniqueName' => $options['uniqueName'], 'Attributes' => $options['attributes'], 'Type' => $options['type'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ChannelInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Streams ChannelInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ChannelInstance 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 ChannelInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of ChannelInstance 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 ChannelPage Page of ChannelInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ChannelPage { $options = new Values($options); $params = Values::of([ 'Type' => Serialize::map($options['type'], function($e) { return $e; }), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ChannelPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ChannelInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ChannelPage Page of ChannelInstance */ public function getPage(string $targetUrl): ChannelPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ChannelPage($this->version, $response, $this->solution); } /** * Constructs a ChannelContext * * @param string $sid The sid */ public function getContext(string $sid): ChannelContext { return new ChannelContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V1.ChannelList]'; } }src/Twilio/Rest/IpMessaging/V1/Service/UserList.php000064400000012651150515725670016120 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Users'; } /** * Create the UserInstance * * @param string $identity The identity * @param array|Options $options Optional Arguments * @return UserInstance Created UserInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $identity, array $options = []): UserInstance { $options = new Values($options); $data = Values::of([ 'Identity' => $identity, 'RoleSid' => $options['roleSid'], 'Attributes' => $options['attributes'], 'FriendlyName' => $options['friendlyName'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new UserInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Streams UserInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads UserInstance 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 UserInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of UserInstance 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 UserPage Page of UserInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): UserPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new UserPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of UserInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return UserPage Page of UserInstance */ public function getPage(string $targetUrl): UserPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new UserPage($this->version, $response, $this->solution); } /** * Constructs a UserContext * * @param string $sid The sid */ public function getContext(string $sid): UserContext { return new UserContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V1.UserList]'; } }src/Twilio/Rest/IpMessaging/V1/Service/UserInstance.php000064400000011653150515725670016752 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'attributes' => Values::array_get($payload, 'attributes'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'roleSid' => Values::array_get($payload, 'role_sid'), 'identity' => Values::array_get($payload, 'identity'), 'isOnline' => Values::array_get($payload, 'is_online'), 'isNotifiable' => Values::array_get($payload, 'is_notifiable'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'joinedChannelsCount' => Values::array_get($payload, 'joined_channels_count'), 'links' => Values::array_get($payload, 'links'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return UserContext Context for this UserInstance */ protected function proxy(): UserContext { if (!$this->context) { $this->context = new UserContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the UserInstance * * @return UserInstance Fetched UserInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): UserInstance { return $this->proxy()->fetch(); } /** * Delete the UserInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the UserInstance * * @param array|Options $options Optional Arguments * @return UserInstance Updated UserInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): UserInstance { return $this->proxy()->update($options); } /** * Access the userChannels */ protected function getUserChannels(): UserChannelList { return $this->proxy()->userChannels; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V1.UserInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V1/ServiceContext.php000064400000022635150515725670015716 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($sid) . ''; } /** * Fetch the ServiceInstance * * @return ServiceInstance Fetched ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ServiceInstance { $payload = $this->version->fetch('GET', $this->uri); return new ServiceInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the ServiceInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the ServiceInstance * * @param array|Options $options Optional Arguments * @return ServiceInstance Updated ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ServiceInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'DefaultServiceRoleSid' => $options['defaultServiceRoleSid'], 'DefaultChannelRoleSid' => $options['defaultChannelRoleSid'], 'DefaultChannelCreatorRoleSid' => $options['defaultChannelCreatorRoleSid'], 'ReadStatusEnabled' => Serialize::booleanToString($options['readStatusEnabled']), 'ReachabilityEnabled' => Serialize::booleanToString($options['reachabilityEnabled']), 'TypingIndicatorTimeout' => $options['typingIndicatorTimeout'], 'ConsumptionReportInterval' => $options['consumptionReportInterval'], 'Notifications.NewMessage.Enabled' => Serialize::booleanToString($options['notificationsNewMessageEnabled']), 'Notifications.NewMessage.Template' => $options['notificationsNewMessageTemplate'], 'Notifications.AddedToChannel.Enabled' => Serialize::booleanToString($options['notificationsAddedToChannelEnabled']), 'Notifications.AddedToChannel.Template' => $options['notificationsAddedToChannelTemplate'], 'Notifications.RemovedFromChannel.Enabled' => Serialize::booleanToString($options['notificationsRemovedFromChannelEnabled']), 'Notifications.RemovedFromChannel.Template' => $options['notificationsRemovedFromChannelTemplate'], 'Notifications.InvitedToChannel.Enabled' => Serialize::booleanToString($options['notificationsInvitedToChannelEnabled']), 'Notifications.InvitedToChannel.Template' => $options['notificationsInvitedToChannelTemplate'], 'PreWebhookUrl' => $options['preWebhookUrl'], 'PostWebhookUrl' => $options['postWebhookUrl'], 'WebhookMethod' => $options['webhookMethod'], 'WebhookFilters' => Serialize::map($options['webhookFilters'], function($e) { return $e; }), 'Webhooks.OnMessageSend.Url' => $options['webhooksOnMessageSendUrl'], 'Webhooks.OnMessageSend.Method' => $options['webhooksOnMessageSendMethod'], 'Webhooks.OnMessageUpdate.Url' => $options['webhooksOnMessageUpdateUrl'], 'Webhooks.OnMessageUpdate.Method' => $options['webhooksOnMessageUpdateMethod'], 'Webhooks.OnMessageRemove.Url' => $options['webhooksOnMessageRemoveUrl'], 'Webhooks.OnMessageRemove.Method' => $options['webhooksOnMessageRemoveMethod'], 'Webhooks.OnChannelAdd.Url' => $options['webhooksOnChannelAddUrl'], 'Webhooks.OnChannelAdd.Method' => $options['webhooksOnChannelAddMethod'], 'Webhooks.OnChannelDestroy.Url' => $options['webhooksOnChannelDestroyUrl'], 'Webhooks.OnChannelDestroy.Method' => $options['webhooksOnChannelDestroyMethod'], 'Webhooks.OnChannelUpdate.Url' => $options['webhooksOnChannelUpdateUrl'], 'Webhooks.OnChannelUpdate.Method' => $options['webhooksOnChannelUpdateMethod'], 'Webhooks.OnMemberAdd.Url' => $options['webhooksOnMemberAddUrl'], 'Webhooks.OnMemberAdd.Method' => $options['webhooksOnMemberAddMethod'], 'Webhooks.OnMemberRemove.Url' => $options['webhooksOnMemberRemoveUrl'], 'Webhooks.OnMemberRemove.Method' => $options['webhooksOnMemberRemoveMethod'], 'Webhooks.OnMessageSent.Url' => $options['webhooksOnMessageSentUrl'], 'Webhooks.OnMessageSent.Method' => $options['webhooksOnMessageSentMethod'], 'Webhooks.OnMessageUpdated.Url' => $options['webhooksOnMessageUpdatedUrl'], 'Webhooks.OnMessageUpdated.Method' => $options['webhooksOnMessageUpdatedMethod'], 'Webhooks.OnMessageRemoved.Url' => $options['webhooksOnMessageRemovedUrl'], 'Webhooks.OnMessageRemoved.Method' => $options['webhooksOnMessageRemovedMethod'], 'Webhooks.OnChannelAdded.Url' => $options['webhooksOnChannelAddedUrl'], 'Webhooks.OnChannelAdded.Method' => $options['webhooksOnChannelAddedMethod'], 'Webhooks.OnChannelDestroyed.Url' => $options['webhooksOnChannelDestroyedUrl'], 'Webhooks.OnChannelDestroyed.Method' => $options['webhooksOnChannelDestroyedMethod'], 'Webhooks.OnChannelUpdated.Url' => $options['webhooksOnChannelUpdatedUrl'], 'Webhooks.OnChannelUpdated.Method' => $options['webhooksOnChannelUpdatedMethod'], 'Webhooks.OnMemberAdded.Url' => $options['webhooksOnMemberAddedUrl'], 'Webhooks.OnMemberAdded.Method' => $options['webhooksOnMemberAddedMethod'], 'Webhooks.OnMemberRemoved.Url' => $options['webhooksOnMemberRemovedUrl'], 'Webhooks.OnMemberRemoved.Method' => $options['webhooksOnMemberRemovedMethod'], 'Limits.ChannelMembers' => $options['limitsChannelMembers'], 'Limits.UserChannels' => $options['limitsUserChannels'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ServiceInstance($this->version, $payload, $this->solution['sid']); } /** * Access the channels */ protected function getChannels(): ChannelList { if (!$this->_channels) { $this->_channels = new ChannelList($this->version, $this->solution['sid']); } return $this->_channels; } /** * Access the roles */ protected function getRoles(): RoleList { if (!$this->_roles) { $this->_roles = new RoleList($this->version, $this->solution['sid']); } return $this->_roles; } /** * Access the users */ protected function getUsers(): UserList { if (!$this->_users) { $this->_users = new UserList($this->version, $this->solution['sid']); } return $this->_users; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V1.ServiceContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V1/ServiceOptions.php000064400000133370150515725670015724 0ustar00options['friendlyName'] = $friendlyName; $this->options['defaultServiceRoleSid'] = $defaultServiceRoleSid; $this->options['defaultChannelRoleSid'] = $defaultChannelRoleSid; $this->options['defaultChannelCreatorRoleSid'] = $defaultChannelCreatorRoleSid; $this->options['readStatusEnabled'] = $readStatusEnabled; $this->options['reachabilityEnabled'] = $reachabilityEnabled; $this->options['typingIndicatorTimeout'] = $typingIndicatorTimeout; $this->options['consumptionReportInterval'] = $consumptionReportInterval; $this->options['notificationsNewMessageEnabled'] = $notificationsNewMessageEnabled; $this->options['notificationsNewMessageTemplate'] = $notificationsNewMessageTemplate; $this->options['notificationsAddedToChannelEnabled'] = $notificationsAddedToChannelEnabled; $this->options['notificationsAddedToChannelTemplate'] = $notificationsAddedToChannelTemplate; $this->options['notificationsRemovedFromChannelEnabled'] = $notificationsRemovedFromChannelEnabled; $this->options['notificationsRemovedFromChannelTemplate'] = $notificationsRemovedFromChannelTemplate; $this->options['notificationsInvitedToChannelEnabled'] = $notificationsInvitedToChannelEnabled; $this->options['notificationsInvitedToChannelTemplate'] = $notificationsInvitedToChannelTemplate; $this->options['preWebhookUrl'] = $preWebhookUrl; $this->options['postWebhookUrl'] = $postWebhookUrl; $this->options['webhookMethod'] = $webhookMethod; $this->options['webhookFilters'] = $webhookFilters; $this->options['webhooksOnMessageSendUrl'] = $webhooksOnMessageSendUrl; $this->options['webhooksOnMessageSendMethod'] = $webhooksOnMessageSendMethod; $this->options['webhooksOnMessageUpdateUrl'] = $webhooksOnMessageUpdateUrl; $this->options['webhooksOnMessageUpdateMethod'] = $webhooksOnMessageUpdateMethod; $this->options['webhooksOnMessageRemoveUrl'] = $webhooksOnMessageRemoveUrl; $this->options['webhooksOnMessageRemoveMethod'] = $webhooksOnMessageRemoveMethod; $this->options['webhooksOnChannelAddUrl'] = $webhooksOnChannelAddUrl; $this->options['webhooksOnChannelAddMethod'] = $webhooksOnChannelAddMethod; $this->options['webhooksOnChannelDestroyUrl'] = $webhooksOnChannelDestroyUrl; $this->options['webhooksOnChannelDestroyMethod'] = $webhooksOnChannelDestroyMethod; $this->options['webhooksOnChannelUpdateUrl'] = $webhooksOnChannelUpdateUrl; $this->options['webhooksOnChannelUpdateMethod'] = $webhooksOnChannelUpdateMethod; $this->options['webhooksOnMemberAddUrl'] = $webhooksOnMemberAddUrl; $this->options['webhooksOnMemberAddMethod'] = $webhooksOnMemberAddMethod; $this->options['webhooksOnMemberRemoveUrl'] = $webhooksOnMemberRemoveUrl; $this->options['webhooksOnMemberRemoveMethod'] = $webhooksOnMemberRemoveMethod; $this->options['webhooksOnMessageSentUrl'] = $webhooksOnMessageSentUrl; $this->options['webhooksOnMessageSentMethod'] = $webhooksOnMessageSentMethod; $this->options['webhooksOnMessageUpdatedUrl'] = $webhooksOnMessageUpdatedUrl; $this->options['webhooksOnMessageUpdatedMethod'] = $webhooksOnMessageUpdatedMethod; $this->options['webhooksOnMessageRemovedUrl'] = $webhooksOnMessageRemovedUrl; $this->options['webhooksOnMessageRemovedMethod'] = $webhooksOnMessageRemovedMethod; $this->options['webhooksOnChannelAddedUrl'] = $webhooksOnChannelAddedUrl; $this->options['webhooksOnChannelAddedMethod'] = $webhooksOnChannelAddedMethod; $this->options['webhooksOnChannelDestroyedUrl'] = $webhooksOnChannelDestroyedUrl; $this->options['webhooksOnChannelDestroyedMethod'] = $webhooksOnChannelDestroyedMethod; $this->options['webhooksOnChannelUpdatedUrl'] = $webhooksOnChannelUpdatedUrl; $this->options['webhooksOnChannelUpdatedMethod'] = $webhooksOnChannelUpdatedMethod; $this->options['webhooksOnMemberAddedUrl'] = $webhooksOnMemberAddedUrl; $this->options['webhooksOnMemberAddedMethod'] = $webhooksOnMemberAddedMethod; $this->options['webhooksOnMemberRemovedUrl'] = $webhooksOnMemberRemovedUrl; $this->options['webhooksOnMemberRemovedMethod'] = $webhooksOnMemberRemovedMethod; $this->options['limitsChannelMembers'] = $limitsChannelMembers; $this->options['limitsUserChannels'] = $limitsUserChannels; } /** * The friendly_name * * @param string $friendlyName The friendly_name * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The default_service_role_sid * * @param string $defaultServiceRoleSid The default_service_role_sid * @return $this Fluent Builder */ public function setDefaultServiceRoleSid(string $defaultServiceRoleSid): self { $this->options['defaultServiceRoleSid'] = $defaultServiceRoleSid; return $this; } /** * The default_channel_role_sid * * @param string $defaultChannelRoleSid The default_channel_role_sid * @return $this Fluent Builder */ public function setDefaultChannelRoleSid(string $defaultChannelRoleSid): self { $this->options['defaultChannelRoleSid'] = $defaultChannelRoleSid; return $this; } /** * The default_channel_creator_role_sid * * @param string $defaultChannelCreatorRoleSid The * default_channel_creator_role_sid * @return $this Fluent Builder */ public function setDefaultChannelCreatorRoleSid(string $defaultChannelCreatorRoleSid): self { $this->options['defaultChannelCreatorRoleSid'] = $defaultChannelCreatorRoleSid; return $this; } /** * The read_status_enabled * * @param bool $readStatusEnabled The read_status_enabled * @return $this Fluent Builder */ public function setReadStatusEnabled(bool $readStatusEnabled): self { $this->options['readStatusEnabled'] = $readStatusEnabled; return $this; } /** * The reachability_enabled * * @param bool $reachabilityEnabled The reachability_enabled * @return $this Fluent Builder */ public function setReachabilityEnabled(bool $reachabilityEnabled): self { $this->options['reachabilityEnabled'] = $reachabilityEnabled; return $this; } /** * The typing_indicator_timeout * * @param int $typingIndicatorTimeout The typing_indicator_timeout * @return $this Fluent Builder */ public function setTypingIndicatorTimeout(int $typingIndicatorTimeout): self { $this->options['typingIndicatorTimeout'] = $typingIndicatorTimeout; return $this; } /** * The consumption_report_interval * * @param int $consumptionReportInterval The consumption_report_interval * @return $this Fluent Builder */ public function setConsumptionReportInterval(int $consumptionReportInterval): self { $this->options['consumptionReportInterval'] = $consumptionReportInterval; return $this; } /** * The notifications.new_message.enabled * * @param bool $notificationsNewMessageEnabled The * notifications.new_message.enabled * @return $this Fluent Builder */ public function setNotificationsNewMessageEnabled(bool $notificationsNewMessageEnabled): self { $this->options['notificationsNewMessageEnabled'] = $notificationsNewMessageEnabled; return $this; } /** * The notifications.new_message.template * * @param string $notificationsNewMessageTemplate The * notifications.new_message.template * @return $this Fluent Builder */ public function setNotificationsNewMessageTemplate(string $notificationsNewMessageTemplate): self { $this->options['notificationsNewMessageTemplate'] = $notificationsNewMessageTemplate; return $this; } /** * The notifications.added_to_channel.enabled * * @param bool $notificationsAddedToChannelEnabled The * notifications.added_to_channel.enabled * @return $this Fluent Builder */ public function setNotificationsAddedToChannelEnabled(bool $notificationsAddedToChannelEnabled): self { $this->options['notificationsAddedToChannelEnabled'] = $notificationsAddedToChannelEnabled; return $this; } /** * The notifications.added_to_channel.template * * @param string $notificationsAddedToChannelTemplate The * notifications.added_to_channel.template * @return $this Fluent Builder */ public function setNotificationsAddedToChannelTemplate(string $notificationsAddedToChannelTemplate): self { $this->options['notificationsAddedToChannelTemplate'] = $notificationsAddedToChannelTemplate; return $this; } /** * The notifications.removed_from_channel.enabled * * @param bool $notificationsRemovedFromChannelEnabled The * notifications.removed_from_channel.enabled * @return $this Fluent Builder */ public function setNotificationsRemovedFromChannelEnabled(bool $notificationsRemovedFromChannelEnabled): self { $this->options['notificationsRemovedFromChannelEnabled'] = $notificationsRemovedFromChannelEnabled; return $this; } /** * The notifications.removed_from_channel.template * * @param string $notificationsRemovedFromChannelTemplate The * notifications.removed_from_channel.template * @return $this Fluent Builder */ public function setNotificationsRemovedFromChannelTemplate(string $notificationsRemovedFromChannelTemplate): self { $this->options['notificationsRemovedFromChannelTemplate'] = $notificationsRemovedFromChannelTemplate; return $this; } /** * The notifications.invited_to_channel.enabled * * @param bool $notificationsInvitedToChannelEnabled The * notifications.invited_to_channel.enabled * @return $this Fluent Builder */ public function setNotificationsInvitedToChannelEnabled(bool $notificationsInvitedToChannelEnabled): self { $this->options['notificationsInvitedToChannelEnabled'] = $notificationsInvitedToChannelEnabled; return $this; } /** * The notifications.invited_to_channel.template * * @param string $notificationsInvitedToChannelTemplate The * notifications.invited_to_channel.template * @return $this Fluent Builder */ public function setNotificationsInvitedToChannelTemplate(string $notificationsInvitedToChannelTemplate): self { $this->options['notificationsInvitedToChannelTemplate'] = $notificationsInvitedToChannelTemplate; return $this; } /** * The pre_webhook_url * * @param string $preWebhookUrl The pre_webhook_url * @return $this Fluent Builder */ public function setPreWebhookUrl(string $preWebhookUrl): self { $this->options['preWebhookUrl'] = $preWebhookUrl; return $this; } /** * The post_webhook_url * * @param string $postWebhookUrl The post_webhook_url * @return $this Fluent Builder */ public function setPostWebhookUrl(string $postWebhookUrl): self { $this->options['postWebhookUrl'] = $postWebhookUrl; return $this; } /** * The webhook_method * * @param string $webhookMethod The webhook_method * @return $this Fluent Builder */ public function setWebhookMethod(string $webhookMethod): self { $this->options['webhookMethod'] = $webhookMethod; return $this; } /** * The webhook_filters * * @param string[] $webhookFilters The webhook_filters * @return $this Fluent Builder */ public function setWebhookFilters(array $webhookFilters): self { $this->options['webhookFilters'] = $webhookFilters; return $this; } /** * The webhooks.on_message_send.url * * @param string $webhooksOnMessageSendUrl The webhooks.on_message_send.url * @return $this Fluent Builder */ public function setWebhooksOnMessageSendUrl(string $webhooksOnMessageSendUrl): self { $this->options['webhooksOnMessageSendUrl'] = $webhooksOnMessageSendUrl; return $this; } /** * The webhooks.on_message_send.method * * @param string $webhooksOnMessageSendMethod The * webhooks.on_message_send.method * @return $this Fluent Builder */ public function setWebhooksOnMessageSendMethod(string $webhooksOnMessageSendMethod): self { $this->options['webhooksOnMessageSendMethod'] = $webhooksOnMessageSendMethod; return $this; } /** * The webhooks.on_message_update.url * * @param string $webhooksOnMessageUpdateUrl The webhooks.on_message_update.url * @return $this Fluent Builder */ public function setWebhooksOnMessageUpdateUrl(string $webhooksOnMessageUpdateUrl): self { $this->options['webhooksOnMessageUpdateUrl'] = $webhooksOnMessageUpdateUrl; return $this; } /** * The webhooks.on_message_update.method * * @param string $webhooksOnMessageUpdateMethod The * webhooks.on_message_update.method * @return $this Fluent Builder */ public function setWebhooksOnMessageUpdateMethod(string $webhooksOnMessageUpdateMethod): self { $this->options['webhooksOnMessageUpdateMethod'] = $webhooksOnMessageUpdateMethod; return $this; } /** * The webhooks.on_message_remove.url * * @param string $webhooksOnMessageRemoveUrl The webhooks.on_message_remove.url * @return $this Fluent Builder */ public function setWebhooksOnMessageRemoveUrl(string $webhooksOnMessageRemoveUrl): self { $this->options['webhooksOnMessageRemoveUrl'] = $webhooksOnMessageRemoveUrl; return $this; } /** * The webhooks.on_message_remove.method * * @param string $webhooksOnMessageRemoveMethod The * webhooks.on_message_remove.method * @return $this Fluent Builder */ public function setWebhooksOnMessageRemoveMethod(string $webhooksOnMessageRemoveMethod): self { $this->options['webhooksOnMessageRemoveMethod'] = $webhooksOnMessageRemoveMethod; return $this; } /** * The webhooks.on_channel_add.url * * @param string $webhooksOnChannelAddUrl The webhooks.on_channel_add.url * @return $this Fluent Builder */ public function setWebhooksOnChannelAddUrl(string $webhooksOnChannelAddUrl): self { $this->options['webhooksOnChannelAddUrl'] = $webhooksOnChannelAddUrl; return $this; } /** * The webhooks.on_channel_add.method * * @param string $webhooksOnChannelAddMethod The webhooks.on_channel_add.method * @return $this Fluent Builder */ public function setWebhooksOnChannelAddMethod(string $webhooksOnChannelAddMethod): self { $this->options['webhooksOnChannelAddMethod'] = $webhooksOnChannelAddMethod; return $this; } /** * The webhooks.on_channel_destroy.url * * @param string $webhooksOnChannelDestroyUrl The * webhooks.on_channel_destroy.url * @return $this Fluent Builder */ public function setWebhooksOnChannelDestroyUrl(string $webhooksOnChannelDestroyUrl): self { $this->options['webhooksOnChannelDestroyUrl'] = $webhooksOnChannelDestroyUrl; return $this; } /** * The webhooks.on_channel_destroy.method * * @param string $webhooksOnChannelDestroyMethod The * webhooks.on_channel_destroy.method * @return $this Fluent Builder */ public function setWebhooksOnChannelDestroyMethod(string $webhooksOnChannelDestroyMethod): self { $this->options['webhooksOnChannelDestroyMethod'] = $webhooksOnChannelDestroyMethod; return $this; } /** * The webhooks.on_channel_update.url * * @param string $webhooksOnChannelUpdateUrl The webhooks.on_channel_update.url * @return $this Fluent Builder */ public function setWebhooksOnChannelUpdateUrl(string $webhooksOnChannelUpdateUrl): self { $this->options['webhooksOnChannelUpdateUrl'] = $webhooksOnChannelUpdateUrl; return $this; } /** * The webhooks.on_channel_update.method * * @param string $webhooksOnChannelUpdateMethod The * webhooks.on_channel_update.method * @return $this Fluent Builder */ public function setWebhooksOnChannelUpdateMethod(string $webhooksOnChannelUpdateMethod): self { $this->options['webhooksOnChannelUpdateMethod'] = $webhooksOnChannelUpdateMethod; return $this; } /** * The webhooks.on_member_add.url * * @param string $webhooksOnMemberAddUrl The webhooks.on_member_add.url * @return $this Fluent Builder */ public function setWebhooksOnMemberAddUrl(string $webhooksOnMemberAddUrl): self { $this->options['webhooksOnMemberAddUrl'] = $webhooksOnMemberAddUrl; return $this; } /** * The webhooks.on_member_add.method * * @param string $webhooksOnMemberAddMethod The webhooks.on_member_add.method * @return $this Fluent Builder */ public function setWebhooksOnMemberAddMethod(string $webhooksOnMemberAddMethod): self { $this->options['webhooksOnMemberAddMethod'] = $webhooksOnMemberAddMethod; return $this; } /** * The webhooks.on_member_remove.url * * @param string $webhooksOnMemberRemoveUrl The webhooks.on_member_remove.url * @return $this Fluent Builder */ public function setWebhooksOnMemberRemoveUrl(string $webhooksOnMemberRemoveUrl): self { $this->options['webhooksOnMemberRemoveUrl'] = $webhooksOnMemberRemoveUrl; return $this; } /** * The webhooks.on_member_remove.method * * @param string $webhooksOnMemberRemoveMethod The * webhooks.on_member_remove.method * @return $this Fluent Builder */ public function setWebhooksOnMemberRemoveMethod(string $webhooksOnMemberRemoveMethod): self { $this->options['webhooksOnMemberRemoveMethod'] = $webhooksOnMemberRemoveMethod; return $this; } /** * The webhooks.on_message_sent.url * * @param string $webhooksOnMessageSentUrl The webhooks.on_message_sent.url * @return $this Fluent Builder */ public function setWebhooksOnMessageSentUrl(string $webhooksOnMessageSentUrl): self { $this->options['webhooksOnMessageSentUrl'] = $webhooksOnMessageSentUrl; return $this; } /** * The webhooks.on_message_sent.method * * @param string $webhooksOnMessageSentMethod The * webhooks.on_message_sent.method * @return $this Fluent Builder */ public function setWebhooksOnMessageSentMethod(string $webhooksOnMessageSentMethod): self { $this->options['webhooksOnMessageSentMethod'] = $webhooksOnMessageSentMethod; return $this; } /** * The webhooks.on_message_updated.url * * @param string $webhooksOnMessageUpdatedUrl The * webhooks.on_message_updated.url * @return $this Fluent Builder */ public function setWebhooksOnMessageUpdatedUrl(string $webhooksOnMessageUpdatedUrl): self { $this->options['webhooksOnMessageUpdatedUrl'] = $webhooksOnMessageUpdatedUrl; return $this; } /** * The webhooks.on_message_updated.method * * @param string $webhooksOnMessageUpdatedMethod The * webhooks.on_message_updated.method * @return $this Fluent Builder */ public function setWebhooksOnMessageUpdatedMethod(string $webhooksOnMessageUpdatedMethod): self { $this->options['webhooksOnMessageUpdatedMethod'] = $webhooksOnMessageUpdatedMethod; return $this; } /** * The webhooks.on_message_removed.url * * @param string $webhooksOnMessageRemovedUrl The * webhooks.on_message_removed.url * @return $this Fluent Builder */ public function setWebhooksOnMessageRemovedUrl(string $webhooksOnMessageRemovedUrl): self { $this->options['webhooksOnMessageRemovedUrl'] = $webhooksOnMessageRemovedUrl; return $this; } /** * The webhooks.on_message_removed.method * * @param string $webhooksOnMessageRemovedMethod The * webhooks.on_message_removed.method * @return $this Fluent Builder */ public function setWebhooksOnMessageRemovedMethod(string $webhooksOnMessageRemovedMethod): self { $this->options['webhooksOnMessageRemovedMethod'] = $webhooksOnMessageRemovedMethod; return $this; } /** * The webhooks.on_channel_added.url * * @param string $webhooksOnChannelAddedUrl The webhooks.on_channel_added.url * @return $this Fluent Builder */ public function setWebhooksOnChannelAddedUrl(string $webhooksOnChannelAddedUrl): self { $this->options['webhooksOnChannelAddedUrl'] = $webhooksOnChannelAddedUrl; return $this; } /** * The webhooks.on_channel_added.method * * @param string $webhooksOnChannelAddedMethod The * webhooks.on_channel_added.method * @return $this Fluent Builder */ public function setWebhooksOnChannelAddedMethod(string $webhooksOnChannelAddedMethod): self { $this->options['webhooksOnChannelAddedMethod'] = $webhooksOnChannelAddedMethod; return $this; } /** * The webhooks.on_channel_destroyed.url * * @param string $webhooksOnChannelDestroyedUrl The * webhooks.on_channel_destroyed.url * @return $this Fluent Builder */ public function setWebhooksOnChannelDestroyedUrl(string $webhooksOnChannelDestroyedUrl): self { $this->options['webhooksOnChannelDestroyedUrl'] = $webhooksOnChannelDestroyedUrl; return $this; } /** * The webhooks.on_channel_destroyed.method * * @param string $webhooksOnChannelDestroyedMethod The * webhooks.on_channel_destroyed.method * @return $this Fluent Builder */ public function setWebhooksOnChannelDestroyedMethod(string $webhooksOnChannelDestroyedMethod): self { $this->options['webhooksOnChannelDestroyedMethod'] = $webhooksOnChannelDestroyedMethod; return $this; } /** * The webhooks.on_channel_updated.url * * @param string $webhooksOnChannelUpdatedUrl The * webhooks.on_channel_updated.url * @return $this Fluent Builder */ public function setWebhooksOnChannelUpdatedUrl(string $webhooksOnChannelUpdatedUrl): self { $this->options['webhooksOnChannelUpdatedUrl'] = $webhooksOnChannelUpdatedUrl; return $this; } /** * The webhooks.on_channel_updated.method * * @param string $webhooksOnChannelUpdatedMethod The * webhooks.on_channel_updated.method * @return $this Fluent Builder */ public function setWebhooksOnChannelUpdatedMethod(string $webhooksOnChannelUpdatedMethod): self { $this->options['webhooksOnChannelUpdatedMethod'] = $webhooksOnChannelUpdatedMethod; return $this; } /** * The webhooks.on_member_added.url * * @param string $webhooksOnMemberAddedUrl The webhooks.on_member_added.url * @return $this Fluent Builder */ public function setWebhooksOnMemberAddedUrl(string $webhooksOnMemberAddedUrl): self { $this->options['webhooksOnMemberAddedUrl'] = $webhooksOnMemberAddedUrl; return $this; } /** * The webhooks.on_member_added.method * * @param string $webhooksOnMemberAddedMethod The * webhooks.on_member_added.method * @return $this Fluent Builder */ public function setWebhooksOnMemberAddedMethod(string $webhooksOnMemberAddedMethod): self { $this->options['webhooksOnMemberAddedMethod'] = $webhooksOnMemberAddedMethod; return $this; } /** * The webhooks.on_member_removed.url * * @param string $webhooksOnMemberRemovedUrl The webhooks.on_member_removed.url * @return $this Fluent Builder */ public function setWebhooksOnMemberRemovedUrl(string $webhooksOnMemberRemovedUrl): self { $this->options['webhooksOnMemberRemovedUrl'] = $webhooksOnMemberRemovedUrl; return $this; } /** * The webhooks.on_member_removed.method * * @param string $webhooksOnMemberRemovedMethod The * webhooks.on_member_removed.method * @return $this Fluent Builder */ public function setWebhooksOnMemberRemovedMethod(string $webhooksOnMemberRemovedMethod): self { $this->options['webhooksOnMemberRemovedMethod'] = $webhooksOnMemberRemovedMethod; return $this; } /** * The limits.channel_members * * @param int $limitsChannelMembers The limits.channel_members * @return $this Fluent Builder */ public function setLimitsChannelMembers(int $limitsChannelMembers): self { $this->options['limitsChannelMembers'] = $limitsChannelMembers; return $this; } /** * The limits.user_channels * * @param int $limitsUserChannels The limits.user_channels * @return $this Fluent Builder */ public function setLimitsUserChannels(int $limitsUserChannels): self { $this->options['limitsUserChannels'] = $limitsUserChannels; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V1.UpdateServiceOptions ' . $options . ']'; } }src/Twilio/Rest/IpMessaging/V1/CredentialOptions.php000064400000016113150515725670016371 0ustar00options['friendlyName'] = $friendlyName; $this->options['certificate'] = $certificate; $this->options['privateKey'] = $privateKey; $this->options['sandbox'] = $sandbox; $this->options['apiKey'] = $apiKey; $this->options['secret'] = $secret; } /** * The friendly_name * * @param string $friendlyName The friendly_name * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The certificate * * @param string $certificate The certificate * @return $this Fluent Builder */ public function setCertificate(string $certificate): self { $this->options['certificate'] = $certificate; return $this; } /** * The private_key * * @param string $privateKey The private_key * @return $this Fluent Builder */ public function setPrivateKey(string $privateKey): self { $this->options['privateKey'] = $privateKey; return $this; } /** * The sandbox * * @param bool $sandbox The sandbox * @return $this Fluent Builder */ public function setSandbox(bool $sandbox): self { $this->options['sandbox'] = $sandbox; return $this; } /** * The api_key * * @param string $apiKey The api_key * @return $this Fluent Builder */ public function setApiKey(string $apiKey): self { $this->options['apiKey'] = $apiKey; return $this; } /** * The secret * * @param string $secret The secret * @return $this Fluent Builder */ public function setSecret(string $secret): self { $this->options['secret'] = $secret; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V1.CreateCredentialOptions ' . $options . ']'; } } class UpdateCredentialOptions extends Options { /** * @param string $friendlyName The friendly_name * @param string $certificate The certificate * @param string $privateKey The private_key * @param bool $sandbox The sandbox * @param string $apiKey The api_key * @param string $secret The secret */ public function __construct(string $friendlyName = Values::NONE, string $certificate = Values::NONE, string $privateKey = Values::NONE, bool $sandbox = Values::NONE, string $apiKey = Values::NONE, string $secret = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['certificate'] = $certificate; $this->options['privateKey'] = $privateKey; $this->options['sandbox'] = $sandbox; $this->options['apiKey'] = $apiKey; $this->options['secret'] = $secret; } /** * The friendly_name * * @param string $friendlyName The friendly_name * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The certificate * * @param string $certificate The certificate * @return $this Fluent Builder */ public function setCertificate(string $certificate): self { $this->options['certificate'] = $certificate; return $this; } /** * The private_key * * @param string $privateKey The private_key * @return $this Fluent Builder */ public function setPrivateKey(string $privateKey): self { $this->options['privateKey'] = $privateKey; return $this; } /** * The sandbox * * @param bool $sandbox The sandbox * @return $this Fluent Builder */ public function setSandbox(bool $sandbox): self { $this->options['sandbox'] = $sandbox; return $this; } /** * The api_key * * @param string $apiKey The api_key * @return $this Fluent Builder */ public function setApiKey(string $apiKey): self { $this->options['apiKey'] = $apiKey; return $this; } /** * The secret * * @param string $secret The secret * @return $this Fluent Builder */ public function setSecret(string $secret): self { $this->options['secret'] = $secret; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V1.UpdateCredentialOptions ' . $options . ']'; } }src/Twilio/Rest/IpMessaging/V1/ServicePage.php000064400000002210150515725670015131 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ServiceInstance \Twilio\Rest\IpMessaging\V1\ServiceInstance */ public function buildInstance(array $payload): ServiceInstance { return new ServiceInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V1.ServicePage]'; } }src/Twilio/Rest/IpMessaging/V1/CredentialPage.php000064400000002232150515725670015607 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CredentialInstance \Twilio\Rest\IpMessaging\V1\CredentialInstance */ public function buildInstance(array $payload): CredentialInstance { return new CredentialInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V1.CredentialPage]'; } }src/Twilio/Rest/IpMessaging/V1/ServiceList.php000064400000011773150515725670015206 0ustar00solution = []; $this->uri = '/Services'; } /** * Create the ServiceInstance * * @param string $friendlyName The friendly_name * @return ServiceInstance Created ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName): ServiceInstance { $data = Values::of(['FriendlyName' => $friendlyName, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ServiceInstance($this->version, $payload); } /** * Streams ServiceInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ServiceInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return ServiceInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of ServiceInstance records from the API. * Request is executed immediately * * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return ServicePage Page of ServiceInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ServicePage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ServicePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ServiceInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ServicePage Page of ServiceInstance */ public function getPage(string $targetUrl): ServicePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ServicePage($this->version, $response, $this->solution); } /** * Constructs a ServiceContext * * @param string $sid The sid */ public function getContext(string $sid): ServiceContext { return new ServiceContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V1.ServiceList]'; } }src/Twilio/Rest/IpMessaging/V1/CredentialInstance.php000064400000007711150515725670016506 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'type' => Values::array_get($payload, 'type'), 'sandbox' => Values::array_get($payload, 'sandbox'), '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 = ['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 CredentialContext Context for this CredentialInstance */ protected function proxy(): CredentialContext { if (!$this->context) { $this->context = new CredentialContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the CredentialInstance * * @return CredentialInstance Fetched CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CredentialInstance { return $this->proxy()->fetch(); } /** * Update the CredentialInstance * * @param array|Options $options Optional Arguments * @return CredentialInstance Updated CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): CredentialInstance { return $this->proxy()->update($options); } /** * Delete the CredentialInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V1.CredentialInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V1.php000064400000005120150515725670012737 0ustar00version = 'v1'; } protected function getCredentials(): CredentialList { if (!$this->_credentials) { $this->_credentials = new CredentialList($this); } return $this->_credentials; } protected function getServices(): ServiceList { if (!$this->_services) { $this->_services = new ServiceList($this); } return $this->_services; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.IpMessaging.V1]'; } }src/Twilio/Rest/IpMessaging/V2.php000064400000005120150515725670012740 0ustar00version = 'v2'; } protected function getCredentials(): CredentialList { if (!$this->_credentials) { $this->_credentials = new CredentialList($this); } return $this->_credentials; } protected function getServices(): ServiceList { if (!$this->_services) { $this->_services = new ServiceList($this); } return $this->_services; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.IpMessaging.V2]'; } }src/Twilio/Rest/IpMessaging/V2/ServiceInstance.php000064400000015132150515725670016031 0ustar00properties = [ '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')), 'defaultServiceRoleSid' => Values::array_get($payload, 'default_service_role_sid'), 'defaultChannelRoleSid' => Values::array_get($payload, 'default_channel_role_sid'), 'defaultChannelCreatorRoleSid' => Values::array_get($payload, 'default_channel_creator_role_sid'), 'readStatusEnabled' => Values::array_get($payload, 'read_status_enabled'), 'reachabilityEnabled' => Values::array_get($payload, 'reachability_enabled'), 'typingIndicatorTimeout' => Values::array_get($payload, 'typing_indicator_timeout'), 'consumptionReportInterval' => Values::array_get($payload, 'consumption_report_interval'), 'limits' => Values::array_get($payload, 'limits'), 'preWebhookUrl' => Values::array_get($payload, 'pre_webhook_url'), 'postWebhookUrl' => Values::array_get($payload, 'post_webhook_url'), 'webhookMethod' => Values::array_get($payload, 'webhook_method'), 'webhookFilters' => Values::array_get($payload, 'webhook_filters'), 'preWebhookRetryCount' => Values::array_get($payload, 'pre_webhook_retry_count'), 'postWebhookRetryCount' => Values::array_get($payload, 'post_webhook_retry_count'), 'notifications' => Values::array_get($payload, 'notifications'), 'media' => Values::array_get($payload, 'media'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 ServiceContext Context for this ServiceInstance */ protected function proxy(): ServiceContext { if (!$this->context) { $this->context = new ServiceContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the ServiceInstance * * @return ServiceInstance Fetched ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ServiceInstance { return $this->proxy()->fetch(); } /** * Delete the ServiceInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the ServiceInstance * * @param array|Options $options Optional Arguments * @return ServiceInstance Updated ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ServiceInstance { return $this->proxy()->update($options); } /** * Access the channels */ protected function getChannels(): ChannelList { return $this->proxy()->channels; } /** * Access the roles */ protected function getRoles(): RoleList { return $this->proxy()->roles; } /** * Access the users */ protected function getUsers(): UserList { return $this->proxy()->users; } /** * Access the bindings */ protected function getBindings(): BindingList { return $this->proxy()->bindings; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V2.ServiceInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V2/CredentialList.php000064400000013027150515725670015653 0ustar00solution = []; $this->uri = '/Credentials'; } /** * Streams CredentialInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads CredentialInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return CredentialInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of CredentialInstance records from the API. * Request is executed immediately * * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return CredentialPage Page of CredentialInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): CredentialPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new CredentialPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of CredentialInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return CredentialPage Page of CredentialInstance */ public function getPage(string $targetUrl): CredentialPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new CredentialPage($this->version, $response, $this->solution); } /** * Create the CredentialInstance * * @param string $type The type * @param array|Options $options Optional Arguments * @return CredentialInstance Created CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $type, array $options = []): CredentialInstance { $options = new Values($options); $data = Values::of([ 'Type' => $type, 'FriendlyName' => $options['friendlyName'], 'Certificate' => $options['certificate'], 'PrivateKey' => $options['privateKey'], 'Sandbox' => Serialize::booleanToString($options['sandbox']), 'ApiKey' => $options['apiKey'], 'Secret' => $options['secret'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new CredentialInstance($this->version, $payload); } /** * Constructs a CredentialContext * * @param string $sid The sid */ public function getContext(string $sid): CredentialContext { return new CredentialContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V2.CredentialList]'; } }src/Twilio/Rest/IpMessaging/V2/CredentialContext.php000064400000005214150515725670016363 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Credentials/' . \rawurlencode($sid) . ''; } /** * Fetch the CredentialInstance * * @return CredentialInstance Fetched CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CredentialInstance { $payload = $this->version->fetch('GET', $this->uri); return new CredentialInstance($this->version, $payload, $this->solution['sid']); } /** * Update the CredentialInstance * * @param array|Options $options Optional Arguments * @return CredentialInstance Updated CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): CredentialInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'Certificate' => $options['certificate'], 'PrivateKey' => $options['privateKey'], 'Sandbox' => Serialize::booleanToString($options['sandbox']), 'ApiKey' => $options['apiKey'], 'Secret' => $options['secret'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new CredentialInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the CredentialInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V2.CredentialContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V2/Service/BindingList.php000064400000012320150515725670016546 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Bindings'; } /** * Streams BindingInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param array|Options $options Optional Arguments * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads BindingInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param array|Options $options Optional Arguments * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return BindingInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of BindingInstance records from the API. * Request is executed immediately * * @param array|Options $options Optional Arguments * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return BindingPage Page of BindingInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): BindingPage { $options = new Values($options); $params = Values::of([ 'BindingType' => Serialize::map($options['bindingType'], function($e) { return $e; }), 'Identity' => Serialize::map($options['identity'], function($e) { return $e; }), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new BindingPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of BindingInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return BindingPage Page of BindingInstance */ public function getPage(string $targetUrl): BindingPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new BindingPage($this->version, $response, $this->solution); } /** * Constructs a BindingContext * * @param string $sid The sid */ public function getContext(string $sid): BindingContext { return new BindingContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V2.BindingList]'; } }src/Twilio/Rest/IpMessaging/V2/Service/BindingContext.php000064400000003670150515725670017267 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Bindings/' . \rawurlencode($sid) . ''; } /** * Fetch the BindingInstance * * @return BindingInstance Fetched BindingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): BindingInstance { $payload = $this->version->fetch('GET', $this->uri); return new BindingInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Delete the BindingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V2.BindingContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V2/Service/ChannelContext.php000064400000015215150515725670017263 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($sid) . ''; } /** * Fetch the ChannelInstance * * @return ChannelInstance Fetched ChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ChannelInstance { $payload = $this->version->fetch('GET', $this->uri); return new ChannelInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Delete the ChannelInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { $options = new Values($options); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); return $this->version->delete('DELETE', $this->uri, [], [], $headers); } /** * Update the ChannelInstance * * @param array|Options $options Optional Arguments * @return ChannelInstance Updated ChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ChannelInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'UniqueName' => $options['uniqueName'], 'Attributes' => $options['attributes'], 'DateCreated' => Serialize::iso8601DateTime($options['dateCreated']), 'DateUpdated' => Serialize::iso8601DateTime($options['dateUpdated']), 'CreatedBy' => $options['createdBy'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->update('POST', $this->uri, [], $data, $headers); return new ChannelInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Access the members */ protected function getMembers(): MemberList { if (!$this->_members) { $this->_members = new MemberList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_members; } /** * Access the messages */ protected function getMessages(): MessageList { if (!$this->_messages) { $this->_messages = new MessageList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_messages; } /** * Access the invites */ protected function getInvites(): InviteList { if (!$this->_invites) { $this->_invites = new InviteList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_invites; } /** * Access the webhooks */ protected function getWebhooks(): WebhookList { if (!$this->_webhooks) { $this->_webhooks = new WebhookList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_webhooks; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V2.ChannelContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V2/Service/UserPage.php000064400000002245150515725670016060 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return UserInstance \Twilio\Rest\IpMessaging\V2\Service\UserInstance */ public function buildInstance(array $payload): UserInstance { return new UserInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V2.UserPage]'; } }src/Twilio/Rest/IpMessaging/V2/Service/ChannelOptions.php000064400000030172150515725670017271 0ustar00options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V2.DeleteChannelOptions ' . $options . ']'; } } class CreateChannelOptions extends Options { /** * @param string $friendlyName The friendly_name * @param string $uniqueName The unique_name * @param string $attributes The attributes * @param string $type The type * @param \DateTime $dateCreated The date_created * @param \DateTime $dateUpdated The date_updated * @param string $createdBy The created_by * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header */ public function __construct(string $friendlyName = Values::NONE, string $uniqueName = Values::NONE, string $attributes = Values::NONE, string $type = Values::NONE, \DateTime $dateCreated = Values::NONE, \DateTime $dateUpdated = Values::NONE, string $createdBy = Values::NONE, string $xTwilioWebhookEnabled = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['uniqueName'] = $uniqueName; $this->options['attributes'] = $attributes; $this->options['type'] = $type; $this->options['dateCreated'] = $dateCreated; $this->options['dateUpdated'] = $dateUpdated; $this->options['createdBy'] = $createdBy; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The friendly_name * * @param string $friendlyName The friendly_name * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The unique_name * * @param string $uniqueName The unique_name * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * The attributes * * @param string $attributes The attributes * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The type * * @param string $type The type * @return $this Fluent Builder */ public function setType(string $type): self { $this->options['type'] = $type; return $this; } /** * The date_created * * @param \DateTime $dateCreated The date_created * @return $this Fluent Builder */ public function setDateCreated(\DateTime $dateCreated): self { $this->options['dateCreated'] = $dateCreated; return $this; } /** * The date_updated * * @param \DateTime $dateUpdated The date_updated * @return $this Fluent Builder */ public function setDateUpdated(\DateTime $dateUpdated): self { $this->options['dateUpdated'] = $dateUpdated; return $this; } /** * The created_by * * @param string $createdBy The created_by * @return $this Fluent Builder */ public function setCreatedBy(string $createdBy): self { $this->options['createdBy'] = $createdBy; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V2.CreateChannelOptions ' . $options . ']'; } } class ReadChannelOptions extends Options { /** * @param string[] $type The type */ public function __construct(array $type = Values::ARRAY_NONE) { $this->options['type'] = $type; } /** * The type * * @param string[] $type The type * @return $this Fluent Builder */ public function setType(array $type): self { $this->options['type'] = $type; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V2.ReadChannelOptions ' . $options . ']'; } } class UpdateChannelOptions extends Options { /** * @param string $friendlyName The friendly_name * @param string $uniqueName The unique_name * @param string $attributes The attributes * @param \DateTime $dateCreated The date_created * @param \DateTime $dateUpdated The date_updated * @param string $createdBy The created_by * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header */ public function __construct(string $friendlyName = Values::NONE, string $uniqueName = Values::NONE, string $attributes = Values::NONE, \DateTime $dateCreated = Values::NONE, \DateTime $dateUpdated = Values::NONE, string $createdBy = Values::NONE, string $xTwilioWebhookEnabled = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['uniqueName'] = $uniqueName; $this->options['attributes'] = $attributes; $this->options['dateCreated'] = $dateCreated; $this->options['dateUpdated'] = $dateUpdated; $this->options['createdBy'] = $createdBy; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The friendly_name * * @param string $friendlyName The friendly_name * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The unique_name * * @param string $uniqueName The unique_name * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * The attributes * * @param string $attributes The attributes * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The date_created * * @param \DateTime $dateCreated The date_created * @return $this Fluent Builder */ public function setDateCreated(\DateTime $dateCreated): self { $this->options['dateCreated'] = $dateCreated; return $this; } /** * The date_updated * * @param \DateTime $dateUpdated The date_updated * @return $this Fluent Builder */ public function setDateUpdated(\DateTime $dateUpdated): self { $this->options['dateUpdated'] = $dateUpdated; return $this; } /** * The created_by * * @param string $createdBy The created_by * @return $this Fluent Builder */ public function setCreatedBy(string $createdBy): self { $this->options['createdBy'] = $createdBy; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V2.UpdateChannelOptions ' . $options . ']'; } }src/Twilio/Rest/IpMessaging/V2/Service/UserContext.php000064400000012205150515725670016625 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Users/' . \rawurlencode($sid) . ''; } /** * Fetch the UserInstance * * @return UserInstance Fetched UserInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): UserInstance { $payload = $this->version->fetch('GET', $this->uri); return new UserInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Delete the UserInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the UserInstance * * @param array|Options $options Optional Arguments * @return UserInstance Updated UserInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): UserInstance { $options = new Values($options); $data = Values::of([ 'RoleSid' => $options['roleSid'], 'Attributes' => $options['attributes'], 'FriendlyName' => $options['friendlyName'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->update('POST', $this->uri, [], $data, $headers); return new UserInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Access the userChannels */ protected function getUserChannels(): UserChannelList { if (!$this->_userChannels) { $this->_userChannels = new UserChannelList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_userChannels; } /** * Access the userBindings */ protected function getUserBindings(): UserBindingList { if (!$this->_userBindings) { $this->_userBindings = new UserBindingList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_userBindings; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V2.UserContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V2/Service/RoleList.php000064400000012631150515725670016102 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Roles'; } /** * Create the RoleInstance * * @param string $friendlyName The friendly_name * @param string $type The type * @param string[] $permission The permission * @return RoleInstance Created RoleInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, string $type, array $permission): RoleInstance { $data = Values::of([ 'FriendlyName' => $friendlyName, 'Type' => $type, 'Permission' => Serialize::map($permission, function($e) { return $e; }), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new RoleInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Streams RoleInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads RoleInstance 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 RoleInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of RoleInstance 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 RolePage Page of RoleInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): RolePage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new RolePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of RoleInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return RolePage Page of RoleInstance */ public function getPage(string $targetUrl): RolePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new RolePage($this->version, $response, $this->solution); } /** * Constructs a RoleContext * * @param string $sid The sid */ public function getContext(string $sid): RoleContext { return new RoleContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V2.RoleList]'; } }src/Twilio/Rest/IpMessaging/V2/Service/UserOptions.php000064400000014105150515725670016635 0ustar00options['roleSid'] = $roleSid; $this->options['attributes'] = $attributes; $this->options['friendlyName'] = $friendlyName; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The role_sid * * @param string $roleSid The role_sid * @return $this Fluent Builder */ public function setRoleSid(string $roleSid): self { $this->options['roleSid'] = $roleSid; return $this; } /** * The attributes * * @param string $attributes The attributes * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The friendly_name * * @param string $friendlyName The friendly_name * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V2.CreateUserOptions ' . $options . ']'; } } class UpdateUserOptions extends Options { /** * @param string $roleSid The role_sid * @param string $attributes The attributes * @param string $friendlyName The friendly_name * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header */ public function __construct(string $roleSid = Values::NONE, string $attributes = Values::NONE, string $friendlyName = Values::NONE, string $xTwilioWebhookEnabled = Values::NONE) { $this->options['roleSid'] = $roleSid; $this->options['attributes'] = $attributes; $this->options['friendlyName'] = $friendlyName; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The role_sid * * @param string $roleSid The role_sid * @return $this Fluent Builder */ public function setRoleSid(string $roleSid): self { $this->options['roleSid'] = $roleSid; return $this; } /** * The attributes * * @param string $attributes The attributes * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The friendly_name * * @param string $friendlyName The friendly_name * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V2.UpdateUserOptions ' . $options . ']'; } }src/Twilio/Rest/IpMessaging/V2/Service/RoleContext.php000064400000005052150515725670016612 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Roles/' . \rawurlencode($sid) . ''; } /** * Fetch the RoleInstance * * @return RoleInstance Fetched RoleInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RoleInstance { $payload = $this->version->fetch('GET', $this->uri); return new RoleInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Delete the RoleInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the RoleInstance * * @param string[] $permission The permission * @return RoleInstance Updated RoleInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $permission): RoleInstance { $data = Values::of(['Permission' => Serialize::map($permission, function($e) { return $e; }), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new RoleInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V2.RoleContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V2/Service/RoleInstance.php000064400000010215150515725670016727 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'type' => Values::array_get($payload, 'type'), 'permissions' => Values::array_get($payload, 'permissions'), '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 = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return RoleContext Context for this RoleInstance */ protected function proxy(): RoleContext { if (!$this->context) { $this->context = new RoleContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the RoleInstance * * @return RoleInstance Fetched RoleInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RoleInstance { return $this->proxy()->fetch(); } /** * Delete the RoleInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the RoleInstance * * @param string[] $permission The permission * @return RoleInstance Updated RoleInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $permission): RoleInstance { return $this->proxy()->update($permission); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V2.RoleInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V2/Service/ChannelInstance.php000064400000013252150515725670017402 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'attributes' => Values::array_get($payload, 'attributes'), 'type' => Values::array_get($payload, 'type'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'createdBy' => Values::array_get($payload, 'created_by'), 'membersCount' => Values::array_get($payload, 'members_count'), 'messagesCount' => Values::array_get($payload, 'messages_count'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return ChannelContext Context for this ChannelInstance */ protected function proxy(): ChannelContext { if (!$this->context) { $this->context = new ChannelContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the ChannelInstance * * @return ChannelInstance Fetched ChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ChannelInstance { return $this->proxy()->fetch(); } /** * Delete the ChannelInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { return $this->proxy()->delete($options); } /** * Update the ChannelInstance * * @param array|Options $options Optional Arguments * @return ChannelInstance Updated ChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ChannelInstance { return $this->proxy()->update($options); } /** * Access the members */ protected function getMembers(): MemberList { return $this->proxy()->members; } /** * Access the messages */ protected function getMessages(): MessageList { return $this->proxy()->messages; } /** * Access the invites */ protected function getInvites(): InviteList { return $this->proxy()->invites; } /** * Access the webhooks */ protected function getWebhooks(): WebhookList { return $this->proxy()->webhooks; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V2.ChannelInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V2/Service/Channel/InvitePage.php000064400000002432150515725670017746 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return InviteInstance \Twilio\Rest\IpMessaging\V2\Service\Channel\InviteInstance */ public function buildInstance(array $payload): InviteInstance { return new InviteInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V2.InvitePage]'; } }src/Twilio/Rest/IpMessaging/V2/Service/Channel/MemberOptions.php000064400000031056150515725670020502 0ustar00options['roleSid'] = $roleSid; $this->options['lastConsumedMessageIndex'] = $lastConsumedMessageIndex; $this->options['lastConsumptionTimestamp'] = $lastConsumptionTimestamp; $this->options['dateCreated'] = $dateCreated; $this->options['dateUpdated'] = $dateUpdated; $this->options['attributes'] = $attributes; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The role_sid * * @param string $roleSid The role_sid * @return $this Fluent Builder */ public function setRoleSid(string $roleSid): self { $this->options['roleSid'] = $roleSid; return $this; } /** * The last_consumed_message_index * * @param int $lastConsumedMessageIndex The last_consumed_message_index * @return $this Fluent Builder */ public function setLastConsumedMessageIndex(int $lastConsumedMessageIndex): self { $this->options['lastConsumedMessageIndex'] = $lastConsumedMessageIndex; return $this; } /** * The last_consumption_timestamp * * @param \DateTime $lastConsumptionTimestamp The last_consumption_timestamp * @return $this Fluent Builder */ public function setLastConsumptionTimestamp(\DateTime $lastConsumptionTimestamp): self { $this->options['lastConsumptionTimestamp'] = $lastConsumptionTimestamp; return $this; } /** * The date_created * * @param \DateTime $dateCreated The date_created * @return $this Fluent Builder */ public function setDateCreated(\DateTime $dateCreated): self { $this->options['dateCreated'] = $dateCreated; return $this; } /** * The date_updated * * @param \DateTime $dateUpdated The date_updated * @return $this Fluent Builder */ public function setDateUpdated(\DateTime $dateUpdated): self { $this->options['dateUpdated'] = $dateUpdated; return $this; } /** * The attributes * * @param string $attributes The attributes * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V2.CreateMemberOptions ' . $options . ']'; } } class ReadMemberOptions extends Options { /** * @param string[] $identity The identity */ public function __construct(array $identity = Values::ARRAY_NONE) { $this->options['identity'] = $identity; } /** * The identity * * @param string[] $identity The identity * @return $this Fluent Builder */ public function setIdentity(array $identity): self { $this->options['identity'] = $identity; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V2.ReadMemberOptions ' . $options . ']'; } } class DeleteMemberOptions extends Options { /** * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header */ public function __construct(string $xTwilioWebhookEnabled = Values::NONE) { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V2.DeleteMemberOptions ' . $options . ']'; } } class UpdateMemberOptions extends Options { /** * @param string $roleSid The role_sid * @param int $lastConsumedMessageIndex The last_consumed_message_index * @param \DateTime $lastConsumptionTimestamp The last_consumption_timestamp * @param \DateTime $dateCreated The date_created * @param \DateTime $dateUpdated The date_updated * @param string $attributes The attributes * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header */ public function __construct(string $roleSid = Values::NONE, int $lastConsumedMessageIndex = Values::NONE, \DateTime $lastConsumptionTimestamp = Values::NONE, \DateTime $dateCreated = Values::NONE, \DateTime $dateUpdated = Values::NONE, string $attributes = Values::NONE, string $xTwilioWebhookEnabled = Values::NONE) { $this->options['roleSid'] = $roleSid; $this->options['lastConsumedMessageIndex'] = $lastConsumedMessageIndex; $this->options['lastConsumptionTimestamp'] = $lastConsumptionTimestamp; $this->options['dateCreated'] = $dateCreated; $this->options['dateUpdated'] = $dateUpdated; $this->options['attributes'] = $attributes; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The role_sid * * @param string $roleSid The role_sid * @return $this Fluent Builder */ public function setRoleSid(string $roleSid): self { $this->options['roleSid'] = $roleSid; return $this; } /** * The last_consumed_message_index * * @param int $lastConsumedMessageIndex The last_consumed_message_index * @return $this Fluent Builder */ public function setLastConsumedMessageIndex(int $lastConsumedMessageIndex): self { $this->options['lastConsumedMessageIndex'] = $lastConsumedMessageIndex; return $this; } /** * The last_consumption_timestamp * * @param \DateTime $lastConsumptionTimestamp The last_consumption_timestamp * @return $this Fluent Builder */ public function setLastConsumptionTimestamp(\DateTime $lastConsumptionTimestamp): self { $this->options['lastConsumptionTimestamp'] = $lastConsumptionTimestamp; return $this; } /** * The date_created * * @param \DateTime $dateCreated The date_created * @return $this Fluent Builder */ public function setDateCreated(\DateTime $dateCreated): self { $this->options['dateCreated'] = $dateCreated; return $this; } /** * The date_updated * * @param \DateTime $dateUpdated The date_updated * @return $this Fluent Builder */ public function setDateUpdated(\DateTime $dateUpdated): self { $this->options['dateUpdated'] = $dateUpdated; return $this; } /** * The attributes * * @param string $attributes The attributes * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V2.UpdateMemberOptions ' . $options . ']'; } }src/Twilio/Rest/IpMessaging/V2/Service/Channel/InviteInstance.php000064400000010175150515725670020641 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'channelSid' => Values::array_get($payload, 'channel_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'identity' => Values::array_get($payload, 'identity'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'roleSid' => Values::array_get($payload, 'role_sid'), 'createdBy' => Values::array_get($payload, 'created_by'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'channelSid' => $channelSid, '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 InviteContext Context for this InviteInstance */ protected function proxy(): InviteContext { if (!$this->context) { $this->context = new InviteContext( $this->version, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the InviteInstance * * @return InviteInstance Fetched InviteInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): InviteInstance { return $this->proxy()->fetch(); } /** * Delete the InviteInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V2.InviteInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V2/Service/Channel/WebhookInstance.php000064400000010631150515725670020776 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'channelSid' => Values::array_get($payload, 'channel_sid'), 'type' => Values::array_get($payload, 'type'), 'url' => Values::array_get($payload, 'url'), 'configuration' => Values::array_get($payload, 'configuration'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'channelSid' => $channelSid, '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 WebhookContext Context for this WebhookInstance */ protected function proxy(): WebhookContext { if (!$this->context) { $this->context = new WebhookContext( $this->version, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the WebhookInstance * * @return WebhookInstance Fetched WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): WebhookInstance { return $this->proxy()->fetch(); } /** * Update the WebhookInstance * * @param array|Options $options Optional Arguments * @return WebhookInstance Updated WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): WebhookInstance { return $this->proxy()->update($options); } /** * Delete the WebhookInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V2.WebhookInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V2/Service/Channel/MessageInstance.php000064400000012136150515725670020766 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'attributes' => Values::array_get($payload, 'attributes'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'to' => Values::array_get($payload, 'to'), 'channelSid' => Values::array_get($payload, 'channel_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'lastUpdatedBy' => Values::array_get($payload, 'last_updated_by'), 'wasEdited' => Values::array_get($payload, 'was_edited'), 'from' => Values::array_get($payload, 'from'), 'body' => Values::array_get($payload, 'body'), 'index' => Values::array_get($payload, 'index'), 'type' => Values::array_get($payload, 'type'), 'media' => Values::array_get($payload, 'media'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'channelSid' => $channelSid, '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 MessageContext Context for this MessageInstance */ protected function proxy(): MessageContext { if (!$this->context) { $this->context = new MessageContext( $this->version, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the MessageInstance * * @return MessageInstance Fetched MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MessageInstance { return $this->proxy()->fetch(); } /** * Delete the MessageInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { return $this->proxy()->delete($options); } /** * Update the MessageInstance * * @param array|Options $options Optional Arguments * @return MessageInstance Updated MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): MessageInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V2.MessageInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V2/Service/Channel/WebhookOptions.php000064400000022362150515725670020671 0ustar00options['configurationUrl'] = $configurationUrl; $this->options['configurationMethod'] = $configurationMethod; $this->options['configurationFilters'] = $configurationFilters; $this->options['configurationTriggers'] = $configurationTriggers; $this->options['configurationFlowSid'] = $configurationFlowSid; $this->options['configurationRetryCount'] = $configurationRetryCount; } /** * The configuration.url * * @param string $configurationUrl The configuration.url * @return $this Fluent Builder */ public function setConfigurationUrl(string $configurationUrl): self { $this->options['configurationUrl'] = $configurationUrl; return $this; } /** * The configuration.method * * @param string $configurationMethod The configuration.method * @return $this Fluent Builder */ public function setConfigurationMethod(string $configurationMethod): self { $this->options['configurationMethod'] = $configurationMethod; return $this; } /** * The configuration.filters * * @param string[] $configurationFilters The configuration.filters * @return $this Fluent Builder */ public function setConfigurationFilters(array $configurationFilters): self { $this->options['configurationFilters'] = $configurationFilters; return $this; } /** * The configuration.triggers * * @param string[] $configurationTriggers The configuration.triggers * @return $this Fluent Builder */ public function setConfigurationTriggers(array $configurationTriggers): self { $this->options['configurationTriggers'] = $configurationTriggers; return $this; } /** * The configuration.flow_sid * * @param string $configurationFlowSid The configuration.flow_sid * @return $this Fluent Builder */ public function setConfigurationFlowSid(string $configurationFlowSid): self { $this->options['configurationFlowSid'] = $configurationFlowSid; return $this; } /** * The configuration.retry_count * * @param int $configurationRetryCount The configuration.retry_count * @return $this Fluent Builder */ public function setConfigurationRetryCount(int $configurationRetryCount): self { $this->options['configurationRetryCount'] = $configurationRetryCount; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V2.CreateWebhookOptions ' . $options . ']'; } } class UpdateWebhookOptions extends Options { /** * @param string $configurationUrl The configuration.url * @param string $configurationMethod The configuration.method * @param string[] $configurationFilters The configuration.filters * @param string[] $configurationTriggers The configuration.triggers * @param string $configurationFlowSid The configuration.flow_sid * @param int $configurationRetryCount The configuration.retry_count */ public function __construct(string $configurationUrl = Values::NONE, string $configurationMethod = Values::NONE, array $configurationFilters = Values::ARRAY_NONE, array $configurationTriggers = Values::ARRAY_NONE, string $configurationFlowSid = Values::NONE, int $configurationRetryCount = Values::NONE) { $this->options['configurationUrl'] = $configurationUrl; $this->options['configurationMethod'] = $configurationMethod; $this->options['configurationFilters'] = $configurationFilters; $this->options['configurationTriggers'] = $configurationTriggers; $this->options['configurationFlowSid'] = $configurationFlowSid; $this->options['configurationRetryCount'] = $configurationRetryCount; } /** * The configuration.url * * @param string $configurationUrl The configuration.url * @return $this Fluent Builder */ public function setConfigurationUrl(string $configurationUrl): self { $this->options['configurationUrl'] = $configurationUrl; return $this; } /** * The configuration.method * * @param string $configurationMethod The configuration.method * @return $this Fluent Builder */ public function setConfigurationMethod(string $configurationMethod): self { $this->options['configurationMethod'] = $configurationMethod; return $this; } /** * The configuration.filters * * @param string[] $configurationFilters The configuration.filters * @return $this Fluent Builder */ public function setConfigurationFilters(array $configurationFilters): self { $this->options['configurationFilters'] = $configurationFilters; return $this; } /** * The configuration.triggers * * @param string[] $configurationTriggers The configuration.triggers * @return $this Fluent Builder */ public function setConfigurationTriggers(array $configurationTriggers): self { $this->options['configurationTriggers'] = $configurationTriggers; return $this; } /** * The configuration.flow_sid * * @param string $configurationFlowSid The configuration.flow_sid * @return $this Fluent Builder */ public function setConfigurationFlowSid(string $configurationFlowSid): self { $this->options['configurationFlowSid'] = $configurationFlowSid; return $this; } /** * The configuration.retry_count * * @param int $configurationRetryCount The configuration.retry_count * @return $this Fluent Builder */ public function setConfigurationRetryCount(int $configurationRetryCount): self { $this->options['configurationRetryCount'] = $configurationRetryCount; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V2.UpdateWebhookOptions ' . $options . ']'; } }src/Twilio/Rest/IpMessaging/V2/Service/Channel/MessageList.php000064400000014721150515725670020137 0ustar00solution = ['serviceSid' => $serviceSid, 'channelSid' => $channelSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($channelSid) . '/Messages'; } /** * Create the MessageInstance * * @param array|Options $options Optional Arguments * @return MessageInstance Created MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): MessageInstance { $options = new Values($options); $data = Values::of([ 'From' => $options['from'], 'Attributes' => $options['attributes'], 'DateCreated' => Serialize::iso8601DateTime($options['dateCreated']), 'DateUpdated' => Serialize::iso8601DateTime($options['dateUpdated']), 'LastUpdatedBy' => $options['lastUpdatedBy'], 'Body' => $options['body'], 'MediaSid' => $options['mediaSid'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->create('POST', $this->uri, [], $data, $headers); return new MessageInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'] ); } /** * Streams MessageInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads MessageInstance 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 MessageInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of MessageInstance 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 MessagePage Page of MessageInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): MessagePage { $options = new Values($options); $params = Values::of([ 'Order' => $options['order'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new MessagePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of MessageInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return MessagePage Page of MessageInstance */ public function getPage(string $targetUrl): MessagePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new MessagePage($this->version, $response, $this->solution); } /** * Constructs a MessageContext * * @param string $sid The sid */ public function getContext(string $sid): MessageContext { return new MessageContext( $this->version, $this->solution['serviceSid'], $this->solution['channelSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V2.MessageList]'; } }src/Twilio/Rest/IpMessaging/V2/Service/Channel/MessageContext.php000064400000006775150515725670020662 0ustar00solution = ['serviceSid' => $serviceSid, 'channelSid' => $channelSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($channelSid) . '/Messages/' . \rawurlencode($sid) . ''; } /** * Fetch the MessageInstance * * @return MessageInstance Fetched MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MessageInstance { $payload = $this->version->fetch('GET', $this->uri); return new MessageInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } /** * Delete the MessageInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { $options = new Values($options); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); return $this->version->delete('DELETE', $this->uri, [], [], $headers); } /** * Update the MessageInstance * * @param array|Options $options Optional Arguments * @return MessageInstance Updated MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): MessageInstance { $options = new Values($options); $data = Values::of([ 'Body' => $options['body'], 'Attributes' => $options['attributes'], 'DateCreated' => Serialize::iso8601DateTime($options['dateCreated']), 'DateUpdated' => Serialize::iso8601DateTime($options['dateUpdated']), 'LastUpdatedBy' => $options['lastUpdatedBy'], 'From' => $options['from'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->update('POST', $this->uri, [], $data, $headers); return new MessageInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V2.MessageContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V2/Service/Channel/MemberList.php000064400000015176150515725670017767 0ustar00solution = ['serviceSid' => $serviceSid, 'channelSid' => $channelSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($channelSid) . '/Members'; } /** * Create the MemberInstance * * @param string $identity The identity * @param array|Options $options Optional Arguments * @return MemberInstance Created MemberInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $identity, array $options = []): MemberInstance { $options = new Values($options); $data = Values::of([ 'Identity' => $identity, 'RoleSid' => $options['roleSid'], 'LastConsumedMessageIndex' => $options['lastConsumedMessageIndex'], 'LastConsumptionTimestamp' => Serialize::iso8601DateTime($options['lastConsumptionTimestamp']), 'DateCreated' => Serialize::iso8601DateTime($options['dateCreated']), 'DateUpdated' => Serialize::iso8601DateTime($options['dateUpdated']), 'Attributes' => $options['attributes'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->create('POST', $this->uri, [], $data, $headers); return new MemberInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'] ); } /** * Streams MemberInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads MemberInstance 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 MemberInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of MemberInstance 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 MemberPage Page of MemberInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): MemberPage { $options = new Values($options); $params = Values::of([ 'Identity' => Serialize::map($options['identity'], function($e) { return $e; }), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new MemberPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of MemberInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return MemberPage Page of MemberInstance */ public function getPage(string $targetUrl): MemberPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new MemberPage($this->version, $response, $this->solution); } /** * Constructs a MemberContext * * @param string $sid The sid */ public function getContext(string $sid): MemberContext { return new MemberContext( $this->version, $this->solution['serviceSid'], $this->solution['channelSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V2.MemberList]'; } }src/Twilio/Rest/IpMessaging/V2/Service/Channel/MemberContext.php000064400000007116150515725670020473 0ustar00solution = ['serviceSid' => $serviceSid, 'channelSid' => $channelSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($channelSid) . '/Members/' . \rawurlencode($sid) . ''; } /** * Fetch the MemberInstance * * @return MemberInstance Fetched MemberInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MemberInstance { $payload = $this->version->fetch('GET', $this->uri); return new MemberInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } /** * Delete the MemberInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { $options = new Values($options); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); return $this->version->delete('DELETE', $this->uri, [], [], $headers); } /** * Update the MemberInstance * * @param array|Options $options Optional Arguments * @return MemberInstance Updated MemberInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): MemberInstance { $options = new Values($options); $data = Values::of([ 'RoleSid' => $options['roleSid'], 'LastConsumedMessageIndex' => $options['lastConsumedMessageIndex'], 'LastConsumptionTimestamp' => Serialize::iso8601DateTime($options['lastConsumptionTimestamp']), 'DateCreated' => Serialize::iso8601DateTime($options['dateCreated']), 'DateUpdated' => Serialize::iso8601DateTime($options['dateUpdated']), 'Attributes' => $options['attributes'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->update('POST', $this->uri, [], $data, $headers); return new MemberInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V2.MemberContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V2/Service/Channel/InviteOptions.php000064400000004500150515725670020523 0ustar00options['roleSid'] = $roleSid; } /** * The role_sid * * @param string $roleSid The role_sid * @return $this Fluent Builder */ public function setRoleSid(string $roleSid): self { $this->options['roleSid'] = $roleSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V2.CreateInviteOptions ' . $options . ']'; } } class ReadInviteOptions extends Options { /** * @param string[] $identity The identity */ public function __construct(array $identity = Values::ARRAY_NONE) { $this->options['identity'] = $identity; } /** * The identity * * @param string[] $identity The identity * @return $this Fluent Builder */ public function setIdentity(array $identity): self { $this->options['identity'] = $identity; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V2.ReadInviteOptions ' . $options . ']'; } }src/Twilio/Rest/IpMessaging/V2/Service/Channel/MessageOptions.php000064400000027577150515725670020674 0ustar00options['from'] = $from; $this->options['attributes'] = $attributes; $this->options['dateCreated'] = $dateCreated; $this->options['dateUpdated'] = $dateUpdated; $this->options['lastUpdatedBy'] = $lastUpdatedBy; $this->options['body'] = $body; $this->options['mediaSid'] = $mediaSid; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The from * * @param string $from The from * @return $this Fluent Builder */ public function setFrom(string $from): self { $this->options['from'] = $from; return $this; } /** * The attributes * * @param string $attributes The attributes * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The date_created * * @param \DateTime $dateCreated The date_created * @return $this Fluent Builder */ public function setDateCreated(\DateTime $dateCreated): self { $this->options['dateCreated'] = $dateCreated; return $this; } /** * The date_updated * * @param \DateTime $dateUpdated The date_updated * @return $this Fluent Builder */ public function setDateUpdated(\DateTime $dateUpdated): self { $this->options['dateUpdated'] = $dateUpdated; return $this; } /** * The last_updated_by * * @param string $lastUpdatedBy The last_updated_by * @return $this Fluent Builder */ public function setLastUpdatedBy(string $lastUpdatedBy): self { $this->options['lastUpdatedBy'] = $lastUpdatedBy; return $this; } /** * The body * * @param string $body The body * @return $this Fluent Builder */ public function setBody(string $body): self { $this->options['body'] = $body; return $this; } /** * The media_sid * * @param string $mediaSid The media_sid * @return $this Fluent Builder */ public function setMediaSid(string $mediaSid): self { $this->options['mediaSid'] = $mediaSid; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V2.CreateMessageOptions ' . $options . ']'; } } class ReadMessageOptions extends Options { /** * @param string $order The order */ public function __construct(string $order = Values::NONE) { $this->options['order'] = $order; } /** * The order * * @param string $order The order * @return $this Fluent Builder */ public function setOrder(string $order): self { $this->options['order'] = $order; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V2.ReadMessageOptions ' . $options . ']'; } } class DeleteMessageOptions extends Options { /** * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header */ public function __construct(string $xTwilioWebhookEnabled = Values::NONE) { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V2.DeleteMessageOptions ' . $options . ']'; } } class UpdateMessageOptions extends Options { /** * @param string $body The body * @param string $attributes The attributes * @param \DateTime $dateCreated The date_created * @param \DateTime $dateUpdated The date_updated * @param string $lastUpdatedBy The last_updated_by * @param string $from The from * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header */ public function __construct(string $body = Values::NONE, string $attributes = Values::NONE, \DateTime $dateCreated = Values::NONE, \DateTime $dateUpdated = Values::NONE, string $lastUpdatedBy = Values::NONE, string $from = Values::NONE, string $xTwilioWebhookEnabled = Values::NONE) { $this->options['body'] = $body; $this->options['attributes'] = $attributes; $this->options['dateCreated'] = $dateCreated; $this->options['dateUpdated'] = $dateUpdated; $this->options['lastUpdatedBy'] = $lastUpdatedBy; $this->options['from'] = $from; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The body * * @param string $body The body * @return $this Fluent Builder */ public function setBody(string $body): self { $this->options['body'] = $body; return $this; } /** * The attributes * * @param string $attributes The attributes * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The date_created * * @param \DateTime $dateCreated The date_created * @return $this Fluent Builder */ public function setDateCreated(\DateTime $dateCreated): self { $this->options['dateCreated'] = $dateCreated; return $this; } /** * The date_updated * * @param \DateTime $dateUpdated The date_updated * @return $this Fluent Builder */ public function setDateUpdated(\DateTime $dateUpdated): self { $this->options['dateUpdated'] = $dateUpdated; return $this; } /** * The last_updated_by * * @param string $lastUpdatedBy The last_updated_by * @return $this Fluent Builder */ public function setLastUpdatedBy(string $lastUpdatedBy): self { $this->options['lastUpdatedBy'] = $lastUpdatedBy; return $this; } /** * The from * * @param string $from The from * @return $this Fluent Builder */ public function setFrom(string $from): self { $this->options['from'] = $from; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V2.UpdateMessageOptions ' . $options . ']'; } }src/Twilio/Rest/IpMessaging/V2/Service/Channel/InviteList.php000064400000014133150515725670020006 0ustar00solution = ['serviceSid' => $serviceSid, 'channelSid' => $channelSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($channelSid) . '/Invites'; } /** * Create the InviteInstance * * @param string $identity The identity * @param array|Options $options Optional Arguments * @return InviteInstance Created InviteInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $identity, array $options = []): InviteInstance { $options = new Values($options); $data = Values::of(['Identity' => $identity, 'RoleSid' => $options['roleSid'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new InviteInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'] ); } /** * Streams InviteInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads InviteInstance 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 InviteInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of InviteInstance 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 InvitePage Page of InviteInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): InvitePage { $options = new Values($options); $params = Values::of([ 'Identity' => Serialize::map($options['identity'], function($e) { return $e; }), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new InvitePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of InviteInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return InvitePage Page of InviteInstance */ public function getPage(string $targetUrl): InvitePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new InvitePage($this->version, $response, $this->solution); } /** * Constructs a InviteContext * * @param string $sid The sid */ public function getContext(string $sid): InviteContext { return new InviteContext( $this->version, $this->solution['serviceSid'], $this->solution['channelSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V2.InviteList]'; } }src/Twilio/Rest/IpMessaging/V2/Service/Channel/InviteContext.php000064400000004150150515725670020515 0ustar00solution = ['serviceSid' => $serviceSid, 'channelSid' => $channelSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($channelSid) . '/Invites/' . \rawurlencode($sid) . ''; } /** * Fetch the InviteInstance * * @return InviteInstance Fetched InviteInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): InviteInstance { $payload = $this->version->fetch('GET', $this->uri); return new InviteInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } /** * Delete the InviteInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V2.InviteContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V2/Service/Channel/MemberPage.php000064400000002432150515725670017717 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return MemberInstance \Twilio\Rest\IpMessaging\V2\Service\Channel\MemberInstance */ public function buildInstance(array $payload): MemberInstance { return new MemberInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V2.MemberPage]'; } }src/Twilio/Rest/IpMessaging/V2/Service/Channel/WebhookPage.php000064400000002440150515725670020105 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return WebhookInstance \Twilio\Rest\IpMessaging\V2\Service\Channel\WebhookInstance */ public function buildInstance(array $payload): WebhookInstance { return new WebhookInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V2.WebhookPage]'; } }src/Twilio/Rest/IpMessaging/V2/Service/Channel/WebhookList.php000064400000014262150515725670020151 0ustar00solution = ['serviceSid' => $serviceSid, 'channelSid' => $channelSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($channelSid) . '/Webhooks'; } /** * Streams WebhookInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads WebhookInstance 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 WebhookInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of WebhookInstance 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 WebhookPage Page of WebhookInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): WebhookPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new WebhookPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of WebhookInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return WebhookPage Page of WebhookInstance */ public function getPage(string $targetUrl): WebhookPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new WebhookPage($this->version, $response, $this->solution); } /** * Create the WebhookInstance * * @param string $type The type * @param array|Options $options Optional Arguments * @return WebhookInstance Created WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $type, array $options = []): WebhookInstance { $options = new Values($options); $data = Values::of([ 'Type' => $type, 'Configuration.Url' => $options['configurationUrl'], 'Configuration.Method' => $options['configurationMethod'], 'Configuration.Filters' => Serialize::map($options['configurationFilters'], function($e) { return $e; }), 'Configuration.Triggers' => Serialize::map($options['configurationTriggers'], function($e) { return $e; }), 'Configuration.FlowSid' => $options['configurationFlowSid'], 'Configuration.RetryCount' => $options['configurationRetryCount'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new WebhookInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'] ); } /** * Constructs a WebhookContext * * @param string $sid The sid */ public function getContext(string $sid): WebhookContext { return new WebhookContext( $this->version, $this->solution['serviceSid'], $this->solution['channelSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V2.WebhookList]'; } }src/Twilio/Rest/IpMessaging/V2/Service/Channel/WebhookContext.php000064400000006517150515725670020666 0ustar00solution = ['serviceSid' => $serviceSid, 'channelSid' => $channelSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($channelSid) . '/Webhooks/' . \rawurlencode($sid) . ''; } /** * Fetch the WebhookInstance * * @return WebhookInstance Fetched WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): WebhookInstance { $payload = $this->version->fetch('GET', $this->uri); return new WebhookInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } /** * Update the WebhookInstance * * @param array|Options $options Optional Arguments * @return WebhookInstance Updated WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): WebhookInstance { $options = new Values($options); $data = Values::of([ 'Configuration.Url' => $options['configurationUrl'], 'Configuration.Method' => $options['configurationMethod'], 'Configuration.Filters' => Serialize::map($options['configurationFilters'], function($e) { return $e; }), 'Configuration.Triggers' => Serialize::map($options['configurationTriggers'], function($e) { return $e; }), 'Configuration.FlowSid' => $options['configurationFlowSid'], 'Configuration.RetryCount' => $options['configurationRetryCount'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new WebhookInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } /** * Delete the WebhookInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V2.WebhookContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V2/Service/Channel/MemberInstance.php000064400000011575150515725670020617 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'channelSid' => Values::array_get($payload, 'channel_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'identity' => Values::array_get($payload, 'identity'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'roleSid' => Values::array_get($payload, 'role_sid'), 'lastConsumedMessageIndex' => Values::array_get($payload, 'last_consumed_message_index'), 'lastConsumptionTimestamp' => Deserialize::dateTime(Values::array_get($payload, 'last_consumption_timestamp')), 'url' => Values::array_get($payload, 'url'), 'attributes' => Values::array_get($payload, 'attributes'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'channelSid' => $channelSid, '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 MemberContext Context for this MemberInstance */ protected function proxy(): MemberContext { if (!$this->context) { $this->context = new MemberContext( $this->version, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the MemberInstance * * @return MemberInstance Fetched MemberInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MemberInstance { return $this->proxy()->fetch(); } /** * Delete the MemberInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { return $this->proxy()->delete($options); } /** * Update the MemberInstance * * @param array|Options $options Optional Arguments * @return MemberInstance Updated MemberInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): MemberInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V2.MemberInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V2/Service/Channel/MessagePage.php000064400000002440150515725670020073 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return MessageInstance \Twilio\Rest\IpMessaging\V2\Service\Channel\MessageInstance */ public function buildInstance(array $payload): MessageInstance { return new MessageInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V2.MessagePage]'; } }src/Twilio/Rest/IpMessaging/V2/Service/BindingPage.php000064400000002267150515725670016520 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return BindingInstance \Twilio\Rest\IpMessaging\V2\Service\BindingInstance */ public function buildInstance(array $payload): BindingInstance { return new BindingInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V2.BindingPage]'; } }src/Twilio/Rest/IpMessaging/V2/Service/BindingInstance.php000064400000010233150515725670017400 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'endpoint' => Values::array_get($payload, 'endpoint'), 'identity' => Values::array_get($payload, 'identity'), 'credentialSid' => Values::array_get($payload, 'credential_sid'), 'bindingType' => Values::array_get($payload, 'binding_type'), 'messageTypes' => Values::array_get($payload, 'message_types'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return BindingContext Context for this BindingInstance */ protected function proxy(): BindingContext { if (!$this->context) { $this->context = new BindingContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the BindingInstance * * @return BindingInstance Fetched BindingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): BindingInstance { return $this->proxy()->fetch(); } /** * Delete the BindingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V2.BindingInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V2/Service/User/UserChannelPage.php000064400000002457150515725670020274 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return UserChannelInstance \Twilio\Rest\IpMessaging\V2\Service\User\UserChannelInstance */ public function buildInstance(array $payload): UserChannelInstance { return new UserChannelInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['userSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V2.UserChannelPage]'; } }src/Twilio/Rest/IpMessaging/V2/Service/User/UserBindingOptions.php000064400000002560150515725670021050 0ustar00options['bindingType'] = $bindingType; } /** * The binding_type * * @param string[] $bindingType The binding_type * @return $this Fluent Builder */ public function setBindingType(array $bindingType): self { $this->options['bindingType'] = $bindingType; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V2.ReadUserBindingOptions ' . $options . ']'; } }src/Twilio/Rest/IpMessaging/V2/Service/User/UserChannelContext.php000064400000006222150515725670021036 0ustar00solution = ['serviceSid' => $serviceSid, 'userSid' => $userSid, 'channelSid' => $channelSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Users/' . \rawurlencode($userSid) . '/Channels/' . \rawurlencode($channelSid) . ''; } /** * Fetch the UserChannelInstance * * @return UserChannelInstance Fetched UserChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): UserChannelInstance { $payload = $this->version->fetch('GET', $this->uri); return new UserChannelInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['userSid'], $this->solution['channelSid'] ); } /** * Delete the UserChannelInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the UserChannelInstance * * @param array|Options $options Optional Arguments * @return UserChannelInstance Updated UserChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): UserChannelInstance { $options = new Values($options); $data = Values::of([ 'NotificationLevel' => $options['notificationLevel'], 'LastConsumedMessageIndex' => $options['lastConsumedMessageIndex'], 'LastConsumptionTimestamp' => Serialize::iso8601DateTime($options['lastConsumptionTimestamp']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new UserChannelInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['userSid'], $this->solution['channelSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V2.UserChannelContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V2/Service/User/UserBindingInstance.php000064400000010604150515725670021157 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'endpoint' => Values::array_get($payload, 'endpoint'), 'identity' => Values::array_get($payload, 'identity'), 'userSid' => Values::array_get($payload, 'user_sid'), 'credentialSid' => Values::array_get($payload, 'credential_sid'), 'bindingType' => Values::array_get($payload, 'binding_type'), 'messageTypes' => Values::array_get($payload, 'message_types'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'userSid' => $userSid, '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 UserBindingContext Context for this UserBindingInstance */ protected function proxy(): UserBindingContext { if (!$this->context) { $this->context = new UserBindingContext( $this->version, $this->solution['serviceSid'], $this->solution['userSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the UserBindingInstance * * @return UserBindingInstance Fetched UserBindingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): UserBindingInstance { return $this->proxy()->fetch(); } /** * Delete the UserBindingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V2.UserBindingInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V2/Service/User/UserChannelInstance.php000064400000011303150515725670021152 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'channelSid' => Values::array_get($payload, 'channel_sid'), 'userSid' => Values::array_get($payload, 'user_sid'), 'memberSid' => Values::array_get($payload, 'member_sid'), 'status' => Values::array_get($payload, 'status'), 'lastConsumedMessageIndex' => Values::array_get($payload, 'last_consumed_message_index'), 'unreadMessagesCount' => Values::array_get($payload, 'unread_messages_count'), 'links' => Values::array_get($payload, 'links'), 'url' => Values::array_get($payload, 'url'), 'notificationLevel' => Values::array_get($payload, 'notification_level'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'userSid' => $userSid, 'channelSid' => $channelSid ?: $this->properties['channelSid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return UserChannelContext Context for this UserChannelInstance */ protected function proxy(): UserChannelContext { if (!$this->context) { $this->context = new UserChannelContext( $this->version, $this->solution['serviceSid'], $this->solution['userSid'], $this->solution['channelSid'] ); } return $this->context; } /** * Fetch the UserChannelInstance * * @return UserChannelInstance Fetched UserChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): UserChannelInstance { return $this->proxy()->fetch(); } /** * Delete the UserChannelInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the UserChannelInstance * * @param array|Options $options Optional Arguments * @return UserChannelInstance Updated UserChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): UserChannelInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V2.UserChannelInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V2/Service/User/UserBindingPage.php000064400000002457150515725670020276 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return UserBindingInstance \Twilio\Rest\IpMessaging\V2\Service\User\UserBindingInstance */ public function buildInstance(array $payload): UserBindingInstance { return new UserBindingInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['userSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V2.UserBindingPage]'; } }src/Twilio/Rest/IpMessaging/V2/Service/User/UserChannelOptions.php000064400000005617150515725670021054 0ustar00options['notificationLevel'] = $notificationLevel; $this->options['lastConsumedMessageIndex'] = $lastConsumedMessageIndex; $this->options['lastConsumptionTimestamp'] = $lastConsumptionTimestamp; } /** * The notification_level * * @param string $notificationLevel The notification_level * @return $this Fluent Builder */ public function setNotificationLevel(string $notificationLevel): self { $this->options['notificationLevel'] = $notificationLevel; return $this; } /** * The last_consumed_message_index * * @param int $lastConsumedMessageIndex The last_consumed_message_index * @return $this Fluent Builder */ public function setLastConsumedMessageIndex(int $lastConsumedMessageIndex): self { $this->options['lastConsumedMessageIndex'] = $lastConsumedMessageIndex; return $this; } /** * The last_consumption_timestamp * * @param \DateTime $lastConsumptionTimestamp The last_consumption_timestamp * @return $this Fluent Builder */ public function setLastConsumptionTimestamp(\DateTime $lastConsumptionTimestamp): self { $this->options['lastConsumptionTimestamp'] = $lastConsumptionTimestamp; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V2.UpdateUserChannelOptions ' . $options . ']'; } }src/Twilio/Rest/IpMessaging/V2/Service/User/UserChannelList.php000064400000011721150515725670020325 0ustar00solution = ['serviceSid' => $serviceSid, 'userSid' => $userSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Users/' . \rawurlencode($userSid) . '/Channels'; } /** * Streams UserChannelInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads UserChannelInstance 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 UserChannelInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of UserChannelInstance 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 UserChannelPage Page of UserChannelInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): UserChannelPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new UserChannelPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of UserChannelInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return UserChannelPage Page of UserChannelInstance */ public function getPage(string $targetUrl): UserChannelPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new UserChannelPage($this->version, $response, $this->solution); } /** * Constructs a UserChannelContext * * @param string $channelSid The channel_sid */ public function getContext(string $channelSid): UserChannelContext { return new UserChannelContext( $this->version, $this->solution['serviceSid'], $this->solution['userSid'], $channelSid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V2.UserChannelList]'; } }src/Twilio/Rest/IpMessaging/V2/Service/User/UserBindingList.php000064400000012623150515725670020331 0ustar00solution = ['serviceSid' => $serviceSid, 'userSid' => $userSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Users/' . \rawurlencode($userSid) . '/Bindings'; } /** * Streams UserBindingInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads UserBindingInstance 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 UserBindingInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of UserBindingInstance 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 UserBindingPage Page of UserBindingInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): UserBindingPage { $options = new Values($options); $params = Values::of([ 'BindingType' => Serialize::map($options['bindingType'], function($e) { return $e; }), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new UserBindingPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of UserBindingInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return UserBindingPage Page of UserBindingInstance */ public function getPage(string $targetUrl): UserBindingPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new UserBindingPage($this->version, $response, $this->solution); } /** * Constructs a UserBindingContext * * @param string $sid The sid */ public function getContext(string $sid): UserBindingContext { return new UserBindingContext( $this->version, $this->solution['serviceSid'], $this->solution['userSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V2.UserBindingList]'; } }src/Twilio/Rest/IpMessaging/V2/Service/User/UserBindingContext.php000064400000004173150515725670021043 0ustar00solution = ['serviceSid' => $serviceSid, 'userSid' => $userSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Users/' . \rawurlencode($userSid) . '/Bindings/' . \rawurlencode($sid) . ''; } /** * Fetch the UserBindingInstance * * @return UserBindingInstance Fetched UserBindingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): UserBindingInstance { $payload = $this->version->fetch('GET', $this->uri); return new UserBindingInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['userSid'], $this->solution['sid'] ); } /** * Delete the UserBindingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V2.UserBindingContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V2/Service/ChannelPage.php000064400000002267150515725670016516 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ChannelInstance \Twilio\Rest\IpMessaging\V2\Service\ChannelInstance */ public function buildInstance(array $payload): ChannelInstance { return new ChannelInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V2.ChannelPage]'; } }src/Twilio/Rest/IpMessaging/V2/Service/RolePage.php000064400000002245150515725670016043 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return RoleInstance \Twilio\Rest\IpMessaging\V2\Service\RoleInstance */ public function buildInstance(array $payload): RoleInstance { return new RoleInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V2.RolePage]'; } }src/Twilio/Rest/IpMessaging/V2/Service/ChannelList.php000064400000014300150515725670016544 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels'; } /** * Create the ChannelInstance * * @param array|Options $options Optional Arguments * @return ChannelInstance Created ChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): ChannelInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'UniqueName' => $options['uniqueName'], 'Attributes' => $options['attributes'], 'Type' => $options['type'], 'DateCreated' => Serialize::iso8601DateTime($options['dateCreated']), 'DateUpdated' => Serialize::iso8601DateTime($options['dateUpdated']), 'CreatedBy' => $options['createdBy'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->create('POST', $this->uri, [], $data, $headers); return new ChannelInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Streams ChannelInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ChannelInstance 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 ChannelInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of ChannelInstance 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 ChannelPage Page of ChannelInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ChannelPage { $options = new Values($options); $params = Values::of([ 'Type' => Serialize::map($options['type'], function($e) { return $e; }), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ChannelPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ChannelInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ChannelPage Page of ChannelInstance */ public function getPage(string $targetUrl): ChannelPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ChannelPage($this->version, $response, $this->solution); } /** * Constructs a ChannelContext * * @param string $sid The sid */ public function getContext(string $sid): ChannelContext { return new ChannelContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V2.ChannelList]'; } }src/Twilio/Rest/IpMessaging/V2/Service/UserList.php000064400000013027150515725670016117 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Users'; } /** * Create the UserInstance * * @param string $identity The identity * @param array|Options $options Optional Arguments * @return UserInstance Created UserInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $identity, array $options = []): UserInstance { $options = new Values($options); $data = Values::of([ 'Identity' => $identity, 'RoleSid' => $options['roleSid'], 'Attributes' => $options['attributes'], 'FriendlyName' => $options['friendlyName'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->create('POST', $this->uri, [], $data, $headers); return new UserInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Streams UserInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads UserInstance 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 UserInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of UserInstance 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 UserPage Page of UserInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): UserPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new UserPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of UserInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return UserPage Page of UserInstance */ public function getPage(string $targetUrl): UserPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new UserPage($this->version, $response, $this->solution); } /** * Constructs a UserContext * * @param string $sid The sid */ public function getContext(string $sid): UserContext { return new UserContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V2.UserList]'; } }src/Twilio/Rest/IpMessaging/V2/Service/UserInstance.php000064400000012245150515725670016751 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'attributes' => Values::array_get($payload, 'attributes'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'roleSid' => Values::array_get($payload, 'role_sid'), 'identity' => Values::array_get($payload, 'identity'), 'isOnline' => Values::array_get($payload, 'is_online'), 'isNotifiable' => Values::array_get($payload, 'is_notifiable'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'joinedChannelsCount' => Values::array_get($payload, 'joined_channels_count'), 'links' => Values::array_get($payload, 'links'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return UserContext Context for this UserInstance */ protected function proxy(): UserContext { if (!$this->context) { $this->context = new UserContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the UserInstance * * @return UserInstance Fetched UserInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): UserInstance { return $this->proxy()->fetch(); } /** * Delete the UserInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the UserInstance * * @param array|Options $options Optional Arguments * @return UserInstance Updated UserInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): UserInstance { return $this->proxy()->update($options); } /** * Access the userChannels */ protected function getUserChannels(): UserChannelList { return $this->proxy()->userChannels; } /** * Access the userBindings */ protected function getUserBindings(): UserBindingList { return $this->proxy()->userBindings; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V2.UserInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V2/Service/BindingOptions.php000064400000003471150515725670017275 0ustar00options['bindingType'] = $bindingType; $this->options['identity'] = $identity; } /** * The binding_type * * @param string[] $bindingType The binding_type * @return $this Fluent Builder */ public function setBindingType(array $bindingType): self { $this->options['bindingType'] = $bindingType; return $this; } /** * The identity * * @param string[] $identity The identity * @return $this Fluent Builder */ public function setIdentity(array $identity): self { $this->options['identity'] = $identity; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V2.ReadBindingOptions ' . $options . ']'; } }src/Twilio/Rest/IpMessaging/V2/ServiceContext.php000064400000017727150515725670015725 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($sid) . ''; } /** * Fetch the ServiceInstance * * @return ServiceInstance Fetched ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ServiceInstance { $payload = $this->version->fetch('GET', $this->uri); return new ServiceInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the ServiceInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the ServiceInstance * * @param array|Options $options Optional Arguments * @return ServiceInstance Updated ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ServiceInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'DefaultServiceRoleSid' => $options['defaultServiceRoleSid'], 'DefaultChannelRoleSid' => $options['defaultChannelRoleSid'], 'DefaultChannelCreatorRoleSid' => $options['defaultChannelCreatorRoleSid'], 'ReadStatusEnabled' => Serialize::booleanToString($options['readStatusEnabled']), 'ReachabilityEnabled' => Serialize::booleanToString($options['reachabilityEnabled']), 'TypingIndicatorTimeout' => $options['typingIndicatorTimeout'], 'ConsumptionReportInterval' => $options['consumptionReportInterval'], 'Notifications.NewMessage.Enabled' => Serialize::booleanToString($options['notificationsNewMessageEnabled']), 'Notifications.NewMessage.Template' => $options['notificationsNewMessageTemplate'], 'Notifications.NewMessage.Sound' => $options['notificationsNewMessageSound'], 'Notifications.NewMessage.BadgeCountEnabled' => Serialize::booleanToString($options['notificationsNewMessageBadgeCountEnabled']), 'Notifications.AddedToChannel.Enabled' => Serialize::booleanToString($options['notificationsAddedToChannelEnabled']), 'Notifications.AddedToChannel.Template' => $options['notificationsAddedToChannelTemplate'], 'Notifications.AddedToChannel.Sound' => $options['notificationsAddedToChannelSound'], 'Notifications.RemovedFromChannel.Enabled' => Serialize::booleanToString($options['notificationsRemovedFromChannelEnabled']), 'Notifications.RemovedFromChannel.Template' => $options['notificationsRemovedFromChannelTemplate'], 'Notifications.RemovedFromChannel.Sound' => $options['notificationsRemovedFromChannelSound'], 'Notifications.InvitedToChannel.Enabled' => Serialize::booleanToString($options['notificationsInvitedToChannelEnabled']), 'Notifications.InvitedToChannel.Template' => $options['notificationsInvitedToChannelTemplate'], 'Notifications.InvitedToChannel.Sound' => $options['notificationsInvitedToChannelSound'], 'PreWebhookUrl' => $options['preWebhookUrl'], 'PostWebhookUrl' => $options['postWebhookUrl'], 'WebhookMethod' => $options['webhookMethod'], 'WebhookFilters' => Serialize::map($options['webhookFilters'], function($e) { return $e; }), 'Limits.ChannelMembers' => $options['limitsChannelMembers'], 'Limits.UserChannels' => $options['limitsUserChannels'], 'Media.CompatibilityMessage' => $options['mediaCompatibilityMessage'], 'PreWebhookRetryCount' => $options['preWebhookRetryCount'], 'PostWebhookRetryCount' => $options['postWebhookRetryCount'], 'Notifications.LogEnabled' => Serialize::booleanToString($options['notificationsLogEnabled']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ServiceInstance($this->version, $payload, $this->solution['sid']); } /** * Access the channels */ protected function getChannels(): ChannelList { if (!$this->_channels) { $this->_channels = new ChannelList($this->version, $this->solution['sid']); } return $this->_channels; } /** * Access the roles */ protected function getRoles(): RoleList { if (!$this->_roles) { $this->_roles = new RoleList($this->version, $this->solution['sid']); } return $this->_roles; } /** * Access the users */ protected function getUsers(): UserList { if (!$this->_users) { $this->_users = new UserList($this->version, $this->solution['sid']); } return $this->_users; } /** * Access the bindings */ protected function getBindings(): BindingList { if (!$this->_bindings) { $this->_bindings = new BindingList($this->version, $this->solution['sid']); } return $this->_bindings; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V2.ServiceContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/IpMessaging/V2/ServiceOptions.php000064400000064153150515725670015727 0ustar00options['friendlyName'] = $friendlyName; $this->options['defaultServiceRoleSid'] = $defaultServiceRoleSid; $this->options['defaultChannelRoleSid'] = $defaultChannelRoleSid; $this->options['defaultChannelCreatorRoleSid'] = $defaultChannelCreatorRoleSid; $this->options['readStatusEnabled'] = $readStatusEnabled; $this->options['reachabilityEnabled'] = $reachabilityEnabled; $this->options['typingIndicatorTimeout'] = $typingIndicatorTimeout; $this->options['consumptionReportInterval'] = $consumptionReportInterval; $this->options['notificationsNewMessageEnabled'] = $notificationsNewMessageEnabled; $this->options['notificationsNewMessageTemplate'] = $notificationsNewMessageTemplate; $this->options['notificationsNewMessageSound'] = $notificationsNewMessageSound; $this->options['notificationsNewMessageBadgeCountEnabled'] = $notificationsNewMessageBadgeCountEnabled; $this->options['notificationsAddedToChannelEnabled'] = $notificationsAddedToChannelEnabled; $this->options['notificationsAddedToChannelTemplate'] = $notificationsAddedToChannelTemplate; $this->options['notificationsAddedToChannelSound'] = $notificationsAddedToChannelSound; $this->options['notificationsRemovedFromChannelEnabled'] = $notificationsRemovedFromChannelEnabled; $this->options['notificationsRemovedFromChannelTemplate'] = $notificationsRemovedFromChannelTemplate; $this->options['notificationsRemovedFromChannelSound'] = $notificationsRemovedFromChannelSound; $this->options['notificationsInvitedToChannelEnabled'] = $notificationsInvitedToChannelEnabled; $this->options['notificationsInvitedToChannelTemplate'] = $notificationsInvitedToChannelTemplate; $this->options['notificationsInvitedToChannelSound'] = $notificationsInvitedToChannelSound; $this->options['preWebhookUrl'] = $preWebhookUrl; $this->options['postWebhookUrl'] = $postWebhookUrl; $this->options['webhookMethod'] = $webhookMethod; $this->options['webhookFilters'] = $webhookFilters; $this->options['limitsChannelMembers'] = $limitsChannelMembers; $this->options['limitsUserChannels'] = $limitsUserChannels; $this->options['mediaCompatibilityMessage'] = $mediaCompatibilityMessage; $this->options['preWebhookRetryCount'] = $preWebhookRetryCount; $this->options['postWebhookRetryCount'] = $postWebhookRetryCount; $this->options['notificationsLogEnabled'] = $notificationsLogEnabled; } /** * The friendly_name * * @param string $friendlyName The friendly_name * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The default_service_role_sid * * @param string $defaultServiceRoleSid The default_service_role_sid * @return $this Fluent Builder */ public function setDefaultServiceRoleSid(string $defaultServiceRoleSid): self { $this->options['defaultServiceRoleSid'] = $defaultServiceRoleSid; return $this; } /** * The default_channel_role_sid * * @param string $defaultChannelRoleSid The default_channel_role_sid * @return $this Fluent Builder */ public function setDefaultChannelRoleSid(string $defaultChannelRoleSid): self { $this->options['defaultChannelRoleSid'] = $defaultChannelRoleSid; return $this; } /** * The default_channel_creator_role_sid * * @param string $defaultChannelCreatorRoleSid The * default_channel_creator_role_sid * @return $this Fluent Builder */ public function setDefaultChannelCreatorRoleSid(string $defaultChannelCreatorRoleSid): self { $this->options['defaultChannelCreatorRoleSid'] = $defaultChannelCreatorRoleSid; return $this; } /** * The read_status_enabled * * @param bool $readStatusEnabled The read_status_enabled * @return $this Fluent Builder */ public function setReadStatusEnabled(bool $readStatusEnabled): self { $this->options['readStatusEnabled'] = $readStatusEnabled; return $this; } /** * The reachability_enabled * * @param bool $reachabilityEnabled The reachability_enabled * @return $this Fluent Builder */ public function setReachabilityEnabled(bool $reachabilityEnabled): self { $this->options['reachabilityEnabled'] = $reachabilityEnabled; return $this; } /** * The typing_indicator_timeout * * @param int $typingIndicatorTimeout The typing_indicator_timeout * @return $this Fluent Builder */ public function setTypingIndicatorTimeout(int $typingIndicatorTimeout): self { $this->options['typingIndicatorTimeout'] = $typingIndicatorTimeout; return $this; } /** * The consumption_report_interval * * @param int $consumptionReportInterval The consumption_report_interval * @return $this Fluent Builder */ public function setConsumptionReportInterval(int $consumptionReportInterval): self { $this->options['consumptionReportInterval'] = $consumptionReportInterval; return $this; } /** * The notifications.new_message.enabled * * @param bool $notificationsNewMessageEnabled The * notifications.new_message.enabled * @return $this Fluent Builder */ public function setNotificationsNewMessageEnabled(bool $notificationsNewMessageEnabled): self { $this->options['notificationsNewMessageEnabled'] = $notificationsNewMessageEnabled; return $this; } /** * The notifications.new_message.template * * @param string $notificationsNewMessageTemplate The * notifications.new_message.template * @return $this Fluent Builder */ public function setNotificationsNewMessageTemplate(string $notificationsNewMessageTemplate): self { $this->options['notificationsNewMessageTemplate'] = $notificationsNewMessageTemplate; return $this; } /** * The notifications.new_message.sound * * @param string $notificationsNewMessageSound The * notifications.new_message.sound * @return $this Fluent Builder */ public function setNotificationsNewMessageSound(string $notificationsNewMessageSound): self { $this->options['notificationsNewMessageSound'] = $notificationsNewMessageSound; return $this; } /** * The notifications.new_message.badge_count_enabled * * @param bool $notificationsNewMessageBadgeCountEnabled The * notifications.new_message.badge_count_enabled * @return $this Fluent Builder */ public function setNotificationsNewMessageBadgeCountEnabled(bool $notificationsNewMessageBadgeCountEnabled): self { $this->options['notificationsNewMessageBadgeCountEnabled'] = $notificationsNewMessageBadgeCountEnabled; return $this; } /** * The notifications.added_to_channel.enabled * * @param bool $notificationsAddedToChannelEnabled The * notifications.added_to_channel.enabled * @return $this Fluent Builder */ public function setNotificationsAddedToChannelEnabled(bool $notificationsAddedToChannelEnabled): self { $this->options['notificationsAddedToChannelEnabled'] = $notificationsAddedToChannelEnabled; return $this; } /** * The notifications.added_to_channel.template * * @param string $notificationsAddedToChannelTemplate The * notifications.added_to_channel.template * @return $this Fluent Builder */ public function setNotificationsAddedToChannelTemplate(string $notificationsAddedToChannelTemplate): self { $this->options['notificationsAddedToChannelTemplate'] = $notificationsAddedToChannelTemplate; return $this; } /** * The notifications.added_to_channel.sound * * @param string $notificationsAddedToChannelSound The * notifications.added_to_channel.sound * @return $this Fluent Builder */ public function setNotificationsAddedToChannelSound(string $notificationsAddedToChannelSound): self { $this->options['notificationsAddedToChannelSound'] = $notificationsAddedToChannelSound; return $this; } /** * The notifications.removed_from_channel.enabled * * @param bool $notificationsRemovedFromChannelEnabled The * notifications.removed_from_channel.enabled * @return $this Fluent Builder */ public function setNotificationsRemovedFromChannelEnabled(bool $notificationsRemovedFromChannelEnabled): self { $this->options['notificationsRemovedFromChannelEnabled'] = $notificationsRemovedFromChannelEnabled; return $this; } /** * The notifications.removed_from_channel.template * * @param string $notificationsRemovedFromChannelTemplate The * notifications.removed_from_channel.template * @return $this Fluent Builder */ public function setNotificationsRemovedFromChannelTemplate(string $notificationsRemovedFromChannelTemplate): self { $this->options['notificationsRemovedFromChannelTemplate'] = $notificationsRemovedFromChannelTemplate; return $this; } /** * The notifications.removed_from_channel.sound * * @param string $notificationsRemovedFromChannelSound The * notifications.removed_from_channel.sound * @return $this Fluent Builder */ public function setNotificationsRemovedFromChannelSound(string $notificationsRemovedFromChannelSound): self { $this->options['notificationsRemovedFromChannelSound'] = $notificationsRemovedFromChannelSound; return $this; } /** * The notifications.invited_to_channel.enabled * * @param bool $notificationsInvitedToChannelEnabled The * notifications.invited_to_channel.enabled * @return $this Fluent Builder */ public function setNotificationsInvitedToChannelEnabled(bool $notificationsInvitedToChannelEnabled): self { $this->options['notificationsInvitedToChannelEnabled'] = $notificationsInvitedToChannelEnabled; return $this; } /** * The notifications.invited_to_channel.template * * @param string $notificationsInvitedToChannelTemplate The * notifications.invited_to_channel.template * @return $this Fluent Builder */ public function setNotificationsInvitedToChannelTemplate(string $notificationsInvitedToChannelTemplate): self { $this->options['notificationsInvitedToChannelTemplate'] = $notificationsInvitedToChannelTemplate; return $this; } /** * The notifications.invited_to_channel.sound * * @param string $notificationsInvitedToChannelSound The * notifications.invited_to_channel.sound * @return $this Fluent Builder */ public function setNotificationsInvitedToChannelSound(string $notificationsInvitedToChannelSound): self { $this->options['notificationsInvitedToChannelSound'] = $notificationsInvitedToChannelSound; return $this; } /** * The pre_webhook_url * * @param string $preWebhookUrl The pre_webhook_url * @return $this Fluent Builder */ public function setPreWebhookUrl(string $preWebhookUrl): self { $this->options['preWebhookUrl'] = $preWebhookUrl; return $this; } /** * The post_webhook_url * * @param string $postWebhookUrl The post_webhook_url * @return $this Fluent Builder */ public function setPostWebhookUrl(string $postWebhookUrl): self { $this->options['postWebhookUrl'] = $postWebhookUrl; return $this; } /** * The webhook_method * * @param string $webhookMethod The webhook_method * @return $this Fluent Builder */ public function setWebhookMethod(string $webhookMethod): self { $this->options['webhookMethod'] = $webhookMethod; return $this; } /** * The webhook_filters * * @param string[] $webhookFilters The webhook_filters * @return $this Fluent Builder */ public function setWebhookFilters(array $webhookFilters): self { $this->options['webhookFilters'] = $webhookFilters; return $this; } /** * The limits.channel_members * * @param int $limitsChannelMembers The limits.channel_members * @return $this Fluent Builder */ public function setLimitsChannelMembers(int $limitsChannelMembers): self { $this->options['limitsChannelMembers'] = $limitsChannelMembers; return $this; } /** * The limits.user_channels * * @param int $limitsUserChannels The limits.user_channels * @return $this Fluent Builder */ public function setLimitsUserChannels(int $limitsUserChannels): self { $this->options['limitsUserChannels'] = $limitsUserChannels; return $this; } /** * The media.compatibility_message * * @param string $mediaCompatibilityMessage The media.compatibility_message * @return $this Fluent Builder */ public function setMediaCompatibilityMessage(string $mediaCompatibilityMessage): self { $this->options['mediaCompatibilityMessage'] = $mediaCompatibilityMessage; return $this; } /** * The pre_webhook_retry_count * * @param int $preWebhookRetryCount The pre_webhook_retry_count * @return $this Fluent Builder */ public function setPreWebhookRetryCount(int $preWebhookRetryCount): self { $this->options['preWebhookRetryCount'] = $preWebhookRetryCount; return $this; } /** * The post_webhook_retry_count * * @param int $postWebhookRetryCount The post_webhook_retry_count * @return $this Fluent Builder */ public function setPostWebhookRetryCount(int $postWebhookRetryCount): self { $this->options['postWebhookRetryCount'] = $postWebhookRetryCount; return $this; } /** * The notifications.log_enabled * * @param bool $notificationsLogEnabled The notifications.log_enabled * @return $this Fluent Builder */ public function setNotificationsLogEnabled(bool $notificationsLogEnabled): self { $this->options['notificationsLogEnabled'] = $notificationsLogEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V2.UpdateServiceOptions ' . $options . ']'; } }src/Twilio/Rest/IpMessaging/V2/CredentialOptions.php000064400000016113150515725670016372 0ustar00options['friendlyName'] = $friendlyName; $this->options['certificate'] = $certificate; $this->options['privateKey'] = $privateKey; $this->options['sandbox'] = $sandbox; $this->options['apiKey'] = $apiKey; $this->options['secret'] = $secret; } /** * The friendly_name * * @param string $friendlyName The friendly_name * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The certificate * * @param string $certificate The certificate * @return $this Fluent Builder */ public function setCertificate(string $certificate): self { $this->options['certificate'] = $certificate; return $this; } /** * The private_key * * @param string $privateKey The private_key * @return $this Fluent Builder */ public function setPrivateKey(string $privateKey): self { $this->options['privateKey'] = $privateKey; return $this; } /** * The sandbox * * @param bool $sandbox The sandbox * @return $this Fluent Builder */ public function setSandbox(bool $sandbox): self { $this->options['sandbox'] = $sandbox; return $this; } /** * The api_key * * @param string $apiKey The api_key * @return $this Fluent Builder */ public function setApiKey(string $apiKey): self { $this->options['apiKey'] = $apiKey; return $this; } /** * The secret * * @param string $secret The secret * @return $this Fluent Builder */ public function setSecret(string $secret): self { $this->options['secret'] = $secret; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V2.CreateCredentialOptions ' . $options . ']'; } } class UpdateCredentialOptions extends Options { /** * @param string $friendlyName The friendly_name * @param string $certificate The certificate * @param string $privateKey The private_key * @param bool $sandbox The sandbox * @param string $apiKey The api_key * @param string $secret The secret */ public function __construct(string $friendlyName = Values::NONE, string $certificate = Values::NONE, string $privateKey = Values::NONE, bool $sandbox = Values::NONE, string $apiKey = Values::NONE, string $secret = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['certificate'] = $certificate; $this->options['privateKey'] = $privateKey; $this->options['sandbox'] = $sandbox; $this->options['apiKey'] = $apiKey; $this->options['secret'] = $secret; } /** * The friendly_name * * @param string $friendlyName The friendly_name * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The certificate * * @param string $certificate The certificate * @return $this Fluent Builder */ public function setCertificate(string $certificate): self { $this->options['certificate'] = $certificate; return $this; } /** * The private_key * * @param string $privateKey The private_key * @return $this Fluent Builder */ public function setPrivateKey(string $privateKey): self { $this->options['privateKey'] = $privateKey; return $this; } /** * The sandbox * * @param bool $sandbox The sandbox * @return $this Fluent Builder */ public function setSandbox(bool $sandbox): self { $this->options['sandbox'] = $sandbox; return $this; } /** * The api_key * * @param string $apiKey The api_key * @return $this Fluent Builder */ public function setApiKey(string $apiKey): self { $this->options['apiKey'] = $apiKey; return $this; } /** * The secret * * @param string $secret The secret * @return $this Fluent Builder */ public function setSecret(string $secret): self { $this->options['secret'] = $secret; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.IpMessaging.V2.UpdateCredentialOptions ' . $options . ']'; } }src/Twilio/Rest/IpMessaging/V2/ServicePage.php000064400000002210150515725670015132 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ServiceInstance \Twilio\Rest\IpMessaging\V2\ServiceInstance */ public function buildInstance(array $payload): ServiceInstance { return new ServiceInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V2.ServicePage]'; } }src/Twilio/Rest/IpMessaging/V2/CredentialPage.php000064400000002232150515725670015610 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CredentialInstance \Twilio\Rest\IpMessaging\V2\CredentialInstance */ public function buildInstance(array $payload): CredentialInstance { return new CredentialInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V2.CredentialPage]'; } }src/Twilio/Rest/IpMessaging/V2/ServiceList.php000064400000011773150515725670015207 0ustar00solution = []; $this->uri = '/Services'; } /** * Create the ServiceInstance * * @param string $friendlyName The friendly_name * @return ServiceInstance Created ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName): ServiceInstance { $data = Values::of(['FriendlyName' => $friendlyName, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ServiceInstance($this->version, $payload); } /** * Streams ServiceInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ServiceInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return ServiceInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of ServiceInstance records from the API. * Request is executed immediately * * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return ServicePage Page of ServiceInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ServicePage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ServicePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ServiceInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ServicePage Page of ServiceInstance */ public function getPage(string $targetUrl): ServicePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ServicePage($this->version, $response, $this->solution); } /** * Constructs a ServiceContext * * @param string $sid The sid */ public function getContext(string $sid): ServiceContext { return new ServiceContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.IpMessaging.V2.ServiceList]'; } }src/Twilio/Rest/IpMessaging/V2/CredentialInstance.php000064400000007711150515725670016507 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'type' => Values::array_get($payload, 'type'), 'sandbox' => Values::array_get($payload, 'sandbox'), '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 = ['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 CredentialContext Context for this CredentialInstance */ protected function proxy(): CredentialContext { if (!$this->context) { $this->context = new CredentialContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the CredentialInstance * * @return CredentialInstance Fetched CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CredentialInstance { return $this->proxy()->fetch(); } /** * Update the CredentialInstance * * @param array|Options $options Optional Arguments * @return CredentialInstance Updated CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): CredentialInstance { return $this->proxy()->update($options); } /** * Delete the CredentialInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.IpMessaging.V2.CredentialInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Lookups.php000064400000005066150515725670011710 0ustar00baseUrl = 'https://lookups.twilio.com'; } /** * @return V1 Version v1 of lookups */ protected function getV1(): V1 { 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 TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } protected function getPhoneNumbers(): \Twilio\Rest\Lookups\V1\PhoneNumberList { return $this->v1->phoneNumbers; } /** * @param string $phoneNumber The phone number to fetch in E.164 format */ protected function contextPhoneNumbers(string $phoneNumber): \Twilio\Rest\Lookups\V1\PhoneNumberContext { return $this->v1->phoneNumbers($phoneNumber); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Lookups]'; } }src/Twilio/Rest/Voice.php000064400000011614150515725670011315 0ustar00baseUrl = 'https://voice.twilio.com'; } /** * @return V1 Version v1 of voice */ protected function getV1(): V1 { 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 TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } protected function getArchivedCalls(): \Twilio\Rest\Voice\V1\ArchivedCallList { return $this->v1->archivedCalls; } /** * @param \DateTime $date The date of the Call in UTC. * @param string $sid The unique string that identifies this resource */ protected function contextArchivedCalls(\DateTime $date, string $sid): \Twilio\Rest\Voice\V1\ArchivedCallContext { return $this->v1->archivedCalls($date, $sid); } protected function getByocTrunks(): \Twilio\Rest\Voice\V1\ByocTrunkList { return $this->v1->byocTrunks; } /** * @param string $sid The unique string that identifies the resource */ protected function contextByocTrunks(string $sid): \Twilio\Rest\Voice\V1\ByocTrunkContext { return $this->v1->byocTrunks($sid); } protected function getConnectionPolicies(): \Twilio\Rest\Voice\V1\ConnectionPolicyList { return $this->v1->connectionPolicies; } /** * @param string $sid The unique string that identifies the resource */ protected function contextConnectionPolicies(string $sid): \Twilio\Rest\Voice\V1\ConnectionPolicyContext { return $this->v1->connectionPolicies($sid); } protected function getDialingPermissions(): \Twilio\Rest\Voice\V1\DialingPermissionsList { return $this->v1->dialingPermissions; } protected function getIpRecords(): \Twilio\Rest\Voice\V1\IpRecordList { return $this->v1->ipRecords; } /** * @param string $sid The unique string that identifies the resource */ protected function contextIpRecords(string $sid): \Twilio\Rest\Voice\V1\IpRecordContext { return $this->v1->ipRecords($sid); } protected function getSourceIpMappings(): \Twilio\Rest\Voice\V1\SourceIpMappingList { return $this->v1->sourceIpMappings; } /** * @param string $sid The unique string that identifies the resource */ protected function contextSourceIpMappings(string $sid): \Twilio\Rest\Voice\V1\SourceIpMappingContext { return $this->v1->sourceIpMappings($sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Voice]'; } }src/Twilio/Rest/Media.php000064400000006065150515725670011273 0ustar00baseUrl = 'https://media.twilio.com'; } /** * @return V1 Version v1 of media */ protected function getV1(): V1 { 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 TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } protected function getMediaProcessor(): \Twilio\Rest\Media\V1\MediaProcessorList { return $this->v1->mediaProcessor; } /** * @param string $sid The SID that identifies the resource to fetch */ protected function contextMediaProcessor(string $sid): \Twilio\Rest\Media\V1\MediaProcessorContext { return $this->v1->mediaProcessor($sid); } protected function getPlayerStreamer(): \Twilio\Rest\Media\V1\PlayerStreamerList { return $this->v1->playerStreamer; } /** * @param string $sid The SID that identifies the resource to fetch */ protected function contextPlayerStreamer(string $sid): \Twilio\Rest\Media\V1\PlayerStreamerContext { return $this->v1->playerStreamer($sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Media]'; } }src/Twilio/Rest/Notify/V1/ServiceInstance.php000064400000014370150515725670015075 0ustar00properties = [ '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')), 'apnCredentialSid' => Values::array_get($payload, 'apn_credential_sid'), 'gcmCredentialSid' => Values::array_get($payload, 'gcm_credential_sid'), 'fcmCredentialSid' => Values::array_get($payload, 'fcm_credential_sid'), 'messagingServiceSid' => Values::array_get($payload, 'messaging_service_sid'), 'facebookMessengerPageId' => Values::array_get($payload, 'facebook_messenger_page_id'), 'defaultApnNotificationProtocolVersion' => Values::array_get($payload, 'default_apn_notification_protocol_version'), 'defaultGcmNotificationProtocolVersion' => Values::array_get($payload, 'default_gcm_notification_protocol_version'), 'defaultFcmNotificationProtocolVersion' => Values::array_get($payload, 'default_fcm_notification_protocol_version'), 'logEnabled' => Values::array_get($payload, 'log_enabled'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), 'alexaSkillId' => Values::array_get($payload, 'alexa_skill_id'), 'defaultAlexaNotificationProtocolVersion' => Values::array_get($payload, 'default_alexa_notification_protocol_version'), 'deliveryCallbackUrl' => Values::array_get($payload, 'delivery_callback_url'), 'deliveryCallbackEnabled' => Values::array_get($payload, 'delivery_callback_enabled'), ]; $this->solution = ['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 ServiceContext Context for this ServiceInstance */ protected function proxy(): ServiceContext { if (!$this->context) { $this->context = new ServiceContext($this->version, $this->solution['sid']); } return $this->context; } /** * Delete the ServiceInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Fetch the ServiceInstance * * @return ServiceInstance Fetched ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ServiceInstance { return $this->proxy()->fetch(); } /** * Update the ServiceInstance * * @param array|Options $options Optional Arguments * @return ServiceInstance Updated ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ServiceInstance { return $this->proxy()->update($options); } /** * Access the bindings */ protected function getBindings(): BindingList { return $this->proxy()->bindings; } /** * Access the notifications */ protected function getNotifications(): NotificationList { return $this->proxy()->notifications; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Notify.V1.ServiceInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Notify/V1/CredentialList.php000064400000013260150515725670014713 0ustar00solution = []; $this->uri = '/Credentials'; } /** * Streams CredentialInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads CredentialInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return CredentialInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of CredentialInstance records from the API. * Request is executed immediately * * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return CredentialPage Page of CredentialInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): CredentialPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new CredentialPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of CredentialInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return CredentialPage Page of CredentialInstance */ public function getPage(string $targetUrl): CredentialPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new CredentialPage($this->version, $response, $this->solution); } /** * Create the CredentialInstance * * @param string $type The Credential type * @param array|Options $options Optional Arguments * @return CredentialInstance Created CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $type, array $options = []): CredentialInstance { $options = new Values($options); $data = Values::of([ 'Type' => $type, 'FriendlyName' => $options['friendlyName'], 'Certificate' => $options['certificate'], 'PrivateKey' => $options['privateKey'], 'Sandbox' => Serialize::booleanToString($options['sandbox']), 'ApiKey' => $options['apiKey'], 'Secret' => $options['secret'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new CredentialInstance($this->version, $payload); } /** * Constructs a CredentialContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): CredentialContext { return new CredentialContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Notify.V1.CredentialList]'; } }src/Twilio/Rest/Notify/V1/CredentialContext.php000064400000005432150515725670015426 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Credentials/' . \rawurlencode($sid) . ''; } /** * Fetch the CredentialInstance * * @return CredentialInstance Fetched CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CredentialInstance { $payload = $this->version->fetch('GET', $this->uri); return new CredentialInstance($this->version, $payload, $this->solution['sid']); } /** * Update the CredentialInstance * * @param array|Options $options Optional Arguments * @return CredentialInstance Updated CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): CredentialInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'Certificate' => $options['certificate'], 'PrivateKey' => $options['privateKey'], 'Sandbox' => Serialize::booleanToString($options['sandbox']), 'ApiKey' => $options['apiKey'], 'Secret' => $options['secret'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new CredentialInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the CredentialInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Notify.V1.CredentialContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Notify/V1/Service/BindingList.php000064400000015450150515725670015616 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Bindings'; } /** * Create the BindingInstance * * @param string $identity The `identity` value that identifies the new * resource's User * @param string $bindingType The type of the Binding * @param string $address The channel-specific address * @param array|Options $options Optional Arguments * @return BindingInstance Created BindingInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $identity, string $bindingType, string $address, array $options = []): BindingInstance { $options = new Values($options); $data = Values::of([ 'Identity' => $identity, 'BindingType' => $bindingType, 'Address' => $address, 'Tag' => Serialize::map($options['tag'], function($e) { return $e; }), 'NotificationProtocolVersion' => $options['notificationProtocolVersion'], 'CredentialSid' => $options['credentialSid'], 'Endpoint' => $options['endpoint'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new BindingInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Streams BindingInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param array|Options $options Optional Arguments * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads BindingInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param array|Options $options Optional Arguments * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return BindingInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of BindingInstance records from the API. * Request is executed immediately * * @param array|Options $options Optional Arguments * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return BindingPage Page of BindingInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): BindingPage { $options = new Values($options); $params = Values::of([ 'StartDate' => Serialize::iso8601Date($options['startDate']), 'EndDate' => Serialize::iso8601Date($options['endDate']), 'Identity' => Serialize::map($options['identity'], function($e) { return $e; }), 'Tag' => Serialize::map($options['tag'], function($e) { return $e; }), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new BindingPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of BindingInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return BindingPage Page of BindingInstance */ public function getPage(string $targetUrl): BindingPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new BindingPage($this->version, $response, $this->solution); } /** * Constructs a BindingContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): BindingContext { return new BindingContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Notify.V1.BindingList]'; } }src/Twilio/Rest/Notify/V1/Service/NotificationPage.php000064400000002467150515725670016637 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return NotificationInstance \Twilio\Rest\Notify\V1\Service\NotificationInstance */ public function buildInstance(array $payload): NotificationInstance { return new NotificationInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Notify.V1.NotificationPage]'; } }src/Twilio/Rest/Notify/V1/Service/BindingContext.php000064400000004150150515725670016322 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Bindings/' . \rawurlencode($sid) . ''; } /** * Fetch the BindingInstance * * @return BindingInstance Fetched BindingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): BindingInstance { $payload = $this->version->fetch('GET', $this->uri); return new BindingInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Delete the BindingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Notify.V1.BindingContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Notify/V1/Service/NotificationInstance.php000064400000007176150515725670017531 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'identities' => Values::array_get($payload, 'identities'), 'tags' => Values::array_get($payload, 'tags'), 'segments' => Values::array_get($payload, 'segments'), 'priority' => Values::array_get($payload, 'priority'), 'ttl' => Values::array_get($payload, 'ttl'), 'title' => Values::array_get($payload, 'title'), 'body' => Values::array_get($payload, 'body'), 'sound' => Values::array_get($payload, 'sound'), 'action' => Values::array_get($payload, 'action'), 'data' => Values::array_get($payload, 'data'), 'apn' => Values::array_get($payload, 'apn'), 'gcm' => Values::array_get($payload, 'gcm'), 'fcm' => Values::array_get($payload, 'fcm'), 'sms' => Values::array_get($payload, 'sms'), 'facebookMessenger' => Values::array_get($payload, 'facebook_messenger'), 'alexa' => Values::array_get($payload, 'alexa'), ]; $this->solution = ['serviceSid' => $serviceSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Notify.V1.NotificationInstance]'; } }src/Twilio/Rest/Notify/V1/Service/NotificationOptions.php000064400000041631150515725670017412 0ustar00options['identity'] = $identity; $this->options['tag'] = $tag; $this->options['body'] = $body; $this->options['priority'] = $priority; $this->options['ttl'] = $ttl; $this->options['title'] = $title; $this->options['sound'] = $sound; $this->options['action'] = $action; $this->options['data'] = $data; $this->options['apn'] = $apn; $this->options['gcm'] = $gcm; $this->options['sms'] = $sms; $this->options['facebookMessenger'] = $facebookMessenger; $this->options['fcm'] = $fcm; $this->options['segment'] = $segment; $this->options['alexa'] = $alexa; $this->options['toBinding'] = $toBinding; $this->options['deliveryCallbackUrl'] = $deliveryCallbackUrl; } /** * The `identity` value that uniquely identifies the new resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/notify/api/service-resource). Delivery will be attempted only to Bindings with an Identity in this list. No more than 20 items are allowed in this list. * * @param string[] $identity The `identity` value that identifies the new * resource's User * @return $this Fluent Builder */ public function setIdentity(array $identity): self { $this->options['identity'] = $identity; return $this; } /** * A tag that selects the Bindings to notify. Repeat this parameter to specify more than one tag, up to a total of 5 tags. The implicit tag `all` is available to notify all Bindings in a Service instance. Similarly, the implicit tags `apn`, `fcm`, `gcm`, `sms` and `facebook-messenger` are available to notify all Bindings in a specific channel. * * @param string[] $tag A tag that selects the Bindings to notify * @return $this Fluent Builder */ public function setTag(array $tag): self { $this->options['tag'] = $tag; return $this; } /** * The notification text. For FCM and GCM, translates to `data.twi_body`. For APNS, translates to `aps.alert.body`. For SMS, translates to `body`. SMS requires either this `body` value, or `media_urls` attribute defined in the `sms` parameter of the notification. * * @param string $body The notification body text * @return $this Fluent Builder */ public function setBody(string $body): self { $this->options['body'] = $body; return $this; } /** * The priority of the notification. Can be: `low` or `high` and the default is `high`. A value of `low` optimizes the client app's battery consumption; however, notifications may be delivered with unspecified delay. For FCM and GCM, `low` priority is the same as `Normal` priority. For APNS `low` priority is the same as `5`. A value of `high` sends the notification immediately, and can wake up a sleeping device. For FCM and GCM, `high` is the same as `High` priority. For APNS, `high` is a priority `10`. SMS does not support this property. * * @param string $priority The priority of the notification * @return $this Fluent Builder */ public function setPriority(string $priority): self { $this->options['priority'] = $priority; return $this; } /** * How long, in seconds, the notification is valid. Can be an integer between 0 and 2,419,200, which is 4 weeks, the default and the maximum supported time to live (TTL). Delivery should be attempted if the device is offline until the TTL elapses. Zero means that the notification delivery is attempted immediately, only once, and is not stored for future delivery. SMS does not support this property. * * @param int $ttl How long, in seconds, the notification is valid * @return $this Fluent Builder */ public function setTtl(int $ttl): self { $this->options['ttl'] = $ttl; return $this; } /** * The notification title. For FCM and GCM, this translates to the `data.twi_title` value. For APNS, this translates to the `aps.alert.title` value. SMS does not support this property. This field is not visible on iOS phones and tablets but appears on Apple Watch and Android devices. * * @param string $title The notification title * @return $this Fluent Builder */ public function setTitle(string $title): self { $this->options['title'] = $title; return $this; } /** * The name of the sound to be played for the notification. For FCM and GCM, this Translates to `data.twi_sound`. For APNS, this translates to `aps.sound`. SMS does not support this property. * * @param string $sound The name of the sound to be played for the notification * @return $this Fluent Builder */ public function setSound(string $sound): self { $this->options['sound'] = $sound; return $this; } /** * The actions to display for the notification. For APNS, translates to the `aps.category` value. For GCM, translates to the `data.twi_action` value. For SMS, this parameter is not supported and is omitted from deliveries to those channels. * * @param string $action The actions to display for the notification * @return $this Fluent Builder */ public function setAction(string $action): self { $this->options['action'] = $action; return $this; } /** * The custom key-value pairs of the notification's payload. For FCM and GCM, this value translates to `data` in the FCM and GCM payloads. FCM and GCM [reserve certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref) that cannot be used in those channels. For APNS, attributes of `data` are inserted into the APNS payload as custom properties outside of the `aps` dictionary. In all channels, we reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed and are rejected as 400 Bad request with no delivery attempted. For SMS, this parameter is not supported and is omitted from deliveries to those channels. * * @param array $data The custom key-value pairs of the notification's payload * @return $this Fluent Builder */ public function setData(array $data): self { $this->options['data'] = $data; return $this; } /** * The APNS-specific payload that overrides corresponding attributes in the generic payload for APNS Bindings. This property maps to the APNS `Payload` item, therefore the `aps` key must be used to change standard attributes. Adds custom key-value pairs to the root of the dictionary. See the [APNS documentation](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html) for more details. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. * * @param array $apn The APNS-specific payload that overrides corresponding * attributes in a generic payload for APNS Bindings * @return $this Fluent Builder */ public function setApn(array $apn): self { $this->options['apn'] = $apn; return $this; } /** * The GCM-specific payload that overrides corresponding attributes in the generic payload for GCM Bindings. This property maps to the root JSON dictionary. See the [GCM documentation](https://firebase.google.com/docs/cloud-messaging/http-server-ref) for more details. Target parameters `to`, `registration_ids`, and `notification_key` are not allowed. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. GCM also [reserves certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref). * * @param array $gcm The GCM-specific payload that overrides corresponding * attributes in generic payload for GCM Bindings * @return $this Fluent Builder */ public function setGcm(array $gcm): self { $this->options['gcm'] = $gcm; return $this; } /** * The SMS-specific payload that overrides corresponding attributes in the generic payload for SMS Bindings. Each attribute in this value maps to the corresponding `form` parameter of the Twilio [Message](https://www.twilio.com/docs/sms/send-messages) resource. These parameters of the Message resource are supported in snake case format: `body`, `media_urls`, `status_callback`, and `max_price`. The `status_callback` parameter overrides the corresponding parameter in the messaging service, if configured. The `media_urls` property expects a JSON array. * * @param array $sms The SMS-specific payload that overrides corresponding * attributes in generic payload for SMS Bindings * @return $this Fluent Builder */ public function setSms(array $sms): self { $this->options['sms'] = $sms; return $this; } /** * Deprecated. * * @param array $facebookMessenger Deprecated * @return $this Fluent Builder */ public function setFacebookMessenger(array $facebookMessenger): self { $this->options['facebookMessenger'] = $facebookMessenger; return $this; } /** * The FCM-specific payload that overrides corresponding attributes in the generic payload for FCM Bindings. This property maps to the root JSON dictionary. See the [FCM documentation](https://firebase.google.com/docs/cloud-messaging/http-server-ref#downstream) for more details. Target parameters `to`, `registration_ids`, `condition`, and `notification_key` are not allowed in this parameter. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. FCM also [reserves certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref), which cannot be used in that channel. * * @param array $fcm The FCM-specific payload that overrides corresponding * attributes in generic payload for FCM Bindings * @return $this Fluent Builder */ public function setFcm(array $fcm): self { $this->options['fcm'] = $fcm; return $this; } /** * The Segment resource is deprecated. Use the `tag` parameter, instead. * * @param string[] $segment A Segment to notify * @return $this Fluent Builder */ public function setSegment(array $segment): self { $this->options['segment'] = $segment; return $this; } /** * Deprecated. * * @param array $alexa Deprecated * @return $this Fluent Builder */ public function setAlexa(array $alexa): self { $this->options['alexa'] = $alexa; return $this; } /** * The destination address specified as a JSON string. Multiple `to_binding` parameters can be included but the total size of the request entity should not exceed 1MB. This is typically sufficient for 10,000 phone numbers. * * @param string[] $toBinding The destination address specified as a JSON string * @return $this Fluent Builder */ public function setToBinding(array $toBinding): self { $this->options['toBinding'] = $toBinding; return $this; } /** * URL to send webhooks. * * @param string $deliveryCallbackUrl URL to send webhooks * @return $this Fluent Builder */ public function setDeliveryCallbackUrl(string $deliveryCallbackUrl): self { $this->options['deliveryCallbackUrl'] = $deliveryCallbackUrl; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Notify.V1.CreateNotificationOptions ' . $options . ']'; } }src/Twilio/Rest/Notify/V1/Service/BindingPage.php000064400000002431150515725670015552 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return BindingInstance \Twilio\Rest\Notify\V1\Service\BindingInstance */ public function buildInstance(array $payload): BindingInstance { return new BindingInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Notify.V1.BindingPage]'; } }src/Twilio/Rest/Notify/V1/Service/BindingInstance.php000064400000011122150515725670016437 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'credentialSid' => Values::array_get($payload, 'credential_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'notificationProtocolVersion' => Values::array_get($payload, 'notification_protocol_version'), 'endpoint' => Values::array_get($payload, 'endpoint'), 'identity' => Values::array_get($payload, 'identity'), 'bindingType' => Values::array_get($payload, 'binding_type'), 'address' => Values::array_get($payload, 'address'), 'tags' => Values::array_get($payload, 'tags'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return BindingContext Context for this BindingInstance */ protected function proxy(): BindingContext { if (!$this->context) { $this->context = new BindingContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the BindingInstance * * @return BindingInstance Fetched BindingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): BindingInstance { return $this->proxy()->fetch(); } /** * Delete the BindingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Notify.V1.BindingInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Notify/V1/Service/NotificationList.php000064400000005606150515725670016674 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Notifications'; } /** * Create the NotificationInstance * * @param array|Options $options Optional Arguments * @return NotificationInstance Created NotificationInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): NotificationInstance { $options = new Values($options); $data = Values::of([ 'Identity' => Serialize::map($options['identity'], function($e) { return $e; }), 'Tag' => Serialize::map($options['tag'], function($e) { return $e; }), 'Body' => $options['body'], 'Priority' => $options['priority'], 'Ttl' => $options['ttl'], 'Title' => $options['title'], 'Sound' => $options['sound'], 'Action' => $options['action'], 'Data' => Serialize::jsonObject($options['data']), 'Apn' => Serialize::jsonObject($options['apn']), 'Gcm' => Serialize::jsonObject($options['gcm']), 'Sms' => Serialize::jsonObject($options['sms']), 'FacebookMessenger' => Serialize::jsonObject($options['facebookMessenger']), 'Fcm' => Serialize::jsonObject($options['fcm']), 'Segment' => Serialize::map($options['segment'], function($e) { return $e; }), 'Alexa' => Serialize::jsonObject($options['alexa']), 'ToBinding' => Serialize::map($options['toBinding'], function($e) { return $e; }), 'DeliveryCallbackUrl' => $options['deliveryCallbackUrl'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new NotificationInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Notify.V1.NotificationList]'; } }src/Twilio/Rest/Notify/V1/Service/BindingOptions.php000064400000017773150515725670016350 0ustar00options['tag'] = $tag; $this->options['notificationProtocolVersion'] = $notificationProtocolVersion; $this->options['credentialSid'] = $credentialSid; $this->options['endpoint'] = $endpoint; } /** * A tag that can be used to select the Bindings to notify. Repeat this parameter to specify more than one tag, up to a total of 20 tags. * * @param string[] $tag A tag that can be used to select the Bindings to notify * @return $this Fluent Builder */ public function setTag(array $tag): self { $this->options['tag'] = $tag; return $this; } /** * The protocol version to use to send the notification. This defaults to the value of `default_xxxx_notification_protocol_version` for the protocol in the [Service](https://www.twilio.com/docs/notify/api/service-resource). The current version is `"3"` for `apn`, `fcm`, and `gcm` type Bindings. The parameter is not applicable to `sms` and `facebook-messenger` type Bindings as the data format is fixed. * * @param string $notificationProtocolVersion The protocol version to use to * send the notification * @return $this Fluent Builder */ public function setNotificationProtocolVersion(string $notificationProtocolVersion): self { $this->options['notificationProtocolVersion'] = $notificationProtocolVersion; return $this; } /** * The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) resource to be used to send notifications to this Binding. If present, this overrides the Credential specified in the Service resource. Applies to only `apn`, `fcm`, and `gcm` type Bindings. * * @param string $credentialSid The SID of the Credential resource to be used * to send notifications to this Binding * @return $this Fluent Builder */ public function setCredentialSid(string $credentialSid): self { $this->options['credentialSid'] = $credentialSid; return $this; } /** * Deprecated. * * @param string $endpoint Deprecated * @return $this Fluent Builder */ public function setEndpoint(string $endpoint): self { $this->options['endpoint'] = $endpoint; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Notify.V1.CreateBindingOptions ' . $options . ']'; } } class ReadBindingOptions extends Options { /** * @param \DateTime $startDate Only include usage that has occurred on or after * this date * @param \DateTime $endDate Only include usage that occurred on or before this * date * @param string[] $identity The `identity` value of the resources to read * @param string[] $tag Only list Bindings that have all of the specified Tags */ public function __construct(\DateTime $startDate = Values::NONE, \DateTime $endDate = Values::NONE, array $identity = Values::ARRAY_NONE, array $tag = Values::ARRAY_NONE) { $this->options['startDate'] = $startDate; $this->options['endDate'] = $endDate; $this->options['identity'] = $identity; $this->options['tag'] = $tag; } /** * Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`. * * @param \DateTime $startDate Only include usage that has occurred on or after * this date * @return $this Fluent Builder */ public function setStartDate(\DateTime $startDate): self { $this->options['startDate'] = $startDate; return $this; } /** * Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`. * * @param \DateTime $endDate Only include usage that occurred on or before this * date * @return $this Fluent Builder */ public function setEndDate(\DateTime $endDate): self { $this->options['endDate'] = $endDate; return $this; } /** * The [User](https://www.twilio.com/docs/chat/rest/user-resource)'s `identity` value of the resources to read. * * @param string[] $identity The `identity` value of the resources to read * @return $this Fluent Builder */ public function setIdentity(array $identity): self { $this->options['identity'] = $identity; return $this; } /** * Only list Bindings that have all of the specified Tags. The following implicit tags are available: `all`, `apn`, `fcm`, `gcm`, `sms`, `facebook-messenger`. Up to 5 tags are allowed. * * @param string[] $tag Only list Bindings that have all of the specified Tags * @return $this Fluent Builder */ public function setTag(array $tag): self { $this->options['tag'] = $tag; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Notify.V1.ReadBindingOptions ' . $options . ']'; } }src/Twilio/Rest/Notify/V1/ServiceContext.php000064400000013017150515725670014752 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($sid) . ''; } /** * Delete the ServiceInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Fetch the ServiceInstance * * @return ServiceInstance Fetched ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ServiceInstance { $payload = $this->version->fetch('GET', $this->uri); return new ServiceInstance($this->version, $payload, $this->solution['sid']); } /** * Update the ServiceInstance * * @param array|Options $options Optional Arguments * @return ServiceInstance Updated ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ServiceInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'ApnCredentialSid' => $options['apnCredentialSid'], 'GcmCredentialSid' => $options['gcmCredentialSid'], 'MessagingServiceSid' => $options['messagingServiceSid'], 'FacebookMessengerPageId' => $options['facebookMessengerPageId'], 'DefaultApnNotificationProtocolVersion' => $options['defaultApnNotificationProtocolVersion'], 'DefaultGcmNotificationProtocolVersion' => $options['defaultGcmNotificationProtocolVersion'], 'FcmCredentialSid' => $options['fcmCredentialSid'], 'DefaultFcmNotificationProtocolVersion' => $options['defaultFcmNotificationProtocolVersion'], 'LogEnabled' => Serialize::booleanToString($options['logEnabled']), 'AlexaSkillId' => $options['alexaSkillId'], 'DefaultAlexaNotificationProtocolVersion' => $options['defaultAlexaNotificationProtocolVersion'], 'DeliveryCallbackUrl' => $options['deliveryCallbackUrl'], 'DeliveryCallbackEnabled' => Serialize::booleanToString($options['deliveryCallbackEnabled']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ServiceInstance($this->version, $payload, $this->solution['sid']); } /** * Access the bindings */ protected function getBindings(): BindingList { if (!$this->_bindings) { $this->_bindings = new BindingList($this->version, $this->solution['sid']); } return $this->_bindings; } /** * Access the notifications */ protected function getNotifications(): NotificationList { if (!$this->_notifications) { $this->_notifications = new NotificationList($this->version, $this->solution['sid']); } return $this->_notifications; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Notify.V1.ServiceContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Notify/V1/ServiceOptions.php000064400000067705150515725670014776 0ustar00options['friendlyName'] = $friendlyName; $this->options['apnCredentialSid'] = $apnCredentialSid; $this->options['gcmCredentialSid'] = $gcmCredentialSid; $this->options['messagingServiceSid'] = $messagingServiceSid; $this->options['facebookMessengerPageId'] = $facebookMessengerPageId; $this->options['defaultApnNotificationProtocolVersion'] = $defaultApnNotificationProtocolVersion; $this->options['defaultGcmNotificationProtocolVersion'] = $defaultGcmNotificationProtocolVersion; $this->options['fcmCredentialSid'] = $fcmCredentialSid; $this->options['defaultFcmNotificationProtocolVersion'] = $defaultFcmNotificationProtocolVersion; $this->options['logEnabled'] = $logEnabled; $this->options['alexaSkillId'] = $alexaSkillId; $this->options['defaultAlexaNotificationProtocolVersion'] = $defaultAlexaNotificationProtocolVersion; $this->options['deliveryCallbackUrl'] = $deliveryCallbackUrl; $this->options['deliveryCallbackEnabled'] = $deliveryCallbackEnabled; } /** * A descriptive string that you create to describe the resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for APN Bindings. * * @param string $apnCredentialSid The SID of the Credential to use for APN * Bindings * @return $this Fluent Builder */ public function setApnCredentialSid(string $apnCredentialSid): self { $this->options['apnCredentialSid'] = $apnCredentialSid; return $this; } /** * The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for GCM Bindings. * * @param string $gcmCredentialSid The SID of the Credential to use for GCM * Bindings * @return $this Fluent Builder */ public function setGcmCredentialSid(string $gcmCredentialSid): self { $this->options['gcmCredentialSid'] = $gcmCredentialSid; return $this; } /** * The SID of the [Messaging Service](https://www.twilio.com/docs/sms/send-messages#messaging-services) to use for SMS Bindings. This parameter must be set in order to send SMS notifications. * * @param string $messagingServiceSid The SID of the Messaging Service to use * for SMS Bindings * @return $this Fluent Builder */ public function setMessagingServiceSid(string $messagingServiceSid): self { $this->options['messagingServiceSid'] = $messagingServiceSid; return $this; } /** * Deprecated. * * @param string $facebookMessengerPageId Deprecated * @return $this Fluent Builder */ public function setFacebookMessengerPageId(string $facebookMessengerPageId): self { $this->options['facebookMessengerPageId'] = $facebookMessengerPageId; return $this; } /** * The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. * * @param string $defaultApnNotificationProtocolVersion The protocol version to * use for sending APNS * notifications * @return $this Fluent Builder */ public function setDefaultApnNotificationProtocolVersion(string $defaultApnNotificationProtocolVersion): self { $this->options['defaultApnNotificationProtocolVersion'] = $defaultApnNotificationProtocolVersion; return $this; } /** * The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. * * @param string $defaultGcmNotificationProtocolVersion The protocol version to * use for sending GCM * notifications * @return $this Fluent Builder */ public function setDefaultGcmNotificationProtocolVersion(string $defaultGcmNotificationProtocolVersion): self { $this->options['defaultGcmNotificationProtocolVersion'] = $defaultGcmNotificationProtocolVersion; return $this; } /** * The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for FCM Bindings. * * @param string $fcmCredentialSid The SID of the Credential to use for FCM * Bindings * @return $this Fluent Builder */ public function setFcmCredentialSid(string $fcmCredentialSid): self { $this->options['fcmCredentialSid'] = $fcmCredentialSid; return $this; } /** * The protocol version to use for sending FCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. * * @param string $defaultFcmNotificationProtocolVersion The protocol version to * use for sending FCM * notifications * @return $this Fluent Builder */ public function setDefaultFcmNotificationProtocolVersion(string $defaultFcmNotificationProtocolVersion): self { $this->options['defaultFcmNotificationProtocolVersion'] = $defaultFcmNotificationProtocolVersion; return $this; } /** * Whether to log notifications. Can be: `true` or `false` and the default is `true`. * * @param bool $logEnabled Whether to log notifications * @return $this Fluent Builder */ public function setLogEnabled(bool $logEnabled): self { $this->options['logEnabled'] = $logEnabled; return $this; } /** * Deprecated. * * @param string $alexaSkillId Deprecated * @return $this Fluent Builder */ public function setAlexaSkillId(string $alexaSkillId): self { $this->options['alexaSkillId'] = $alexaSkillId; return $this; } /** * Deprecated. * * @param string $defaultAlexaNotificationProtocolVersion Deprecated * @return $this Fluent Builder */ public function setDefaultAlexaNotificationProtocolVersion(string $defaultAlexaNotificationProtocolVersion): self { $this->options['defaultAlexaNotificationProtocolVersion'] = $defaultAlexaNotificationProtocolVersion; return $this; } /** * URL to send delivery status callback. * * @param string $deliveryCallbackUrl Webhook URL * @return $this Fluent Builder */ public function setDeliveryCallbackUrl(string $deliveryCallbackUrl): self { $this->options['deliveryCallbackUrl'] = $deliveryCallbackUrl; return $this; } /** * Callback configuration that enables delivery callbacks, default false * * @param bool $deliveryCallbackEnabled Enable delivery callbacks * @return $this Fluent Builder */ public function setDeliveryCallbackEnabled(bool $deliveryCallbackEnabled): self { $this->options['deliveryCallbackEnabled'] = $deliveryCallbackEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Notify.V1.CreateServiceOptions ' . $options . ']'; } } class ReadServiceOptions extends Options { /** * @param string $friendlyName The string that identifies the Service resources * to read */ public function __construct(string $friendlyName = Values::NONE) { $this->options['friendlyName'] = $friendlyName; } /** * The string that identifies the Service resources to read. * * @param string $friendlyName The string that identifies the Service resources * to read * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Notify.V1.ReadServiceOptions ' . $options . ']'; } } class UpdateServiceOptions extends Options { /** * @param string $friendlyName A string to describe the resource * @param string $apnCredentialSid The SID of the Credential to use for APN * Bindings * @param string $gcmCredentialSid The SID of the Credential to use for GCM * Bindings * @param string $messagingServiceSid The SID of the Messaging Service to use * for SMS Bindings * @param string $facebookMessengerPageId Deprecated * @param string $defaultApnNotificationProtocolVersion The protocol version to * use for sending APNS * notifications * @param string $defaultGcmNotificationProtocolVersion The protocol version to * use for sending GCM * notifications * @param string $fcmCredentialSid The SID of the Credential to use for FCM * Bindings * @param string $defaultFcmNotificationProtocolVersion The protocol version to * use for sending FCM * notifications * @param bool $logEnabled Whether to log notifications * @param string $alexaSkillId Deprecated * @param string $defaultAlexaNotificationProtocolVersion Deprecated * @param string $deliveryCallbackUrl Webhook URL * @param bool $deliveryCallbackEnabled Enable delivery callbacks */ public function __construct(string $friendlyName = Values::NONE, string $apnCredentialSid = Values::NONE, string $gcmCredentialSid = Values::NONE, string $messagingServiceSid = Values::NONE, string $facebookMessengerPageId = Values::NONE, string $defaultApnNotificationProtocolVersion = Values::NONE, string $defaultGcmNotificationProtocolVersion = Values::NONE, string $fcmCredentialSid = Values::NONE, string $defaultFcmNotificationProtocolVersion = Values::NONE, bool $logEnabled = Values::NONE, string $alexaSkillId = Values::NONE, string $defaultAlexaNotificationProtocolVersion = Values::NONE, string $deliveryCallbackUrl = Values::NONE, bool $deliveryCallbackEnabled = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['apnCredentialSid'] = $apnCredentialSid; $this->options['gcmCredentialSid'] = $gcmCredentialSid; $this->options['messagingServiceSid'] = $messagingServiceSid; $this->options['facebookMessengerPageId'] = $facebookMessengerPageId; $this->options['defaultApnNotificationProtocolVersion'] = $defaultApnNotificationProtocolVersion; $this->options['defaultGcmNotificationProtocolVersion'] = $defaultGcmNotificationProtocolVersion; $this->options['fcmCredentialSid'] = $fcmCredentialSid; $this->options['defaultFcmNotificationProtocolVersion'] = $defaultFcmNotificationProtocolVersion; $this->options['logEnabled'] = $logEnabled; $this->options['alexaSkillId'] = $alexaSkillId; $this->options['defaultAlexaNotificationProtocolVersion'] = $defaultAlexaNotificationProtocolVersion; $this->options['deliveryCallbackUrl'] = $deliveryCallbackUrl; $this->options['deliveryCallbackEnabled'] = $deliveryCallbackEnabled; } /** * A descriptive string that you create to describe the resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for APN Bindings. * * @param string $apnCredentialSid The SID of the Credential to use for APN * Bindings * @return $this Fluent Builder */ public function setApnCredentialSid(string $apnCredentialSid): self { $this->options['apnCredentialSid'] = $apnCredentialSid; return $this; } /** * The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for GCM Bindings. * * @param string $gcmCredentialSid The SID of the Credential to use for GCM * Bindings * @return $this Fluent Builder */ public function setGcmCredentialSid(string $gcmCredentialSid): self { $this->options['gcmCredentialSid'] = $gcmCredentialSid; return $this; } /** * The SID of the [Messaging Service](https://www.twilio.com/docs/sms/send-messages#messaging-services) to use for SMS Bindings. This parameter must be set in order to send SMS notifications. * * @param string $messagingServiceSid The SID of the Messaging Service to use * for SMS Bindings * @return $this Fluent Builder */ public function setMessagingServiceSid(string $messagingServiceSid): self { $this->options['messagingServiceSid'] = $messagingServiceSid; return $this; } /** * Deprecated. * * @param string $facebookMessengerPageId Deprecated * @return $this Fluent Builder */ public function setFacebookMessengerPageId(string $facebookMessengerPageId): self { $this->options['facebookMessengerPageId'] = $facebookMessengerPageId; return $this; } /** * The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. * * @param string $defaultApnNotificationProtocolVersion The protocol version to * use for sending APNS * notifications * @return $this Fluent Builder */ public function setDefaultApnNotificationProtocolVersion(string $defaultApnNotificationProtocolVersion): self { $this->options['defaultApnNotificationProtocolVersion'] = $defaultApnNotificationProtocolVersion; return $this; } /** * The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. * * @param string $defaultGcmNotificationProtocolVersion The protocol version to * use for sending GCM * notifications * @return $this Fluent Builder */ public function setDefaultGcmNotificationProtocolVersion(string $defaultGcmNotificationProtocolVersion): self { $this->options['defaultGcmNotificationProtocolVersion'] = $defaultGcmNotificationProtocolVersion; return $this; } /** * The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for FCM Bindings. * * @param string $fcmCredentialSid The SID of the Credential to use for FCM * Bindings * @return $this Fluent Builder */ public function setFcmCredentialSid(string $fcmCredentialSid): self { $this->options['fcmCredentialSid'] = $fcmCredentialSid; return $this; } /** * The protocol version to use for sending FCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. * * @param string $defaultFcmNotificationProtocolVersion The protocol version to * use for sending FCM * notifications * @return $this Fluent Builder */ public function setDefaultFcmNotificationProtocolVersion(string $defaultFcmNotificationProtocolVersion): self { $this->options['defaultFcmNotificationProtocolVersion'] = $defaultFcmNotificationProtocolVersion; return $this; } /** * Whether to log notifications. Can be: `true` or `false` and the default is `true`. * * @param bool $logEnabled Whether to log notifications * @return $this Fluent Builder */ public function setLogEnabled(bool $logEnabled): self { $this->options['logEnabled'] = $logEnabled; return $this; } /** * Deprecated. * * @param string $alexaSkillId Deprecated * @return $this Fluent Builder */ public function setAlexaSkillId(string $alexaSkillId): self { $this->options['alexaSkillId'] = $alexaSkillId; return $this; } /** * Deprecated. * * @param string $defaultAlexaNotificationProtocolVersion Deprecated * @return $this Fluent Builder */ public function setDefaultAlexaNotificationProtocolVersion(string $defaultAlexaNotificationProtocolVersion): self { $this->options['defaultAlexaNotificationProtocolVersion'] = $defaultAlexaNotificationProtocolVersion; return $this; } /** * URL to send delivery status callback. * * @param string $deliveryCallbackUrl Webhook URL * @return $this Fluent Builder */ public function setDeliveryCallbackUrl(string $deliveryCallbackUrl): self { $this->options['deliveryCallbackUrl'] = $deliveryCallbackUrl; return $this; } /** * Callback configuration that enables delivery callbacks, default false * * @param bool $deliveryCallbackEnabled Enable delivery callbacks * @return $this Fluent Builder */ public function setDeliveryCallbackEnabled(bool $deliveryCallbackEnabled): self { $this->options['deliveryCallbackEnabled'] = $deliveryCallbackEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Notify.V1.UpdateServiceOptions ' . $options . ']'; } }src/Twilio/Rest/Notify/V1/CredentialOptions.php000064400000027071150515725670015440 0ustar00options['friendlyName'] = $friendlyName; $this->options['certificate'] = $certificate; $this->options['privateKey'] = $privateKey; $this->options['sandbox'] = $sandbox; $this->options['apiKey'] = $apiKey; $this->options['secret'] = $secret; } /** * A descriptive string that you create to describe the resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * [APN only] The URL-encoded representation of the certificate. Strip everything outside of the headers, e.g. `-----BEGIN CERTIFICATE-----MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEFBQAwgZYxCzAJBgNV.....A==-----END CERTIFICATE-----` * * @param string $certificate [APN only] The URL-encoded representation of the * certificate * @return $this Fluent Builder */ public function setCertificate(string $certificate): self { $this->options['certificate'] = $certificate; return $this; } /** * [APN only] The URL-encoded representation of the private key. Strip everything outside of the headers, e.g. `-----BEGIN RSA PRIVATE KEY-----MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fGgvCI1l9s+cmBY3WIz+cUDqmxiieR\n.-----END RSA PRIVATE KEY-----` * * @param string $privateKey [APN only] URL-encoded representation of the * private key * @return $this Fluent Builder */ public function setPrivateKey(string $privateKey): self { $this->options['privateKey'] = $privateKey; return $this; } /** * [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. * * @param bool $sandbox [APN only] Whether to send the credential to sandbox * APNs * @return $this Fluent Builder */ public function setSandbox(bool $sandbox): self { $this->options['sandbox'] = $sandbox; return $this; } /** * [GCM only] The `Server key` of your project from Firebase console under Settings / Cloud messaging. * * @param string $apiKey [GCM only] The `Server key` of your project from * Firebase console under Settings / Cloud messaging * @return $this Fluent Builder */ public function setApiKey(string $apiKey): self { $this->options['apiKey'] = $apiKey; return $this; } /** * [FCM only] The `Server key` of your project from Firebase console under Settings / Cloud messaging. * * @param string $secret [FCM only] The `Server key` of your project from * Firebase console under Settings / Cloud messaging * @return $this Fluent Builder */ public function setSecret(string $secret): self { $this->options['secret'] = $secret; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Notify.V1.CreateCredentialOptions ' . $options . ']'; } } class UpdateCredentialOptions extends Options { /** * @param string $friendlyName A string to describe the resource * @param string $certificate [APN only] The URL-encoded representation of the * certificate * @param string $privateKey [APN only] URL-encoded representation of the * private key * @param bool $sandbox [APN only] Whether to send the credential to sandbox * APNs * @param string $apiKey [GCM only] The `Server key` of your project from * Firebase console under Settings / Cloud messaging * @param string $secret [FCM only] The `Server key` of your project from * Firebase console under Settings / Cloud messaging */ public function __construct(string $friendlyName = Values::NONE, string $certificate = Values::NONE, string $privateKey = Values::NONE, bool $sandbox = Values::NONE, string $apiKey = Values::NONE, string $secret = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['certificate'] = $certificate; $this->options['privateKey'] = $privateKey; $this->options['sandbox'] = $sandbox; $this->options['apiKey'] = $apiKey; $this->options['secret'] = $secret; } /** * A descriptive string that you create to describe the resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * [APN only] The URL-encoded representation of the certificate. Strip everything outside of the headers, e.g. `-----BEGIN CERTIFICATE-----MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEFBQAwgZYxCzAJBgNV.....A==-----END CERTIFICATE-----` * * @param string $certificate [APN only] The URL-encoded representation of the * certificate * @return $this Fluent Builder */ public function setCertificate(string $certificate): self { $this->options['certificate'] = $certificate; return $this; } /** * [APN only] The URL-encoded representation of the private key. Strip everything outside of the headers, e.g. `-----BEGIN RSA PRIVATE KEY-----MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fGgvCI1l9s+cmBY3WIz+cUDqmxiieR\n.-----END RSA PRIVATE KEY-----` * * @param string $privateKey [APN only] URL-encoded representation of the * private key * @return $this Fluent Builder */ public function setPrivateKey(string $privateKey): self { $this->options['privateKey'] = $privateKey; return $this; } /** * [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. * * @param bool $sandbox [APN only] Whether to send the credential to sandbox * APNs * @return $this Fluent Builder */ public function setSandbox(bool $sandbox): self { $this->options['sandbox'] = $sandbox; return $this; } /** * [GCM only] The `Server key` of your project from Firebase console under Settings / Cloud messaging. * * @param string $apiKey [GCM only] The `Server key` of your project from * Firebase console under Settings / Cloud messaging * @return $this Fluent Builder */ public function setApiKey(string $apiKey): self { $this->options['apiKey'] = $apiKey; return $this; } /** * [FCM only] The `Server key` of your project from Firebase console under Settings / Cloud messaging. * * @param string $secret [FCM only] The `Server key` of your project from * Firebase console under Settings / Cloud messaging * @return $this Fluent Builder */ public function setSecret(string $secret): self { $this->options['secret'] = $secret; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Notify.V1.UpdateCredentialOptions ' . $options . ']'; } }src/Twilio/Rest/Notify/V1/ServicePage.php000064400000002352150515725670014202 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ServiceInstance \Twilio\Rest\Notify\V1\ServiceInstance */ public function buildInstance(array $payload): ServiceInstance { return new ServiceInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Notify.V1.ServicePage]'; } }src/Twilio/Rest/Notify/V1/CredentialPage.php000064400000002374150515725670014660 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CredentialInstance \Twilio\Rest\Notify\V1\CredentialInstance */ public function buildInstance(array $payload): CredentialInstance { return new CredentialInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Notify.V1.CredentialPage]'; } }src/Twilio/Rest/Notify/V1/ServiceList.php000064400000015301150515725670014237 0ustar00solution = []; $this->uri = '/Services'; } /** * Create the ServiceInstance * * @param array|Options $options Optional Arguments * @return ServiceInstance Created ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): ServiceInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'ApnCredentialSid' => $options['apnCredentialSid'], 'GcmCredentialSid' => $options['gcmCredentialSid'], 'MessagingServiceSid' => $options['messagingServiceSid'], 'FacebookMessengerPageId' => $options['facebookMessengerPageId'], 'DefaultApnNotificationProtocolVersion' => $options['defaultApnNotificationProtocolVersion'], 'DefaultGcmNotificationProtocolVersion' => $options['defaultGcmNotificationProtocolVersion'], 'FcmCredentialSid' => $options['fcmCredentialSid'], 'DefaultFcmNotificationProtocolVersion' => $options['defaultFcmNotificationProtocolVersion'], 'LogEnabled' => Serialize::booleanToString($options['logEnabled']), 'AlexaSkillId' => $options['alexaSkillId'], 'DefaultAlexaNotificationProtocolVersion' => $options['defaultAlexaNotificationProtocolVersion'], 'DeliveryCallbackUrl' => $options['deliveryCallbackUrl'], 'DeliveryCallbackEnabled' => Serialize::booleanToString($options['deliveryCallbackEnabled']), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ServiceInstance($this->version, $payload); } /** * Streams ServiceInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param array|Options $options Optional Arguments * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ServiceInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param array|Options $options Optional Arguments * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return ServiceInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of ServiceInstance records from the API. * Request is executed immediately * * @param array|Options $options Optional Arguments * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return ServicePage Page of ServiceInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ServicePage { $options = new Values($options); $params = Values::of([ 'FriendlyName' => $options['friendlyName'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ServicePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ServiceInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ServicePage Page of ServiceInstance */ public function getPage(string $targetUrl): ServicePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ServicePage($this->version, $response, $this->solution); } /** * Constructs a ServiceContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): ServiceContext { return new ServiceContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Notify.V1.ServiceList]'; } }src/Twilio/Rest/Notify/V1/CredentialInstance.php000064400000010122150515725670015536 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'type' => Values::array_get($payload, 'type'), 'sandbox' => Values::array_get($payload, 'sandbox'), '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 = ['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 CredentialContext Context for this CredentialInstance */ protected function proxy(): CredentialContext { if (!$this->context) { $this->context = new CredentialContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the CredentialInstance * * @return CredentialInstance Fetched CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CredentialInstance { return $this->proxy()->fetch(); } /** * Update the CredentialInstance * * @param array|Options $options Optional Arguments * @return CredentialInstance Updated CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): CredentialInstance { return $this->proxy()->update($options); } /** * Delete the CredentialInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Notify.V1.CredentialInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Notify/V1.php000064400000005055150515725670012010 0ustar00version = 'v1'; } protected function getCredentials(): CredentialList { if (!$this->_credentials) { $this->_credentials = new CredentialList($this); } return $this->_credentials; } protected function getServices(): ServiceList { if (!$this->_services) { $this->_services = new ServiceList($this); } return $this->_services; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Notify.V1]'; } }src/Twilio/Rest/FrontlineApi.php000064400000005005150515725670012637 0ustar00baseUrl = 'https://frontline-api.twilio.com'; } /** * @return V1 Version v1 of frontline_api */ protected function getV1(): V1 { 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 TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } protected function getUsers(): \Twilio\Rest\FrontlineApi\V1\UserList { return $this->v1->users; } /** * @param string $sid The SID of the User resource to fetch */ protected function contextUsers(string $sid): \Twilio\Rest\FrontlineApi\V1\UserContext { return $this->v1->users($sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.FrontlineApi]'; } }src/Twilio/Rest/Insights/V1/RoomPage.php000064400000002336150515725670014040 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return RoomInstance \Twilio\Rest\Insights\V1\RoomInstance */ public function buildInstance(array $payload): RoomInstance { return new RoomInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Insights.V1.RoomPage]'; } }src/Twilio/Rest/Insights/V1/CallSummariesInstance.php000064400000007154150515725670016560 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'callSid' => Values::array_get($payload, 'call_sid'), 'callType' => Values::array_get($payload, 'call_type'), 'callState' => Values::array_get($payload, 'call_state'), 'processingState' => Values::array_get($payload, 'processing_state'), 'createdTime' => Deserialize::dateTime(Values::array_get($payload, 'created_time')), 'startTime' => Deserialize::dateTime(Values::array_get($payload, 'start_time')), 'endTime' => Deserialize::dateTime(Values::array_get($payload, 'end_time')), 'duration' => Values::array_get($payload, 'duration'), 'connectDuration' => Values::array_get($payload, 'connect_duration'), 'from' => Values::array_get($payload, 'from'), 'to' => Values::array_get($payload, 'to'), 'carrierEdge' => Values::array_get($payload, 'carrier_edge'), 'clientEdge' => Values::array_get($payload, 'client_edge'), 'sdkEdge' => Values::array_get($payload, 'sdk_edge'), 'sipEdge' => Values::array_get($payload, 'sip_edge'), 'tags' => Values::array_get($payload, 'tags'), 'url' => Values::array_get($payload, 'url'), 'attributes' => Values::array_get($payload, 'attributes'), 'properties' => Values::array_get($payload, 'properties'), 'trust' => Values::array_get($payload, 'trust'), ]; $this->solution = []; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Insights.V1.CallSummariesInstance]'; } }src/Twilio/Rest/Insights/V1/SettingContext.php000064400000004464150515725670015315 0ustar00solution = []; $this->uri = '/Voice/Settings'; } /** * Fetch the SettingInstance * * @param array|Options $options Optional Arguments * @return SettingInstance Fetched SettingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): SettingInstance { $options = new Values($options); $params = Values::of(['SubaccountSid' => $options['subaccountSid'], ]); $payload = $this->version->fetch('GET', $this->uri, $params); return new SettingInstance($this->version, $payload); } /** * Update the SettingInstance * * @param array|Options $options Optional Arguments * @return SettingInstance Updated SettingInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SettingInstance { $options = new Values($options); $data = Values::of([ 'AdvancedFeatures' => Serialize::booleanToString($options['advancedFeatures']), 'VoiceTrace' => Serialize::booleanToString($options['voiceTrace']), 'SubaccountSid' => $options['subaccountSid'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new SettingInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Insights.V1.SettingContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Insights/V1/CallSummariesOptions.php000064400000023011150515725670016435 0ustar00options['from'] = $from; $this->options['to'] = $to; $this->options['fromCarrier'] = $fromCarrier; $this->options['toCarrier'] = $toCarrier; $this->options['fromCountryCode'] = $fromCountryCode; $this->options['toCountryCode'] = $toCountryCode; $this->options['branded'] = $branded; $this->options['verifiedCaller'] = $verifiedCaller; $this->options['hasTag'] = $hasTag; $this->options['startTime'] = $startTime; $this->options['endTime'] = $endTime; $this->options['callType'] = $callType; $this->options['callState'] = $callState; $this->options['direction'] = $direction; $this->options['processingState'] = $processingState; $this->options['sortBy'] = $sortBy; $this->options['subaccount'] = $subaccount; $this->options['abnormalSession'] = $abnormalSession; } /** * The from * * @param string $from The from * @return $this Fluent Builder */ public function setFrom(string $from): self { $this->options['from'] = $from; return $this; } /** * The to * * @param string $to The to * @return $this Fluent Builder */ public function setTo(string $to): self { $this->options['to'] = $to; return $this; } /** * The from_carrier * * @param string $fromCarrier The from_carrier * @return $this Fluent Builder */ public function setFromCarrier(string $fromCarrier): self { $this->options['fromCarrier'] = $fromCarrier; return $this; } /** * The to_carrier * * @param string $toCarrier The to_carrier * @return $this Fluent Builder */ public function setToCarrier(string $toCarrier): self { $this->options['toCarrier'] = $toCarrier; return $this; } /** * The from_country_code * * @param string $fromCountryCode The from_country_code * @return $this Fluent Builder */ public function setFromCountryCode(string $fromCountryCode): self { $this->options['fromCountryCode'] = $fromCountryCode; return $this; } /** * The to_country_code * * @param string $toCountryCode The to_country_code * @return $this Fluent Builder */ public function setToCountryCode(string $toCountryCode): self { $this->options['toCountryCode'] = $toCountryCode; return $this; } /** * The branded * * @param bool $branded The branded * @return $this Fluent Builder */ public function setBranded(bool $branded): self { $this->options['branded'] = $branded; return $this; } /** * The verified_caller * * @param bool $verifiedCaller The verified_caller * @return $this Fluent Builder */ public function setVerifiedCaller(bool $verifiedCaller): self { $this->options['verifiedCaller'] = $verifiedCaller; return $this; } /** * The has_tag * * @param bool $hasTag The has_tag * @return $this Fluent Builder */ public function setHasTag(bool $hasTag): self { $this->options['hasTag'] = $hasTag; return $this; } /** * The start_time * * @param string $startTime The start_time * @return $this Fluent Builder */ public function setStartTime(string $startTime): self { $this->options['startTime'] = $startTime; return $this; } /** * The end_time * * @param string $endTime The end_time * @return $this Fluent Builder */ public function setEndTime(string $endTime): self { $this->options['endTime'] = $endTime; return $this; } /** * The call_type * * @param string $callType The call_type * @return $this Fluent Builder */ public function setCallType(string $callType): self { $this->options['callType'] = $callType; return $this; } /** * The call_state * * @param string $callState The call_state * @return $this Fluent Builder */ public function setCallState(string $callState): self { $this->options['callState'] = $callState; return $this; } /** * The direction * * @param string $direction The direction * @return $this Fluent Builder */ public function setDirection(string $direction): self { $this->options['direction'] = $direction; return $this; } /** * The processing_state * * @param string $processingState The processing_state * @return $this Fluent Builder */ public function setProcessingState(string $processingState): self { $this->options['processingState'] = $processingState; return $this; } /** * The sort_by * * @param string $sortBy The sort_by * @return $this Fluent Builder */ public function setSortBy(string $sortBy): self { $this->options['sortBy'] = $sortBy; return $this; } /** * The subaccount * * @param string $subaccount The subaccount * @return $this Fluent Builder */ public function setSubaccount(string $subaccount): self { $this->options['subaccount'] = $subaccount; return $this; } /** * The abnormal_session * * @param bool $abnormalSession The abnormal_session * @return $this Fluent Builder */ public function setAbnormalSession(bool $abnormalSession): self { $this->options['abnormalSession'] = $abnormalSession; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Insights.V1.ReadCallSummariesOptions ' . $options . ']'; } }src/Twilio/Rest/Insights/V1/Room/ParticipantContext.php000064400000003611150515725670017063 0ustar00solution = ['roomSid' => $roomSid, 'participantSid' => $participantSid, ]; $this->uri = '/Video/Rooms/' . \rawurlencode($roomSid) . '/Participants/' . \rawurlencode($participantSid) . ''; } /** * Fetch the ParticipantInstance * * @return ParticipantInstance Fetched ParticipantInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ParticipantInstance { $payload = $this->version->fetch('GET', $this->uri); return new ParticipantInstance( $this->version, $payload, $this->solution['roomSid'], $this->solution['participantSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Insights.V1.ParticipantContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Insights/V1/Room/ParticipantPage.php000064400000002456150515725670016321 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ParticipantInstance \Twilio\Rest\Insights\V1\Room\ParticipantInstance */ public function buildInstance(array $payload): ParticipantInstance { return new ParticipantInstance($this->version, $payload, $this->solution['roomSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Insights.V1.ParticipantPage]'; } }src/Twilio/Rest/Insights/V1/Room/ParticipantList.php000064400000011613150515725670016353 0ustar00solution = ['roomSid' => $roomSid, ]; $this->uri = '/Video/Rooms/' . \rawurlencode($roomSid) . '/Participants'; } /** * Streams ParticipantInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ParticipantInstance 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 ParticipantInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of ParticipantInstance 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 ParticipantPage Page of ParticipantInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ParticipantPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ParticipantPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ParticipantInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ParticipantPage Page of ParticipantInstance */ public function getPage(string $targetUrl): ParticipantPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ParticipantPage($this->version, $response, $this->solution); } /** * Constructs a ParticipantContext * * @param string $participantSid The SID of the Participant resource. */ public function getContext(string $participantSid): ParticipantContext { return new ParticipantContext($this->version, $this->solution['roomSid'], $participantSid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Insights.V1.ParticipantList]'; } }src/Twilio/Rest/Insights/V1/Room/ParticipantInstance.php000064400000011326150515725670017205 0ustar00properties = [ 'participantSid' => Values::array_get($payload, 'participant_sid'), 'participantIdentity' => Values::array_get($payload, 'participant_identity'), 'joinTime' => Deserialize::dateTime(Values::array_get($payload, 'join_time')), 'leaveTime' => Deserialize::dateTime(Values::array_get($payload, 'leave_time')), 'durationSec' => Values::array_get($payload, 'duration_sec'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'roomSid' => Values::array_get($payload, 'room_sid'), 'status' => Values::array_get($payload, 'status'), 'codecs' => Values::array_get($payload, 'codecs'), 'endReason' => Values::array_get($payload, 'end_reason'), 'errorCode' => Values::array_get($payload, 'error_code'), 'errorCodeUrl' => Values::array_get($payload, 'error_code_url'), 'mediaRegion' => Values::array_get($payload, 'media_region'), 'properties' => Values::array_get($payload, 'properties'), 'edgeLocation' => Values::array_get($payload, 'edge_location'), 'publisherInfo' => Values::array_get($payload, 'publisher_info'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'roomSid' => $roomSid, 'participantSid' => $participantSid ?: $this->properties['participantSid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return ParticipantContext Context for this ParticipantInstance */ protected function proxy(): ParticipantContext { if (!$this->context) { $this->context = new ParticipantContext( $this->version, $this->solution['roomSid'], $this->solution['participantSid'] ); } return $this->context; } /** * Fetch the ParticipantInstance * * @return ParticipantInstance Fetched ParticipantInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ParticipantInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Insights.V1.ParticipantInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Insights/V1/RoomInstance.php000064400000013441150515725670014727 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'roomSid' => Values::array_get($payload, 'room_sid'), 'roomName' => Values::array_get($payload, 'room_name'), 'createTime' => Deserialize::dateTime(Values::array_get($payload, 'create_time')), 'endTime' => Deserialize::dateTime(Values::array_get($payload, 'end_time')), 'roomType' => Values::array_get($payload, 'room_type'), 'roomStatus' => Values::array_get($payload, 'room_status'), 'statusCallback' => Values::array_get($payload, 'status_callback'), 'statusCallbackMethod' => Values::array_get($payload, 'status_callback_method'), 'createdMethod' => Values::array_get($payload, 'created_method'), 'endReason' => Values::array_get($payload, 'end_reason'), 'maxParticipants' => Values::array_get($payload, 'max_participants'), 'uniqueParticipants' => Values::array_get($payload, 'unique_participants'), 'uniqueParticipantIdentities' => Values::array_get($payload, 'unique_participant_identities'), 'concurrentParticipants' => Values::array_get($payload, 'concurrent_participants'), 'maxConcurrentParticipants' => Values::array_get($payload, 'max_concurrent_participants'), 'codecs' => Values::array_get($payload, 'codecs'), 'mediaRegion' => Values::array_get($payload, 'media_region'), 'durationSec' => Values::array_get($payload, 'duration_sec'), 'totalParticipantDurationSec' => Values::array_get($payload, 'total_participant_duration_sec'), 'totalRecordingDurationSec' => Values::array_get($payload, 'total_recording_duration_sec'), 'processingState' => Values::array_get($payload, 'processing_state'), 'recordingEnabled' => Values::array_get($payload, 'recording_enabled'), 'edgeLocation' => Values::array_get($payload, 'edge_location'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['roomSid' => $roomSid ?: $this->properties['roomSid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return RoomContext Context for this RoomInstance */ protected function proxy(): RoomContext { if (!$this->context) { $this->context = new RoomContext($this->version, $this->solution['roomSid']); } return $this->context; } /** * Fetch the RoomInstance * * @return RoomInstance Fetched RoomInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RoomInstance { return $this->proxy()->fetch(); } /** * Access the participants */ protected function getParticipants(): ParticipantList { return $this->proxy()->participants; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Insights.V1.RoomInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Insights/V1/CallPage.php000064400000002470150515725670013776 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CallInstance \Twilio\Rest\Insights\V1\CallInstance */ public function buildInstance(array $payload): CallInstance { return new CallInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Insights.V1.CallPage]'; } }src/Twilio/Rest/Insights/V1/RoomOptions.php000064400000010252150515725670014613 0ustar00options['roomType'] = $roomType; $this->options['codec'] = $codec; $this->options['roomName'] = $roomName; $this->options['createdAfter'] = $createdAfter; $this->options['createdBefore'] = $createdBefore; } /** * Type of room. Can be `go`, `peer_to_peer`, `group`, or `group_small`. * * @param string[] $roomType Type of room. * @return $this Fluent Builder */ public function setRoomType(array $roomType): self { $this->options['roomType'] = $roomType; return $this; } /** * Codecs used by participants in the room. Can be `VP8`, `H264`, or `VP9`. * * @param string[] $codec Codecs used by participants in the room. * @return $this Fluent Builder */ public function setCodec(array $codec): self { $this->options['codec'] = $codec; return $this; } /** * Room friendly name. * * @param string $roomName Room friendly name. * @return $this Fluent Builder */ public function setRoomName(string $roomName): self { $this->options['roomName'] = $roomName; return $this; } /** * Only read rooms that started on or after this ISO 8601 timestamp. * * @param \DateTime $createdAfter Only read rooms that started on or after this * ISO 8601 timestamp. * @return $this Fluent Builder */ public function setCreatedAfter(\DateTime $createdAfter): self { $this->options['createdAfter'] = $createdAfter; return $this; } /** * Only read rooms that started before this ISO 8601 timestamp. * * @param \DateTime $createdBefore Only read rooms that started before this ISO * 8601 timestamp. * @return $this Fluent Builder */ public function setCreatedBefore(\DateTime $createdBefore): self { $this->options['createdBefore'] = $createdBefore; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Insights.V1.ReadRoomOptions ' . $options . ']'; } }src/Twilio/Rest/Insights/V1/CallSummariesList.php000064400000013344150515725670015725 0ustar00solution = []; $this->uri = '/Voice/Summaries'; } /** * Streams CallSummariesInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads CallSummariesInstance 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 CallSummariesInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of CallSummariesInstance 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 CallSummariesPage Page of CallSummariesInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): CallSummariesPage { $options = new Values($options); $params = Values::of([ 'From' => $options['from'], 'To' => $options['to'], 'FromCarrier' => $options['fromCarrier'], 'ToCarrier' => $options['toCarrier'], 'FromCountryCode' => $options['fromCountryCode'], 'ToCountryCode' => $options['toCountryCode'], 'Branded' => Serialize::booleanToString($options['branded']), 'VerifiedCaller' => Serialize::booleanToString($options['verifiedCaller']), 'HasTag' => Serialize::booleanToString($options['hasTag']), 'StartTime' => $options['startTime'], 'EndTime' => $options['endTime'], 'CallType' => $options['callType'], 'CallState' => $options['callState'], 'Direction' => $options['direction'], 'ProcessingState' => $options['processingState'], 'SortBy' => $options['sortBy'], 'Subaccount' => $options['subaccount'], 'AbnormalSession' => Serialize::booleanToString($options['abnormalSession']), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new CallSummariesPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of CallSummariesInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return CallSummariesPage Page of CallSummariesInstance */ public function getPage(string $targetUrl): CallSummariesPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new CallSummariesPage($this->version, $response, $this->solution); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Insights.V1.CallSummariesList]'; } }src/Twilio/Rest/Insights/V1/CallSummariesPage.php000064400000002243150515725670015662 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CallSummariesInstance \Twilio\Rest\Insights\V1\CallSummariesInstance */ public function buildInstance(array $payload): CallSummariesInstance { return new CallSummariesInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Insights.V1.CallSummariesPage]'; } }src/Twilio/Rest/Insights/V1/CallList.php000064400000002162150515725670014033 0ustar00solution = []; } /** * Constructs a CallContext * * @param string $sid The sid */ public function getContext(string $sid): CallContext { return new CallContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Insights.V1.CallList]'; } }src/Twilio/Rest/Insights/V1/RoomContext.php000064400000006304150515725670014607 0ustar00solution = ['roomSid' => $roomSid, ]; $this->uri = '/Video/Rooms/' . \rawurlencode($roomSid) . ''; } /** * Fetch the RoomInstance * * @return RoomInstance Fetched RoomInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RoomInstance { $payload = $this->version->fetch('GET', $this->uri); return new RoomInstance($this->version, $payload, $this->solution['roomSid']); } /** * Access the participants */ protected function getParticipants(): ParticipantList { if (!$this->_participants) { $this->_participants = new ParticipantList($this->version, $this->solution['roomSid']); } return $this->_participants; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Insights.V1.RoomContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Insights/V1/SettingOptions.php000064400000007033150515725670015317 0ustar00options['subaccountSid'] = $subaccountSid; } /** * The subaccount_sid * * @param string $subaccountSid The subaccount_sid * @return $this Fluent Builder */ public function setSubaccountSid(string $subaccountSid): self { $this->options['subaccountSid'] = $subaccountSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Insights.V1.FetchSettingOptions ' . $options . ']'; } } class UpdateSettingOptions extends Options { /** * @param bool $advancedFeatures The advanced_features * @param bool $voiceTrace The voice_trace * @param string $subaccountSid The subaccount_sid */ public function __construct(bool $advancedFeatures = Values::NONE, bool $voiceTrace = Values::NONE, string $subaccountSid = Values::NONE) { $this->options['advancedFeatures'] = $advancedFeatures; $this->options['voiceTrace'] = $voiceTrace; $this->options['subaccountSid'] = $subaccountSid; } /** * The advanced_features * * @param bool $advancedFeatures The advanced_features * @return $this Fluent Builder */ public function setAdvancedFeatures(bool $advancedFeatures): self { $this->options['advancedFeatures'] = $advancedFeatures; return $this; } /** * The voice_trace * * @param bool $voiceTrace The voice_trace * @return $this Fluent Builder */ public function setVoiceTrace(bool $voiceTrace): self { $this->options['voiceTrace'] = $voiceTrace; return $this; } /** * The subaccount_sid * * @param string $subaccountSid The subaccount_sid * @return $this Fluent Builder */ public function setSubaccountSid(string $subaccountSid): self { $this->options['subaccountSid'] = $subaccountSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Insights.V1.UpdateSettingOptions ' . $options . ']'; } }src/Twilio/Rest/Insights/V1/Call/CallSummaryPage.php000064400000002275150515725670016232 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CallSummaryInstance \Twilio\Rest\Insights\V1\Call\CallSummaryInstance */ public function buildInstance(array $payload): CallSummaryInstance { return new CallSummaryInstance($this->version, $payload, $this->solution['callSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Insights.V1.CallSummaryPage]'; } }src/Twilio/Rest/Insights/V1/Call/CallSummaryOptions.php000064400000002631150515725670017005 0ustar00options['processingState'] = $processingState; } /** * The processing_state * * @param string $processingState The processing_state * @return $this Fluent Builder */ public function setProcessingState(string $processingState): self { $this->options['processingState'] = $processingState; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Insights.V1.FetchCallSummaryOptions ' . $options . ']'; } }src/Twilio/Rest/Insights/V1/Call/CallSummaryList.php000064400000002013150515725670016257 0ustar00solution = ['callSid' => $callSid, ]; } /** * Constructs a CallSummaryContext */ public function getContext(): CallSummaryContext { return new CallSummaryContext($this->version, $this->solution['callSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Insights.V1.CallSummaryList]'; } }src/Twilio/Rest/Insights/V1/Call/CallSummaryInstance.php000064400000011303150515725670017112 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'callSid' => Values::array_get($payload, 'call_sid'), 'callType' => Values::array_get($payload, 'call_type'), 'callState' => Values::array_get($payload, 'call_state'), 'processingState' => Values::array_get($payload, 'processing_state'), 'createdTime' => Deserialize::dateTime(Values::array_get($payload, 'created_time')), 'startTime' => Deserialize::dateTime(Values::array_get($payload, 'start_time')), 'endTime' => Deserialize::dateTime(Values::array_get($payload, 'end_time')), 'duration' => Values::array_get($payload, 'duration'), 'connectDuration' => Values::array_get($payload, 'connect_duration'), 'from' => Values::array_get($payload, 'from'), 'to' => Values::array_get($payload, 'to'), 'carrierEdge' => Values::array_get($payload, 'carrier_edge'), 'clientEdge' => Values::array_get($payload, 'client_edge'), 'sdkEdge' => Values::array_get($payload, 'sdk_edge'), 'sipEdge' => Values::array_get($payload, 'sip_edge'), 'tags' => Values::array_get($payload, 'tags'), 'url' => Values::array_get($payload, 'url'), 'attributes' => Values::array_get($payload, 'attributes'), 'properties' => Values::array_get($payload, 'properties'), 'trust' => Values::array_get($payload, 'trust'), ]; $this->solution = ['callSid' => $callSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return CallSummaryContext Context for this CallSummaryInstance */ protected function proxy(): CallSummaryContext { if (!$this->context) { $this->context = new CallSummaryContext($this->version, $this->solution['callSid']); } return $this->context; } /** * Fetch the CallSummaryInstance * * @param array|Options $options Optional Arguments * @return CallSummaryInstance Fetched CallSummaryInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): CallSummaryInstance { return $this->proxy()->fetch($options); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Insights.V1.CallSummaryInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Insights/V1/Call/EventInstance.php000064400000005435150515725670015753 0ustar00properties = [ 'timestamp' => Values::array_get($payload, 'timestamp'), 'callSid' => Values::array_get($payload, 'call_sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'edge' => Values::array_get($payload, 'edge'), 'group' => Values::array_get($payload, 'group'), 'level' => Values::array_get($payload, 'level'), 'name' => Values::array_get($payload, 'name'), 'carrierEdge' => Values::array_get($payload, 'carrier_edge'), 'sipEdge' => Values::array_get($payload, 'sip_edge'), 'sdkEdge' => Values::array_get($payload, 'sdk_edge'), 'clientEdge' => Values::array_get($payload, 'client_edge'), ]; $this->solution = ['callSid' => $callSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Insights.V1.EventInstance]'; } }src/Twilio/Rest/Insights/V1/Call/MetricPage.php000064400000002552150515725670015222 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return MetricInstance \Twilio\Rest\Insights\V1\Call\MetricInstance */ public function buildInstance(array $payload): MetricInstance { return new MetricInstance($this->version, $payload, $this->solution['callSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Insights.V1.MetricPage]'; } }src/Twilio/Rest/Insights/V1/Call/EventOptions.php000064400000002606150515725670015637 0ustar00options['edge'] = $edge; } /** * The edge * * @param string $edge The edge * @return $this Fluent Builder */ public function setEdge(string $edge): self { $this->options['edge'] = $edge; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Insights.V1.ReadEventOptions ' . $options . ']'; } }src/Twilio/Rest/Insights/V1/Call/MetricList.php000064400000011767150515725670015271 0ustar00solution = ['callSid' => $callSid, ]; $this->uri = '/Voice/' . \rawurlencode($callSid) . '/Metrics'; } /** * Streams MetricInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads MetricInstance 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 MetricInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of MetricInstance 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 MetricPage Page of MetricInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): MetricPage { $options = new Values($options); $params = Values::of([ 'Edge' => $options['edge'], 'Direction' => $options['direction'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new MetricPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of MetricInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return MetricPage Page of MetricInstance */ public function getPage(string $targetUrl): MetricPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new MetricPage($this->version, $response, $this->solution); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Insights.V1.MetricList]'; } }src/Twilio/Rest/Insights/V1/Call/EventList.php000064400000011664150515725670015123 0ustar00solution = ['callSid' => $callSid, ]; $this->uri = '/Voice/' . \rawurlencode($callSid) . '/Events'; } /** * Streams EventInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads EventInstance 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 EventInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of EventInstance 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 EventPage Page of EventInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): EventPage { $options = new Values($options); $params = Values::of([ 'Edge' => $options['edge'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new EventPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of EventInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return EventPage Page of EventInstance */ public function getPage(string $targetUrl): EventPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new EventPage($this->version, $response, $this->solution); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Insights.V1.EventList]'; } }src/Twilio/Rest/Insights/V1/Call/MetricInstance.php000064400000005177150515725670016120 0ustar00properties = [ 'timestamp' => Values::array_get($payload, 'timestamp'), 'callSid' => Values::array_get($payload, 'call_sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'edge' => Values::array_get($payload, 'edge'), 'direction' => Values::array_get($payload, 'direction'), 'carrierEdge' => Values::array_get($payload, 'carrier_edge'), 'sipEdge' => Values::array_get($payload, 'sip_edge'), 'sdkEdge' => Values::array_get($payload, 'sdk_edge'), 'clientEdge' => Values::array_get($payload, 'client_edge'), ]; $this->solution = ['callSid' => $callSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Insights.V1.MetricInstance]'; } }src/Twilio/Rest/Insights/V1/Call/EventPage.php000064400000002544150515725670015061 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return EventInstance \Twilio\Rest\Insights\V1\Call\EventInstance */ public function buildInstance(array $payload): EventInstance { return new EventInstance($this->version, $payload, $this->solution['callSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Insights.V1.EventPage]'; } }src/Twilio/Rest/Insights/V1/Call/CallSummaryContext.php000064400000003337150515725670017002 0ustar00solution = ['callSid' => $callSid, ]; $this->uri = '/Voice/' . \rawurlencode($callSid) . '/Summary'; } /** * Fetch the CallSummaryInstance * * @param array|Options $options Optional Arguments * @return CallSummaryInstance Fetched CallSummaryInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): CallSummaryInstance { $options = new Values($options); $params = Values::of(['ProcessingState' => $options['processingState'], ]); $payload = $this->version->fetch('GET', $this->uri, $params); return new CallSummaryInstance($this->version, $payload, $this->solution['callSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Insights.V1.CallSummaryContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Insights/V1/Call/MetricOptions.php000064400000003563150515725670016004 0ustar00options['edge'] = $edge; $this->options['direction'] = $direction; } /** * The edge * * @param string $edge The edge * @return $this Fluent Builder */ public function setEdge(string $edge): self { $this->options['edge'] = $edge; return $this; } /** * The direction * * @param string $direction The direction * @return $this Fluent Builder */ public function setDirection(string $direction): self { $this->options['direction'] = $direction; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Insights.V1.ReadMetricOptions ' . $options . ']'; } }src/Twilio/Rest/Insights/V1/CallContext.php000064400000007563150515725670014556 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Voice/' . \rawurlencode($sid) . ''; } /** * Fetch the CallInstance * * @return CallInstance Fetched CallInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CallInstance { $payload = $this->version->fetch('GET', $this->uri); return new CallInstance($this->version, $payload, $this->solution['sid']); } /** * Access the events */ protected function getEvents(): EventList { if (!$this->_events) { $this->_events = new EventList($this->version, $this->solution['sid']); } return $this->_events; } /** * Access the metrics */ protected function getMetrics(): MetricList { if (!$this->_metrics) { $this->_metrics = new MetricList($this->version, $this->solution['sid']); } return $this->_metrics; } /** * Access the summary */ protected function getSummary(): CallSummaryList { if (!$this->_summary) { $this->_summary = new CallSummaryList($this->version, $this->solution['sid']); } return $this->_summary; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Insights.V1.CallContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Insights/V1/CallInstance.php000064400000006746150515725670014700 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 CallContext Context for this CallInstance */ protected function proxy(): CallContext { if (!$this->context) { $this->context = new CallContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the CallInstance * * @return CallInstance Fetched CallInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CallInstance { return $this->proxy()->fetch(); } /** * Access the events */ protected function getEvents(): EventList { return $this->proxy()->events; } /** * Access the metrics */ protected function getMetrics(): MetricList { return $this->proxy()->metrics; } /** * Access the summary */ protected function getSummary(): CallSummaryList { return $this->proxy()->summary; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Insights.V1.CallInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Insights/V1/RoomList.php000064400000012500150515725670014071 0ustar00solution = []; $this->uri = '/Video/Rooms'; } /** * Streams RoomInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads RoomInstance 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 RoomInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of RoomInstance 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 RoomPage Page of RoomInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): RoomPage { $options = new Values($options); $params = Values::of([ 'RoomType' => Serialize::map($options['roomType'], function($e) { return $e; }), 'Codec' => Serialize::map($options['codec'], function($e) { return $e; }), 'RoomName' => $options['roomName'], 'CreatedAfter' => Serialize::iso8601DateTime($options['createdAfter']), 'CreatedBefore' => Serialize::iso8601DateTime($options['createdBefore']), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new RoomPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of RoomInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return RoomPage Page of RoomInstance */ public function getPage(string $targetUrl): RoomPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new RoomPage($this->version, $response, $this->solution); } /** * Constructs a RoomContext * * @param string $roomSid The SID of the Room resource. */ public function getContext(string $roomSid): RoomContext { return new RoomContext($this->version, $roomSid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Insights.V1.RoomList]'; } }src/Twilio/Rest/Insights/V1/SettingInstance.php000064400000006261150515725670015432 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'advancedFeatures' => Values::array_get($payload, 'advanced_features'), 'voiceTrace' => Values::array_get($payload, 'voice_trace'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = []; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return SettingContext Context for this SettingInstance */ protected function proxy(): SettingContext { if (!$this->context) { $this->context = new SettingContext($this->version); } return $this->context; } /** * Fetch the SettingInstance * * @param array|Options $options Optional Arguments * @return SettingInstance Fetched SettingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): SettingInstance { return $this->proxy()->fetch($options); } /** * Update the SettingInstance * * @param array|Options $options Optional Arguments * @return SettingInstance Updated SettingInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SettingInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Insights.V1.SettingInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Insights/V1/SettingList.php000064400000001577150515725670014606 0ustar00solution = []; } /** * Constructs a SettingContext */ public function getContext(): SettingContext { return new SettingContext($this->version); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Insights.V1.SettingList]'; } }src/Twilio/Rest/Insights/V1/SettingPage.php000064400000002177150515725670014544 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SettingInstance \Twilio\Rest\Insights\V1\SettingInstance */ public function buildInstance(array $payload): SettingInstance { return new SettingInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Insights.V1.SettingPage]'; } }src/Twilio/Rest/Insights/V1.php000064400000006121150515725670012323 0ustar00version = 'v1'; } protected function getSettings(): SettingList { if (!$this->_settings) { $this->_settings = new SettingList($this); } return $this->_settings; } protected function getCalls(): CallList { if (!$this->_calls) { $this->_calls = new CallList($this); } return $this->_calls; } protected function getCallSummaries(): CallSummariesList { if (!$this->_callSummaries) { $this->_callSummaries = new CallSummariesList($this); } return $this->_callSummaries; } protected function getRooms(): RoomList { if (!$this->_rooms) { $this->_rooms = new RoomList($this); } return $this->_rooms; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Insights.V1]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/WorkspaceRealTimeStatisticsOptions.php000064400000003436150515725670023652 0ustar00options['taskChannel'] = $taskChannel; } /** * Only calculate real-time statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. * * @param string $taskChannel Only calculate real-time statistics on this * TaskChannel * @return $this Fluent Builder */ public function setTaskChannel(string $taskChannel): self { $this->options['taskChannel'] = $taskChannel; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.FetchWorkspaceRealTimeStatisticsOptions ' . $options . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/WorkspaceCumulativeStatisticsList.php000064400000002245150515725670023543 0ustar00solution = ['workspaceSid' => $workspaceSid, ]; } /** * Constructs a WorkspaceCumulativeStatisticsContext */ public function getContext(): WorkspaceCumulativeStatisticsContext { return new WorkspaceCumulativeStatisticsContext($this->version, $this->solution['workspaceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.WorkspaceCumulativeStatisticsList]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/WorkspaceCumulativeStatisticsContext.php000064400000004507150515725670024257 0ustar00solution = ['workspaceSid' => $workspaceSid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/CumulativeStatistics'; } /** * Fetch the WorkspaceCumulativeStatisticsInstance * * @param array|Options $options Optional Arguments * @return WorkspaceCumulativeStatisticsInstance Fetched * WorkspaceCumulativeStatisticsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): WorkspaceCumulativeStatisticsInstance { $options = new Values($options); $params = Values::of([ 'EndDate' => Serialize::iso8601DateTime($options['endDate']), 'Minutes' => $options['minutes'], 'StartDate' => Serialize::iso8601DateTime($options['startDate']), 'TaskChannel' => $options['taskChannel'], 'SplitByWaitTime' => $options['splitByWaitTime'], ]); $payload = $this->version->fetch('GET', $this->uri, $params); return new WorkspaceCumulativeStatisticsInstance( $this->version, $payload, $this->solution['workspaceSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.WorkspaceCumulativeStatisticsContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Workflow/WorkflowCumulativeStatisticsInstance.php000064400000013730150515725670026063 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'avgTaskAcceptanceTime' => Values::array_get($payload, 'avg_task_acceptance_time'), 'startTime' => Deserialize::dateTime(Values::array_get($payload, 'start_time')), 'endTime' => Deserialize::dateTime(Values::array_get($payload, 'end_time')), 'reservationsCreated' => Values::array_get($payload, 'reservations_created'), 'reservationsAccepted' => Values::array_get($payload, 'reservations_accepted'), 'reservationsRejected' => Values::array_get($payload, 'reservations_rejected'), 'reservationsTimedOut' => Values::array_get($payload, 'reservations_timed_out'), 'reservationsCanceled' => Values::array_get($payload, 'reservations_canceled'), 'reservationsRescinded' => Values::array_get($payload, 'reservations_rescinded'), 'splitByWaitTime' => Values::array_get($payload, 'split_by_wait_time'), 'waitDurationUntilAccepted' => Values::array_get($payload, 'wait_duration_until_accepted'), 'waitDurationUntilCanceled' => Values::array_get($payload, 'wait_duration_until_canceled'), 'tasksCanceled' => Values::array_get($payload, 'tasks_canceled'), 'tasksCompleted' => Values::array_get($payload, 'tasks_completed'), 'tasksEntered' => Values::array_get($payload, 'tasks_entered'), 'tasksDeleted' => Values::array_get($payload, 'tasks_deleted'), 'tasksMoved' => Values::array_get($payload, 'tasks_moved'), 'tasksTimedOutInWorkflow' => Values::array_get($payload, 'tasks_timed_out_in_workflow'), 'workflowSid' => Values::array_get($payload, 'workflow_sid'), 'workspaceSid' => Values::array_get($payload, 'workspace_sid'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['workspaceSid' => $workspaceSid, 'workflowSid' => $workflowSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return WorkflowCumulativeStatisticsContext Context for this * WorkflowCumulativeStatisticsInstance */ protected function proxy(): WorkflowCumulativeStatisticsContext { if (!$this->context) { $this->context = new WorkflowCumulativeStatisticsContext( $this->version, $this->solution['workspaceSid'], $this->solution['workflowSid'] ); } return $this->context; } /** * Fetch the WorkflowCumulativeStatisticsInstance * * @param array|Options $options Optional Arguments * @return WorkflowCumulativeStatisticsInstance Fetched * WorkflowCumulativeStatisticsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): WorkflowCumulativeStatisticsInstance { return $this->proxy()->fetch($options); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.WorkflowCumulativeStatisticsInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Workflow/WorkflowRealTimeStatisticsOptions.php000064400000003441150515725670025334 0ustar00options['taskChannel'] = $taskChannel; } /** * Only calculate real-time statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. * * @param string $taskChannel Only calculate real-time statistics on this * TaskChannel * @return $this Fluent Builder */ public function setTaskChannel(string $taskChannel): self { $this->options['taskChannel'] = $taskChannel; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.FetchWorkflowRealTimeStatisticsOptions ' . $options . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Workflow/WorkflowStatisticsPage.php000064400000002550150515725670023132 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return WorkflowStatisticsInstance \Twilio\Rest\Taskrouter\V1\Workspace\Workflow\WorkflowStatisticsInstance */ public function buildInstance(array $payload): WorkflowStatisticsInstance { return new WorkflowStatisticsInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['workflowSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.WorkflowStatisticsPage]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Workflow/WorkflowCumulativeStatisticsPage.php000064400000002644150515725670025175 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return WorkflowCumulativeStatisticsInstance \Twilio\Rest\Taskrouter\V1\Workspace\Workflow\WorkflowCumulativeStatisticsInstance */ public function buildInstance(array $payload): WorkflowCumulativeStatisticsInstance { return new WorkflowCumulativeStatisticsInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['workflowSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.WorkflowCumulativeStatisticsPage]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Workflow/WorkflowCumulativeStatisticsContext.php000064400000005312150515725670025740 0ustar00solution = ['workspaceSid' => $workspaceSid, 'workflowSid' => $workflowSid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/Workflows/' . \rawurlencode($workflowSid) . '/CumulativeStatistics'; } /** * Fetch the WorkflowCumulativeStatisticsInstance * * @param array|Options $options Optional Arguments * @return WorkflowCumulativeStatisticsInstance Fetched * WorkflowCumulativeStatisticsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): WorkflowCumulativeStatisticsInstance { $options = new Values($options); $params = Values::of([ 'EndDate' => Serialize::iso8601DateTime($options['endDate']), 'Minutes' => $options['minutes'], 'StartDate' => Serialize::iso8601DateTime($options['startDate']), 'TaskChannel' => $options['taskChannel'], 'SplitByWaitTime' => $options['splitByWaitTime'], ]); $payload = $this->version->fetch('GET', $this->uri, $params); return new WorkflowCumulativeStatisticsInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['workflowSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.WorkflowCumulativeStatisticsContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Workflow/WorkflowStatisticsOptions.php000064400000013314150515725670023711 0ustar00options['minutes'] = $minutes; $this->options['startDate'] = $startDate; $this->options['endDate'] = $endDate; $this->options['taskChannel'] = $taskChannel; $this->options['splitByWaitTime'] = $splitByWaitTime; } /** * Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. * * @param int $minutes Only calculate statistics since this many minutes in the * past * @return $this Fluent Builder */ public function setMinutes(int $minutes): self { $this->options['minutes'] = $minutes; return $this; } /** * Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. * * @param \DateTime $startDate Only calculate statistics from on or after this * date * @return $this Fluent Builder */ public function setStartDate(\DateTime $startDate): self { $this->options['startDate'] = $startDate; return $this; } /** * Only calculate statistics from this date and time and earlier, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. * * @param \DateTime $endDate Only calculate statistics from this date and time * and earlier * @return $this Fluent Builder */ public function setEndDate(\DateTime $endDate): self { $this->options['endDate'] = $endDate; return $this; } /** * Only calculate real-time statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. * * @param string $taskChannel Only calculate real-time statistics on this * TaskChannel. * @return $this Fluent Builder */ public function setTaskChannel(string $taskChannel): self { $this->options['taskChannel'] = $taskChannel; return $this; } /** * A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. For example, `5,30` would show splits of Tasks that were canceled or accepted before and after 5 seconds and before and after 30 seconds. This can be used to show short abandoned Tasks or Tasks that failed to meet an SLA. * * @param string $splitByWaitTime A comma separated list of values that * describes the thresholds to calculate * statistics on * @return $this Fluent Builder */ public function setSplitByWaitTime(string $splitByWaitTime): self { $this->options['splitByWaitTime'] = $splitByWaitTime; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.FetchWorkflowStatisticsOptions ' . $options . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Workflow/WorkflowRealTimeStatisticsContext.php000064400000004607150515725670025332 0ustar00solution = ['workspaceSid' => $workspaceSid, 'workflowSid' => $workflowSid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/Workflows/' . \rawurlencode($workflowSid) . '/RealTimeStatistics'; } /** * Fetch the WorkflowRealTimeStatisticsInstance * * @param array|Options $options Optional Arguments * @return WorkflowRealTimeStatisticsInstance Fetched * WorkflowRealTimeStatisticsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): WorkflowRealTimeStatisticsInstance { $options = new Values($options); $params = Values::of(['TaskChannel' => $options['taskChannel'], ]); $payload = $this->version->fetch('GET', $this->uri, $params); return new WorkflowRealTimeStatisticsInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['workflowSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.WorkflowRealTimeStatisticsContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Workflow/WorkflowStatisticsInstance.php000064400000007320150515725670024022 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'cumulative' => Values::array_get($payload, 'cumulative'), 'realtime' => Values::array_get($payload, 'realtime'), 'workflowSid' => Values::array_get($payload, 'workflow_sid'), 'workspaceSid' => Values::array_get($payload, 'workspace_sid'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['workspaceSid' => $workspaceSid, 'workflowSid' => $workflowSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return WorkflowStatisticsContext Context for this WorkflowStatisticsInstance */ protected function proxy(): WorkflowStatisticsContext { if (!$this->context) { $this->context = new WorkflowStatisticsContext( $this->version, $this->solution['workspaceSid'], $this->solution['workflowSid'] ); } return $this->context; } /** * Fetch the WorkflowStatisticsInstance * * @param array|Options $options Optional Arguments * @return WorkflowStatisticsInstance Fetched WorkflowStatisticsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): WorkflowStatisticsInstance { return $this->proxy()->fetch($options); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.WorkflowStatisticsInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Workflow/WorkflowCumulativeStatisticsOptions.php000064400000013361150515725670025752 0ustar00options['endDate'] = $endDate; $this->options['minutes'] = $minutes; $this->options['startDate'] = $startDate; $this->options['taskChannel'] = $taskChannel; $this->options['splitByWaitTime'] = $splitByWaitTime; } /** * Only include usage that occurred on or before this date, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. * * @param \DateTime $endDate Only include usage that occurred on or before this * date * @return $this Fluent Builder */ public function setEndDate(\DateTime $endDate): self { $this->options['endDate'] = $endDate; return $this; } /** * Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. * * @param int $minutes Only calculate statistics since this many minutes in the * past * @return $this Fluent Builder */ public function setMinutes(int $minutes): self { $this->options['minutes'] = $minutes; return $this; } /** * Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. * * @param \DateTime $startDate Only calculate statistics from on or after this * date * @return $this Fluent Builder */ public function setStartDate(\DateTime $startDate): self { $this->options['startDate'] = $startDate; return $this; } /** * Only calculate cumulative statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. * * @param string $taskChannel Only calculate cumulative statistics on this * TaskChannel * @return $this Fluent Builder */ public function setTaskChannel(string $taskChannel): self { $this->options['taskChannel'] = $taskChannel; return $this; } /** * A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. For example, `5,30` would show splits of Tasks that were canceled or accepted before and after 5 seconds and before and after 30 seconds. This can be used to show short abandoned Tasks or Tasks that failed to meet an SLA. * * @param string $splitByWaitTime A comma separated list of values that * describes the thresholds to calculate * statistics on * @return $this Fluent Builder */ public function setSplitByWaitTime(string $splitByWaitTime): self { $this->options['splitByWaitTime'] = $splitByWaitTime; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.FetchWorkflowCumulativeStatisticsOptions ' . $options . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Workflow/WorkflowRealTimeStatisticsList.php000064400000003044150515725670024613 0ustar00solution = ['workspaceSid' => $workspaceSid, 'workflowSid' => $workflowSid, ]; } /** * Constructs a WorkflowRealTimeStatisticsContext */ public function getContext(): WorkflowRealTimeStatisticsContext { return new WorkflowRealTimeStatisticsContext( $this->version, $this->solution['workspaceSid'], $this->solution['workflowSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.WorkflowRealTimeStatisticsList]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Workflow/WorkflowRealTimeStatisticsPage.php000064400000002630150515725670024554 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return WorkflowRealTimeStatisticsInstance \Twilio\Rest\Taskrouter\V1\Workspace\Workflow\WorkflowRealTimeStatisticsInstance */ public function buildInstance(array $payload): WorkflowRealTimeStatisticsInstance { return new WorkflowRealTimeStatisticsInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['workflowSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.WorkflowRealTimeStatisticsPage]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Workflow/WorkflowCumulativeStatisticsList.php000064400000003060150515725670025225 0ustar00solution = ['workspaceSid' => $workspaceSid, 'workflowSid' => $workflowSid, ]; } /** * Constructs a WorkflowCumulativeStatisticsContext */ public function getContext(): WorkflowCumulativeStatisticsContext { return new WorkflowCumulativeStatisticsContext( $this->version, $this->solution['workspaceSid'], $this->solution['workflowSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.WorkflowCumulativeStatisticsList]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Workflow/WorkflowStatisticsList.php000064400000002763150515725670023177 0ustar00solution = ['workspaceSid' => $workspaceSid, 'workflowSid' => $workflowSid, ]; } /** * Constructs a WorkflowStatisticsContext */ public function getContext(): WorkflowStatisticsContext { return new WorkflowStatisticsContext( $this->version, $this->solution['workspaceSid'], $this->solution['workflowSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.WorkflowStatisticsList]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Workflow/WorkflowStatisticsContext.php000064400000005074150515725670023706 0ustar00solution = ['workspaceSid' => $workspaceSid, 'workflowSid' => $workflowSid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/Workflows/' . \rawurlencode($workflowSid) . '/Statistics'; } /** * Fetch the WorkflowStatisticsInstance * * @param array|Options $options Optional Arguments * @return WorkflowStatisticsInstance Fetched WorkflowStatisticsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): WorkflowStatisticsInstance { $options = new Values($options); $params = Values::of([ 'Minutes' => $options['minutes'], 'StartDate' => Serialize::iso8601DateTime($options['startDate']), 'EndDate' => Serialize::iso8601DateTime($options['endDate']), 'TaskChannel' => $options['taskChannel'], 'SplitByWaitTime' => $options['splitByWaitTime'], ]); $payload = $this->version->fetch('GET', $this->uri, $params); return new WorkflowStatisticsInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['workflowSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.WorkflowStatisticsContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Workflow/WorkflowRealTimeStatisticsInstance.php000064400000010446150515725670025450 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'longestTaskWaitingAge' => Values::array_get($payload, 'longest_task_waiting_age'), 'longestTaskWaitingSid' => Values::array_get($payload, 'longest_task_waiting_sid'), 'tasksByPriority' => Values::array_get($payload, 'tasks_by_priority'), 'tasksByStatus' => Values::array_get($payload, 'tasks_by_status'), 'totalTasks' => Values::array_get($payload, 'total_tasks'), 'workflowSid' => Values::array_get($payload, 'workflow_sid'), 'workspaceSid' => Values::array_get($payload, 'workspace_sid'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['workspaceSid' => $workspaceSid, 'workflowSid' => $workflowSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return WorkflowRealTimeStatisticsContext Context for this * WorkflowRealTimeStatisticsInstance */ protected function proxy(): WorkflowRealTimeStatisticsContext { if (!$this->context) { $this->context = new WorkflowRealTimeStatisticsContext( $this->version, $this->solution['workspaceSid'], $this->solution['workflowSid'] ); } return $this->context; } /** * Fetch the WorkflowRealTimeStatisticsInstance * * @param array|Options $options Optional Arguments * @return WorkflowRealTimeStatisticsInstance Fetched * WorkflowRealTimeStatisticsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): WorkflowRealTimeStatisticsInstance { return $this->proxy()->fetch($options); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.WorkflowRealTimeStatisticsInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueueInstance.php000064400000014004150515725670020227 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'assignmentActivitySid' => Values::array_get($payload, 'assignment_activity_sid'), 'assignmentActivityName' => Values::array_get($payload, 'assignment_activity_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'), 'maxReservedWorkers' => Values::array_get($payload, 'max_reserved_workers'), 'reservationActivitySid' => Values::array_get($payload, 'reservation_activity_sid'), 'reservationActivityName' => Values::array_get($payload, 'reservation_activity_name'), 'sid' => Values::array_get($payload, 'sid'), 'targetWorkers' => Values::array_get($payload, 'target_workers'), 'taskOrder' => Values::array_get($payload, 'task_order'), 'url' => Values::array_get($payload, 'url'), 'workspaceSid' => Values::array_get($payload, 'workspace_sid'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['workspaceSid' => $workspaceSid, '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 TaskQueueContext Context for this TaskQueueInstance */ protected function proxy(): TaskQueueContext { if (!$this->context) { $this->context = new TaskQueueContext( $this->version, $this->solution['workspaceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the TaskQueueInstance * * @return TaskQueueInstance Fetched TaskQueueInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TaskQueueInstance { return $this->proxy()->fetch(); } /** * Update the TaskQueueInstance * * @param array|Options $options Optional Arguments * @return TaskQueueInstance Updated TaskQueueInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): TaskQueueInstance { return $this->proxy()->update($options); } /** * Delete the TaskQueueInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the statistics */ protected function getStatistics(): TaskQueueStatisticsList { return $this->proxy()->statistics; } /** * Access the realTimeStatistics */ protected function getRealTimeStatistics(): TaskQueueRealTimeStatisticsList { return $this->proxy()->realTimeStatistics; } /** * Access the cumulativeStatistics */ protected function getCumulativeStatistics(): TaskQueueCumulativeStatisticsList { return $this->proxy()->cumulativeStatistics; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.TaskQueueInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueueList.php000064400000017713150515725670017410 0ustar00solution = ['workspaceSid' => $workspaceSid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/TaskQueues'; } /** * Streams TaskQueueInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads TaskQueueInstance 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 TaskQueueInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of TaskQueueInstance 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 TaskQueuePage Page of TaskQueueInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): TaskQueuePage { $options = new Values($options); $params = Values::of([ 'FriendlyName' => $options['friendlyName'], 'EvaluateWorkerAttributes' => $options['evaluateWorkerAttributes'], 'WorkerSid' => $options['workerSid'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new TaskQueuePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of TaskQueueInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return TaskQueuePage Page of TaskQueueInstance */ public function getPage(string $targetUrl): TaskQueuePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new TaskQueuePage($this->version, $response, $this->solution); } /** * Create the TaskQueueInstance * * @param string $friendlyName A string to describe the resource * @param array|Options $options Optional Arguments * @return TaskQueueInstance Created TaskQueueInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, array $options = []): TaskQueueInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $friendlyName, 'TargetWorkers' => $options['targetWorkers'], 'MaxReservedWorkers' => $options['maxReservedWorkers'], 'TaskOrder' => $options['taskOrder'], 'ReservationActivitySid' => $options['reservationActivitySid'], 'AssignmentActivitySid' => $options['assignmentActivitySid'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new TaskQueueInstance($this->version, $payload, $this->solution['workspaceSid']); } /** * Access the statistics */ protected function getStatistics(): TaskQueuesStatisticsList { if (!$this->_statistics) { $this->_statistics = new TaskQueuesStatisticsList($this->version, $this->solution['workspaceSid']); } return $this->_statistics; } /** * Constructs a TaskQueueContext * * @param string $sid The SID of the resource to */ public function getContext(string $sid): TaskQueueContext { return new TaskQueueContext($this->version, $this->solution['workspaceSid'], $sid); } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return \Twilio\ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Taskrouter.V1.TaskQueueList]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskChannelPage.php000064400000002322150515725670017623 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return TaskChannelInstance \Twilio\Rest\Taskrouter\V1\Workspace\TaskChannelInstance */ public function buildInstance(array $payload): TaskChannelInstance { return new TaskChannelInstance($this->version, $payload, $this->solution['workspaceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.TaskChannelPage]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskContext.php000064400000011574150515725670017113 0ustar00solution = ['workspaceSid' => $workspaceSid, 'sid' => $sid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/Tasks/' . \rawurlencode($sid) . ''; } /** * Fetch the TaskInstance * * @return TaskInstance Fetched TaskInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TaskInstance { $payload = $this->version->fetch('GET', $this->uri); return new TaskInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['sid'] ); } /** * Update the TaskInstance * * @param array|Options $options Optional Arguments * @return TaskInstance Updated TaskInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): TaskInstance { $options = new Values($options); $data = Values::of([ 'Attributes' => $options['attributes'], 'AssignmentStatus' => $options['assignmentStatus'], 'Reason' => $options['reason'], 'Priority' => $options['priority'], 'TaskChannel' => $options['taskChannel'], ]); $headers = Values::of(['If-Match' => $options['ifMatch'], ]); $payload = $this->version->update('POST', $this->uri, [], $data, $headers); return new TaskInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['sid'] ); } /** * Delete the TaskInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { $options = new Values($options); $headers = Values::of(['If-Match' => $options['ifMatch'], ]); return $this->version->delete('DELETE', $this->uri, [], [], $headers); } /** * Access the reservations */ protected function getReservations(): ReservationList { if (!$this->_reservations) { $this->_reservations = new ReservationList( $this->version, $this->solution['workspaceSid'], $this->solution['sid'] ); } return $this->_reservations; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.TaskContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/WorkspaceRealTimeStatisticsList.php000064400000002231150515725670023122 0ustar00solution = ['workspaceSid' => $workspaceSid, ]; } /** * Constructs a WorkspaceRealTimeStatisticsContext */ public function getContext(): WorkspaceRealTimeStatisticsContext { return new WorkspaceRealTimeStatisticsContext($this->version, $this->solution['workspaceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.WorkspaceRealTimeStatisticsList]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/ActivityInstance.php000064400000010516150515725670020120 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'available' => Values::array_get($payload, 'available'), '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'), 'sid' => Values::array_get($payload, 'sid'), 'workspaceSid' => Values::array_get($payload, 'workspace_sid'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['workspaceSid' => $workspaceSid, '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 ActivityContext Context for this ActivityInstance */ protected function proxy(): ActivityContext { if (!$this->context) { $this->context = new ActivityContext( $this->version, $this->solution['workspaceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the ActivityInstance * * @return ActivityInstance Fetched ActivityInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ActivityInstance { return $this->proxy()->fetch(); } /** * Update the ActivityInstance * * @param array|Options $options Optional Arguments * @return ActivityInstance Updated ActivityInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ActivityInstance { return $this->proxy()->update($options); } /** * Delete the ActivityInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.ActivityInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/WorkspaceStatisticsPage.php000064400000002402150515725670021440 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return WorkspaceStatisticsInstance \Twilio\Rest\Taskrouter\V1\Workspace\WorkspaceStatisticsInstance */ public function buildInstance(array $payload): WorkspaceStatisticsInstance { return new WorkspaceStatisticsInstance($this->version, $payload, $this->solution['workspaceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.WorkspaceStatisticsPage]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueuePage.php000064400000002306150515725670017341 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return TaskQueueInstance \Twilio\Rest\Taskrouter\V1\Workspace\TaskQueueInstance */ public function buildInstance(array $payload): TaskQueueInstance { return new TaskQueueInstance($this->version, $payload, $this->solution['workspaceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.TaskQueuePage]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/WorkerInstance.php000064400000014250150515725670017574 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'activityName' => Values::array_get($payload, 'activity_name'), 'activitySid' => Values::array_get($payload, 'activity_sid'), 'attributes' => Values::array_get($payload, 'attributes'), 'available' => Values::array_get($payload, 'available'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateStatusChanged' => Deserialize::dateTime(Values::array_get($payload, 'date_status_changed')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'sid' => Values::array_get($payload, 'sid'), 'workspaceSid' => Values::array_get($payload, 'workspace_sid'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['workspaceSid' => $workspaceSid, '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 WorkerContext Context for this WorkerInstance */ protected function proxy(): WorkerContext { if (!$this->context) { $this->context = new WorkerContext( $this->version, $this->solution['workspaceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the WorkerInstance * * @return WorkerInstance Fetched WorkerInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): WorkerInstance { return $this->proxy()->fetch(); } /** * Update the WorkerInstance * * @param array|Options $options Optional Arguments * @return WorkerInstance Updated WorkerInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): WorkerInstance { return $this->proxy()->update($options); } /** * Delete the WorkerInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { return $this->proxy()->delete($options); } /** * Access the realTimeStatistics */ protected function getRealTimeStatistics(): WorkersRealTimeStatisticsList { return $this->proxy()->realTimeStatistics; } /** * Access the cumulativeStatistics */ protected function getCumulativeStatistics(): WorkersCumulativeStatisticsList { return $this->proxy()->cumulativeStatistics; } /** * Access the statistics */ protected function getStatistics(): WorkerStatisticsList { return $this->proxy()->statistics; } /** * Access the reservations */ protected function getReservations(): ReservationList { return $this->proxy()->reservations; } /** * Access the workerChannels */ protected function getWorkerChannels(): WorkerChannelList { return $this->proxy()->workerChannels; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.WorkerInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/WorkflowOptions.php000064400000031663150515725670020033 0ustar00options['friendlyName'] = $friendlyName; $this->options['assignmentCallbackUrl'] = $assignmentCallbackUrl; $this->options['fallbackAssignmentCallbackUrl'] = $fallbackAssignmentCallbackUrl; $this->options['configuration'] = $configuration; $this->options['taskReservationTimeout'] = $taskReservationTimeout; $this->options['reEvaluateTasks'] = $reEvaluateTasks; } /** * A descriptive string that you create to describe the Workflow resource. For example, `Inbound Call Workflow` or `2014 Outbound Campaign`. * * @param string $friendlyName descriptive string that you create to describe * the Workflow resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The URL from your application that will process task assignment events. See [Handling Task Assignment Callback](https://www.twilio.com/docs/taskrouter/handle-assignment-callbacks) for more details. * * @param string $assignmentCallbackUrl The URL from your application that will * process task assignment events * @return $this Fluent Builder */ public function setAssignmentCallbackUrl(string $assignmentCallbackUrl): self { $this->options['assignmentCallbackUrl'] = $assignmentCallbackUrl; return $this; } /** * The URL that we should call when a call to the `assignment_callback_url` fails. * * @param string $fallbackAssignmentCallbackUrl The URL that we should call * when a call to the * `assignment_callback_url` fails * @return $this Fluent Builder */ public function setFallbackAssignmentCallbackUrl(string $fallbackAssignmentCallbackUrl): self { $this->options['fallbackAssignmentCallbackUrl'] = $fallbackAssignmentCallbackUrl; return $this; } /** * A JSON string that contains the rules to apply to the Workflow. See [Configuring Workflows](https://www.twilio.com/docs/taskrouter/workflow-configuration) for more information. * * @param string $configuration A JSON string that contains the rules to apply * to the Workflow * @return $this Fluent Builder */ public function setConfiguration(string $configuration): self { $this->options['configuration'] = $configuration; return $this; } /** * How long TaskRouter will wait for a confirmation response from your application after it assigns a Task to a Worker. Can be up to `86,400` (24 hours) and the default is `120`. * * @param int $taskReservationTimeout How long TaskRouter will wait for a * confirmation response from your * application after it assigns a Task to a * Worker * @return $this Fluent Builder */ public function setTaskReservationTimeout(int $taskReservationTimeout): self { $this->options['taskReservationTimeout'] = $taskReservationTimeout; return $this; } /** * Whether or not to re-evaluate Tasks. The default is `false`, which means Tasks in the Workflow will not be processed through the assignment loop again. * * @param string $reEvaluateTasks Whether or not to re-evaluate Tasks * @return $this Fluent Builder */ public function setReEvaluateTasks(string $reEvaluateTasks): self { $this->options['reEvaluateTasks'] = $reEvaluateTasks; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.UpdateWorkflowOptions ' . $options . ']'; } } class ReadWorkflowOptions extends Options { /** * @param string $friendlyName The friendly_name of the Workflow resources to * read */ public function __construct(string $friendlyName = Values::NONE) { $this->options['friendlyName'] = $friendlyName; } /** * The `friendly_name` of the Workflow resources to read. * * @param string $friendlyName The friendly_name of the Workflow resources to * read * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.ReadWorkflowOptions ' . $options . ']'; } } class CreateWorkflowOptions extends Options { /** * @param string $assignmentCallbackUrl The URL from your application that will * process task assignment events * @param string $fallbackAssignmentCallbackUrl The URL that we should call * when a call to the * `assignment_callback_url` fails * @param int $taskReservationTimeout How long TaskRouter will wait for a * confirmation response from your * application after it assigns a Task to a * Worker */ public function __construct(string $assignmentCallbackUrl = Values::NONE, string $fallbackAssignmentCallbackUrl = Values::NONE, int $taskReservationTimeout = Values::NONE) { $this->options['assignmentCallbackUrl'] = $assignmentCallbackUrl; $this->options['fallbackAssignmentCallbackUrl'] = $fallbackAssignmentCallbackUrl; $this->options['taskReservationTimeout'] = $taskReservationTimeout; } /** * The URL from your application that will process task assignment events. See [Handling Task Assignment Callback](https://www.twilio.com/docs/taskrouter/handle-assignment-callbacks) for more details. * * @param string $assignmentCallbackUrl The URL from your application that will * process task assignment events * @return $this Fluent Builder */ public function setAssignmentCallbackUrl(string $assignmentCallbackUrl): self { $this->options['assignmentCallbackUrl'] = $assignmentCallbackUrl; return $this; } /** * The URL that we should call when a call to the `assignment_callback_url` fails. * * @param string $fallbackAssignmentCallbackUrl The URL that we should call * when a call to the * `assignment_callback_url` fails * @return $this Fluent Builder */ public function setFallbackAssignmentCallbackUrl(string $fallbackAssignmentCallbackUrl): self { $this->options['fallbackAssignmentCallbackUrl'] = $fallbackAssignmentCallbackUrl; return $this; } /** * How long TaskRouter will wait for a confirmation response from your application after it assigns a Task to a Worker. Can be up to `86,400` (24 hours) and the default is `120`. * * @param int $taskReservationTimeout How long TaskRouter will wait for a * confirmation response from your * application after it assigns a Task to a * Worker * @return $this Fluent Builder */ public function setTaskReservationTimeout(int $taskReservationTimeout): self { $this->options['taskReservationTimeout'] = $taskReservationTimeout; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.CreateWorkflowOptions ' . $options . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/WorkspaceCumulativeStatisticsInstance.php000064400000013007150515725670024372 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'avgTaskAcceptanceTime' => Values::array_get($payload, 'avg_task_acceptance_time'), 'startTime' => Deserialize::dateTime(Values::array_get($payload, 'start_time')), 'endTime' => Deserialize::dateTime(Values::array_get($payload, 'end_time')), 'reservationsCreated' => Values::array_get($payload, 'reservations_created'), 'reservationsAccepted' => Values::array_get($payload, 'reservations_accepted'), 'reservationsRejected' => Values::array_get($payload, 'reservations_rejected'), 'reservationsTimedOut' => Values::array_get($payload, 'reservations_timed_out'), 'reservationsCanceled' => Values::array_get($payload, 'reservations_canceled'), 'reservationsRescinded' => Values::array_get($payload, 'reservations_rescinded'), 'splitByWaitTime' => Values::array_get($payload, 'split_by_wait_time'), 'waitDurationUntilAccepted' => Values::array_get($payload, 'wait_duration_until_accepted'), 'waitDurationUntilCanceled' => Values::array_get($payload, 'wait_duration_until_canceled'), 'tasksCanceled' => Values::array_get($payload, 'tasks_canceled'), 'tasksCompleted' => Values::array_get($payload, 'tasks_completed'), 'tasksCreated' => Values::array_get($payload, 'tasks_created'), 'tasksDeleted' => Values::array_get($payload, 'tasks_deleted'), 'tasksMoved' => Values::array_get($payload, 'tasks_moved'), 'tasksTimedOutInWorkflow' => Values::array_get($payload, 'tasks_timed_out_in_workflow'), 'workspaceSid' => Values::array_get($payload, 'workspace_sid'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['workspaceSid' => $workspaceSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return WorkspaceCumulativeStatisticsContext Context for this * WorkspaceCumulativeStatisticsInstance */ protected function proxy(): WorkspaceCumulativeStatisticsContext { if (!$this->context) { $this->context = new WorkspaceCumulativeStatisticsContext( $this->version, $this->solution['workspaceSid'] ); } return $this->context; } /** * Fetch the WorkspaceCumulativeStatisticsInstance * * @param array|Options $options Optional Arguments * @return WorkspaceCumulativeStatisticsInstance Fetched * WorkspaceCumulativeStatisticsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): WorkspaceCumulativeStatisticsInstance { return $this->proxy()->fetch($options); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.WorkspaceCumulativeStatisticsInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/WorkerContext.php000064400000017104150515725670017455 0ustar00solution = ['workspaceSid' => $workspaceSid, 'sid' => $sid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/Workers/' . \rawurlencode($sid) . ''; } /** * Fetch the WorkerInstance * * @return WorkerInstance Fetched WorkerInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): WorkerInstance { $payload = $this->version->fetch('GET', $this->uri); return new WorkerInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['sid'] ); } /** * Update the WorkerInstance * * @param array|Options $options Optional Arguments * @return WorkerInstance Updated WorkerInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): WorkerInstance { $options = new Values($options); $data = Values::of([ 'ActivitySid' => $options['activitySid'], 'Attributes' => $options['attributes'], 'FriendlyName' => $options['friendlyName'], 'RejectPendingReservations' => Serialize::booleanToString($options['rejectPendingReservations']), ]); $headers = Values::of(['If-Match' => $options['ifMatch'], ]); $payload = $this->version->update('POST', $this->uri, [], $data, $headers); return new WorkerInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['sid'] ); } /** * Delete the WorkerInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { $options = new Values($options); $headers = Values::of(['If-Match' => $options['ifMatch'], ]); return $this->version->delete('DELETE', $this->uri, [], [], $headers); } /** * Access the realTimeStatistics */ protected function getRealTimeStatistics(): WorkersRealTimeStatisticsList { if (!$this->_realTimeStatistics) { $this->_realTimeStatistics = new WorkersRealTimeStatisticsList( $this->version, $this->solution['workspaceSid'] ); } return $this->_realTimeStatistics; } /** * Access the cumulativeStatistics */ protected function getCumulativeStatistics(): WorkersCumulativeStatisticsList { if (!$this->_cumulativeStatistics) { $this->_cumulativeStatistics = new WorkersCumulativeStatisticsList( $this->version, $this->solution['workspaceSid'] ); } return $this->_cumulativeStatistics; } /** * Access the statistics */ protected function getStatistics(): WorkerStatisticsList { if (!$this->_statistics) { $this->_statistics = new WorkerStatisticsList( $this->version, $this->solution['workspaceSid'], $this->solution['sid'] ); } return $this->_statistics; } /** * Access the reservations */ protected function getReservations(): ReservationList { if (!$this->_reservations) { $this->_reservations = new ReservationList( $this->version, $this->solution['workspaceSid'], $this->solution['sid'] ); } return $this->_reservations; } /** * Access the workerChannels */ protected function getWorkerChannels(): WorkerChannelList { if (!$this->_workerChannels) { $this->_workerChannels = new WorkerChannelList( $this->version, $this->solution['workspaceSid'], $this->solution['sid'] ); } return $this->_workerChannels; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.WorkerContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskInstance.php000064400000013623150515725670017230 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'age' => Values::array_get($payload, 'age'), 'assignmentStatus' => Values::array_get($payload, 'assignment_status'), 'attributes' => Values::array_get($payload, 'attributes'), 'addons' => Values::array_get($payload, 'addons'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'taskQueueEnteredDate' => Deserialize::dateTime(Values::array_get($payload, 'task_queue_entered_date')), 'priority' => Values::array_get($payload, 'priority'), 'reason' => Values::array_get($payload, 'reason'), 'sid' => Values::array_get($payload, 'sid'), 'taskQueueSid' => Values::array_get($payload, 'task_queue_sid'), 'taskQueueFriendlyName' => Values::array_get($payload, 'task_queue_friendly_name'), 'taskChannelSid' => Values::array_get($payload, 'task_channel_sid'), 'taskChannelUniqueName' => Values::array_get($payload, 'task_channel_unique_name'), 'timeout' => Values::array_get($payload, 'timeout'), 'workflowSid' => Values::array_get($payload, 'workflow_sid'), 'workflowFriendlyName' => Values::array_get($payload, 'workflow_friendly_name'), 'workspaceSid' => Values::array_get($payload, 'workspace_sid'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['workspaceSid' => $workspaceSid, '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 TaskContext Context for this TaskInstance */ protected function proxy(): TaskContext { if (!$this->context) { $this->context = new TaskContext( $this->version, $this->solution['workspaceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the TaskInstance * * @return TaskInstance Fetched TaskInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TaskInstance { return $this->proxy()->fetch(); } /** * Update the TaskInstance * * @param array|Options $options Optional Arguments * @return TaskInstance Updated TaskInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): TaskInstance { return $this->proxy()->update($options); } /** * Delete the TaskInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { return $this->proxy()->delete($options); } /** * Access the reservations */ protected function getReservations(): ReservationList { return $this->proxy()->reservations; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.TaskInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/WorkerPage.php000064400000002264150515725670016706 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return WorkerInstance \Twilio\Rest\Taskrouter\V1\Workspace\WorkerInstance */ public function buildInstance(array $payload): WorkerInstance { return new WorkerInstance($this->version, $payload, $this->solution['workspaceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.WorkerPage]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/EventInstance.php000064400000010671150515725670017407 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'actorSid' => Values::array_get($payload, 'actor_sid'), 'actorType' => Values::array_get($payload, 'actor_type'), 'actorUrl' => Values::array_get($payload, 'actor_url'), 'description' => Values::array_get($payload, 'description'), 'eventData' => Values::array_get($payload, 'event_data'), 'eventDate' => Deserialize::dateTime(Values::array_get($payload, 'event_date')), 'eventDateMs' => Values::array_get($payload, 'event_date_ms'), 'eventType' => Values::array_get($payload, 'event_type'), 'resourceSid' => Values::array_get($payload, 'resource_sid'), 'resourceType' => Values::array_get($payload, 'resource_type'), 'resourceUrl' => Values::array_get($payload, 'resource_url'), 'sid' => Values::array_get($payload, 'sid'), 'source' => Values::array_get($payload, 'source'), 'sourceIpAddress' => Values::array_get($payload, 'source_ip_address'), 'url' => Values::array_get($payload, 'url'), 'workspaceSid' => Values::array_get($payload, 'workspace_sid'), ]; $this->solution = ['workspaceSid' => $workspaceSid, '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 EventContext Context for this EventInstance */ protected function proxy(): EventContext { if (!$this->context) { $this->context = new EventContext( $this->version, $this->solution['workspaceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the EventInstance * * @return EventInstance Fetched EventInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): EventInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.EventInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/ActivityContext.php000064400000005363150515725670020004 0ustar00solution = ['workspaceSid' => $workspaceSid, 'sid' => $sid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/Activities/' . \rawurlencode($sid) . ''; } /** * Fetch the ActivityInstance * * @return ActivityInstance Fetched ActivityInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ActivityInstance { $payload = $this->version->fetch('GET', $this->uri); return new ActivityInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['sid'] ); } /** * Update the ActivityInstance * * @param array|Options $options Optional Arguments * @return ActivityInstance Updated ActivityInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ActivityInstance { $options = new Values($options); $data = Values::of(['FriendlyName' => $options['friendlyName'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ActivityInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['sid'] ); } /** * Delete the ActivityInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.ActivityContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/EventOptions.php000064400000020617150515725670017277 0ustar00options['endDate'] = $endDate; $this->options['eventType'] = $eventType; $this->options['minutes'] = $minutes; $this->options['reservationSid'] = $reservationSid; $this->options['startDate'] = $startDate; $this->options['taskQueueSid'] = $taskQueueSid; $this->options['taskSid'] = $taskSid; $this->options['workerSid'] = $workerSid; $this->options['workflowSid'] = $workflowSid; $this->options['taskChannel'] = $taskChannel; $this->options['sid'] = $sid; } /** * Only include Events that occurred on or before this date, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. * * @param \DateTime $endDate Only include usage that occurred on or before this * date * @return $this Fluent Builder */ public function setEndDate(\DateTime $endDate): self { $this->options['endDate'] = $endDate; return $this; } /** * The type of Events to read. Returns only Events of the type specified. * * @param string $eventType The type of Events to read * @return $this Fluent Builder */ public function setEventType(string $eventType): self { $this->options['eventType'] = $eventType; return $this; } /** * The period of events to read in minutes. Returns only Events that occurred since this many minutes in the past. The default is `15` minutes. Task Attributes for Events occuring more 43,200 minutes ago will be redacted. * * @param int $minutes The period of events to read in minutes * @return $this Fluent Builder */ public function setMinutes(int $minutes): self { $this->options['minutes'] = $minutes; return $this; } /** * The SID of the Reservation with the Events to read. Returns only Events that pertain to the specified Reservation. * * @param string $reservationSid The SID of the Reservation with the Events to * read * @return $this Fluent Builder */ public function setReservationSid(string $reservationSid): self { $this->options['reservationSid'] = $reservationSid; return $this; } /** * Only include Events from on or after this date and time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Task Attributes for Events older than 30 days will be redacted. * * @param \DateTime $startDate Only include Events from on or after this date * @return $this Fluent Builder */ public function setStartDate(\DateTime $startDate): self { $this->options['startDate'] = $startDate; return $this; } /** * The SID of the TaskQueue with the Events to read. Returns only the Events that pertain to the specified TaskQueue. * * @param string $taskQueueSid The SID of the TaskQueue with the Events to read * @return $this Fluent Builder */ public function setTaskQueueSid(string $taskQueueSid): self { $this->options['taskQueueSid'] = $taskQueueSid; return $this; } /** * The SID of the Task with the Events to read. Returns only the Events that pertain to the specified Task. * * @param string $taskSid The SID of the Task with the Events to read * @return $this Fluent Builder */ public function setTaskSid(string $taskSid): self { $this->options['taskSid'] = $taskSid; return $this; } /** * The SID of the Worker with the Events to read. Returns only the Events that pertain to the specified Worker. * * @param string $workerSid The SID of the Worker with the Events to read * @return $this Fluent Builder */ public function setWorkerSid(string $workerSid): self { $this->options['workerSid'] = $workerSid; return $this; } /** * The SID of the Workflow with the Events to read. Returns only the Events that pertain to the specified Workflow. * * @param string $workflowSid The SID of the Worker with the Events to read * @return $this Fluent Builder */ public function setWorkflowSid(string $workflowSid): self { $this->options['workflowSid'] = $workflowSid; return $this; } /** * The TaskChannel with the Events to read. Returns only the Events that pertain to the specified TaskChannel. * * @param string $taskChannel The TaskChannel with the Events to read * @return $this Fluent Builder */ public function setTaskChannel(string $taskChannel): self { $this->options['taskChannel'] = $taskChannel; return $this; } /** * The SID of the Event resource to read. * * @param string $sid The unique string that identifies the resource * @return $this Fluent Builder */ public function setSid(string $sid): self { $this->options['sid'] = $sid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.ReadEventOptions ' . $options . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/EventList.php000064400000013216150515725670016554 0ustar00solution = ['workspaceSid' => $workspaceSid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/Events'; } /** * Streams EventInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads EventInstance 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 EventInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of EventInstance 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 EventPage Page of EventInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): EventPage { $options = new Values($options); $params = Values::of([ 'EndDate' => Serialize::iso8601DateTime($options['endDate']), 'EventType' => $options['eventType'], 'Minutes' => $options['minutes'], 'ReservationSid' => $options['reservationSid'], 'StartDate' => Serialize::iso8601DateTime($options['startDate']), 'TaskQueueSid' => $options['taskQueueSid'], 'TaskSid' => $options['taskSid'], 'WorkerSid' => $options['workerSid'], 'WorkflowSid' => $options['workflowSid'], 'TaskChannel' => $options['taskChannel'], 'Sid' => $options['sid'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new EventPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of EventInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return EventPage Page of EventInstance */ public function getPage(string $targetUrl): EventPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new EventPage($this->version, $response, $this->solution); } /** * Constructs a EventContext * * @param string $sid The SID of the resource to fetch */ public function getContext(string $sid): EventContext { return new EventContext($this->version, $this->solution['workspaceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.EventList]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueueOptions.php000064400000036336150515725670020132 0ustar00options['friendlyName'] = $friendlyName; $this->options['targetWorkers'] = $targetWorkers; $this->options['reservationActivitySid'] = $reservationActivitySid; $this->options['assignmentActivitySid'] = $assignmentActivitySid; $this->options['maxReservedWorkers'] = $maxReservedWorkers; $this->options['taskOrder'] = $taskOrder; } /** * A descriptive string that you create to describe the TaskQueue. For example `Support-Tier 1`, `Sales`, or `Escalation`. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * A string describing the Worker selection criteria for any Tasks that enter the TaskQueue. For example '"language" == "spanish"' If no TargetWorkers parameter is provided, Tasks will wait in the queue until they are either deleted or moved to another queue. Additional examples on how to describing Worker selection criteria below. * * @param string $targetWorkers A string describing the Worker selection * criteria for any Tasks that enter the TaskQueue * @return $this Fluent Builder */ public function setTargetWorkers(string $targetWorkers): self { $this->options['targetWorkers'] = $targetWorkers; return $this; } /** * The SID of the Activity to assign Workers when a task is reserved for them. * * @param string $reservationActivitySid The SID of the Activity to assign * Workers when a task is reserved for * them * @return $this Fluent Builder */ public function setReservationActivitySid(string $reservationActivitySid): self { $this->options['reservationActivitySid'] = $reservationActivitySid; return $this; } /** * The SID of the Activity to assign Workers when a task is assigned for them. * * @param string $assignmentActivitySid The SID of the Activity to assign * Workers when a task is assigned for them * @return $this Fluent Builder */ public function setAssignmentActivitySid(string $assignmentActivitySid): self { $this->options['assignmentActivitySid'] = $assignmentActivitySid; return $this; } /** * The maximum number of Workers to create reservations for the assignment of a task while in the queue. Maximum of 50. * * @param int $maxReservedWorkers The maximum number of Workers to create * reservations for the assignment of a task * while in the queue * @return $this Fluent Builder */ public function setMaxReservedWorkers(int $maxReservedWorkers): self { $this->options['maxReservedWorkers'] = $maxReservedWorkers; return $this; } /** * How Tasks will be assigned to Workers. Can be: `FIFO` or `LIFO` and the default is `FIFO`. Use `FIFO` to assign the oldest task first and `LIFO` to assign the most recent task first. For more information, see [Queue Ordering](https://www.twilio.com/docs/taskrouter/queue-ordering-last-first-out-lifo). * * @param string $taskOrder How Tasks will be assigned to Workers * @return $this Fluent Builder */ public function setTaskOrder(string $taskOrder): self { $this->options['taskOrder'] = $taskOrder; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.UpdateTaskQueueOptions ' . $options . ']'; } } class ReadTaskQueueOptions extends Options { /** * @param string $friendlyName The friendly_name of the TaskQueue resources to * read * @param string $evaluateWorkerAttributes The attributes of the Workers to read * @param string $workerSid The SID of the Worker with the TaskQueue resources * to read */ public function __construct(string $friendlyName = Values::NONE, string $evaluateWorkerAttributes = Values::NONE, string $workerSid = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['evaluateWorkerAttributes'] = $evaluateWorkerAttributes; $this->options['workerSid'] = $workerSid; } /** * The `friendly_name` of the TaskQueue resources to read. * * @param string $friendlyName The friendly_name of the TaskQueue resources to * read * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The attributes of the Workers to read. Returns the TaskQueues with Workers that match the attributes specified in this parameter. * * @param string $evaluateWorkerAttributes The attributes of the Workers to read * @return $this Fluent Builder */ public function setEvaluateWorkerAttributes(string $evaluateWorkerAttributes): self { $this->options['evaluateWorkerAttributes'] = $evaluateWorkerAttributes; return $this; } /** * The SID of the Worker with the TaskQueue resources to read. * * @param string $workerSid The SID of the Worker with the TaskQueue resources * to read * @return $this Fluent Builder */ public function setWorkerSid(string $workerSid): self { $this->options['workerSid'] = $workerSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.ReadTaskQueueOptions ' . $options . ']'; } } class CreateTaskQueueOptions extends Options { /** * @param string $targetWorkers A string describing the Worker selection * criteria for any Tasks that enter the TaskQueue * @param int $maxReservedWorkers The maximum number of Workers to reserve * @param string $taskOrder How Tasks will be assigned to Workers * @param string $reservationActivitySid The SID of the Activity to assign * Workers when a task is reserved for * them * @param string $assignmentActivitySid The SID of the Activity to assign * Workers once a task is assigned to them */ public function __construct(string $targetWorkers = Values::NONE, int $maxReservedWorkers = Values::NONE, string $taskOrder = Values::NONE, string $reservationActivitySid = Values::NONE, string $assignmentActivitySid = Values::NONE) { $this->options['targetWorkers'] = $targetWorkers; $this->options['maxReservedWorkers'] = $maxReservedWorkers; $this->options['taskOrder'] = $taskOrder; $this->options['reservationActivitySid'] = $reservationActivitySid; $this->options['assignmentActivitySid'] = $assignmentActivitySid; } /** * A string that describes the Worker selection criteria for any Tasks that enter the TaskQueue. For example, `'"language" == "spanish"'`. The default value is `1==1`. If this value is empty, Tasks will wait in the TaskQueue until they are deleted or moved to another TaskQueue. For more information about Worker selection, see [Describing Worker selection criteria](https://www.twilio.com/docs/taskrouter/api/taskqueues#target-workers). * * @param string $targetWorkers A string describing the Worker selection * criteria for any Tasks that enter the TaskQueue * @return $this Fluent Builder */ public function setTargetWorkers(string $targetWorkers): self { $this->options['targetWorkers'] = $targetWorkers; return $this; } /** * The maximum number of Workers to reserve for the assignment of a Task in the queue. Can be an integer between 1 and 50, inclusive and defaults to 1. * * @param int $maxReservedWorkers The maximum number of Workers to reserve * @return $this Fluent Builder */ public function setMaxReservedWorkers(int $maxReservedWorkers): self { $this->options['maxReservedWorkers'] = $maxReservedWorkers; return $this; } /** * How Tasks will be assigned to Workers. Set this parameter to `LIFO` to assign most recently created Task first or FIFO to assign the oldest Task first. Default is `FIFO`. [Click here](https://www.twilio.com/docs/taskrouter/queue-ordering-last-first-out-lifo) to learn more. * * @param string $taskOrder How Tasks will be assigned to Workers * @return $this Fluent Builder */ public function setTaskOrder(string $taskOrder): self { $this->options['taskOrder'] = $taskOrder; return $this; } /** * The SID of the Activity to assign Workers when a task is reserved for them. * * @param string $reservationActivitySid The SID of the Activity to assign * Workers when a task is reserved for * them * @return $this Fluent Builder */ public function setReservationActivitySid(string $reservationActivitySid): self { $this->options['reservationActivitySid'] = $reservationActivitySid; return $this; } /** * The SID of the Activity to assign Workers when a task is assigned to them. * * @param string $assignmentActivitySid The SID of the Activity to assign * Workers once a task is assigned to them * @return $this Fluent Builder */ public function setAssignmentActivitySid(string $assignmentActivitySid): self { $this->options['assignmentActivitySid'] = $assignmentActivitySid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.CreateTaskQueueOptions ' . $options . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskChannelInstance.php000064400000011043150515725670020513 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), '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'), 'sid' => Values::array_get($payload, 'sid'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'workspaceSid' => Values::array_get($payload, 'workspace_sid'), 'channelOptimizedRouting' => Values::array_get($payload, 'channel_optimized_routing'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['workspaceSid' => $workspaceSid, '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 TaskChannelContext Context for this TaskChannelInstance */ protected function proxy(): TaskChannelContext { if (!$this->context) { $this->context = new TaskChannelContext( $this->version, $this->solution['workspaceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the TaskChannelInstance * * @return TaskChannelInstance Fetched TaskChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TaskChannelInstance { return $this->proxy()->fetch(); } /** * Update the TaskChannelInstance * * @param array|Options $options Optional Arguments * @return TaskChannelInstance Updated TaskChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): TaskChannelInstance { return $this->proxy()->update($options); } /** * Delete the TaskChannelInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.TaskChannelInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/WorkspaceStatisticsList.php000064400000002151150515725670021500 0ustar00solution = ['workspaceSid' => $workspaceSid, ]; } /** * Constructs a WorkspaceStatisticsContext */ public function getContext(): WorkspaceStatisticsContext { return new WorkspaceStatisticsContext($this->version, $this->solution['workspaceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.WorkspaceStatisticsList]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Task/ReservationContext.php000064400000015035150515725670021410 0ustar00solution = ['workspaceSid' => $workspaceSid, 'taskSid' => $taskSid, 'sid' => $sid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/Tasks/' . \rawurlencode($taskSid) . '/Reservations/' . \rawurlencode($sid) . ''; } /** * Fetch the ReservationInstance * * @return ReservationInstance Fetched ReservationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ReservationInstance { $payload = $this->version->fetch('GET', $this->uri); return new ReservationInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['taskSid'], $this->solution['sid'] ); } /** * Update the ReservationInstance * * @param array|Options $options Optional Arguments * @return ReservationInstance Updated ReservationInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ReservationInstance { $options = new Values($options); $data = Values::of([ 'ReservationStatus' => $options['reservationStatus'], 'WorkerActivitySid' => $options['workerActivitySid'], 'Instruction' => $options['instruction'], 'DequeuePostWorkActivitySid' => $options['dequeuePostWorkActivitySid'], 'DequeueFrom' => $options['dequeueFrom'], 'DequeueRecord' => $options['dequeueRecord'], 'DequeueTimeout' => $options['dequeueTimeout'], 'DequeueTo' => $options['dequeueTo'], 'DequeueStatusCallbackUrl' => $options['dequeueStatusCallbackUrl'], 'CallFrom' => $options['callFrom'], 'CallRecord' => $options['callRecord'], 'CallTimeout' => $options['callTimeout'], 'CallTo' => $options['callTo'], 'CallUrl' => $options['callUrl'], 'CallStatusCallbackUrl' => $options['callStatusCallbackUrl'], 'CallAccept' => Serialize::booleanToString($options['callAccept']), 'RedirectCallSid' => $options['redirectCallSid'], 'RedirectAccept' => Serialize::booleanToString($options['redirectAccept']), 'RedirectUrl' => $options['redirectUrl'], 'To' => $options['to'], 'From' => $options['from'], 'StatusCallback' => $options['statusCallback'], 'StatusCallbackMethod' => $options['statusCallbackMethod'], 'StatusCallbackEvent' => Serialize::map($options['statusCallbackEvent'], function($e) { return $e; }), 'Timeout' => $options['timeout'], 'Record' => Serialize::booleanToString($options['record']), 'Muted' => Serialize::booleanToString($options['muted']), 'Beep' => $options['beep'], 'StartConferenceOnEnter' => Serialize::booleanToString($options['startConferenceOnEnter']), 'EndConferenceOnExit' => Serialize::booleanToString($options['endConferenceOnExit']), 'WaitUrl' => $options['waitUrl'], 'WaitMethod' => $options['waitMethod'], 'EarlyMedia' => Serialize::booleanToString($options['earlyMedia']), 'MaxParticipants' => $options['maxParticipants'], 'ConferenceStatusCallback' => $options['conferenceStatusCallback'], 'ConferenceStatusCallbackMethod' => $options['conferenceStatusCallbackMethod'], 'ConferenceStatusCallbackEvent' => Serialize::map($options['conferenceStatusCallbackEvent'], function($e) { return $e; }), 'ConferenceRecord' => $options['conferenceRecord'], 'ConferenceTrim' => $options['conferenceTrim'], 'RecordingChannels' => $options['recordingChannels'], 'RecordingStatusCallback' => $options['recordingStatusCallback'], 'RecordingStatusCallbackMethod' => $options['recordingStatusCallbackMethod'], 'ConferenceRecordingStatusCallback' => $options['conferenceRecordingStatusCallback'], 'ConferenceRecordingStatusCallbackMethod' => $options['conferenceRecordingStatusCallbackMethod'], 'Region' => $options['region'], 'SipAuthUsername' => $options['sipAuthUsername'], 'SipAuthPassword' => $options['sipAuthPassword'], 'DequeueStatusCallbackEvent' => Serialize::map($options['dequeueStatusCallbackEvent'], function($e) { return $e; }), 'PostWorkActivitySid' => $options['postWorkActivitySid'], 'SupervisorMode' => $options['supervisorMode'], 'Supervisor' => $options['supervisor'], 'EndConferenceOnCustomerExit' => Serialize::booleanToString($options['endConferenceOnCustomerExit']), 'BeepOnCustomerEntrance' => Serialize::booleanToString($options['beepOnCustomerEntrance']), ]); $headers = Values::of(['If-Match' => $options['ifMatch'], ]); $payload = $this->version->update('POST', $this->uri, [], $data, $headers); return new ReservationInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['taskSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.ReservationContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Task/ReservationInstance.php000064400000011061150515725670021523 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'reservationStatus' => Values::array_get($payload, 'reservation_status'), 'sid' => Values::array_get($payload, 'sid'), 'taskSid' => Values::array_get($payload, 'task_sid'), 'workerName' => Values::array_get($payload, 'worker_name'), 'workerSid' => Values::array_get($payload, 'worker_sid'), 'workspaceSid' => Values::array_get($payload, 'workspace_sid'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = [ 'workspaceSid' => $workspaceSid, 'taskSid' => $taskSid, '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 ReservationContext Context for this ReservationInstance */ protected function proxy(): ReservationContext { if (!$this->context) { $this->context = new ReservationContext( $this->version, $this->solution['workspaceSid'], $this->solution['taskSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the ReservationInstance * * @return ReservationInstance Fetched ReservationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ReservationInstance { return $this->proxy()->fetch(); } /** * Update the ReservationInstance * * @param array|Options $options Optional Arguments * @return ReservationInstance Updated ReservationInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ReservationInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.ReservationInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Task/ReservationOptions.php000064400000146522150515725670021425 0ustar00options['reservationStatus'] = $reservationStatus; } /** * Returns the list of reservations for a task with a specified ReservationStatus. Can be: `pending`, `accepted`, `rejected`, or `timeout`. * * @param string $reservationStatus Returns the list of reservations for a task * with a specified ReservationStatus * @return $this Fluent Builder */ public function setReservationStatus(string $reservationStatus): self { $this->options['reservationStatus'] = $reservationStatus; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.ReadReservationOptions ' . $options . ']'; } } class UpdateReservationOptions extends Options { /** * @param string $reservationStatus The new status of the reservation * @param string $workerActivitySid The new worker activity SID if rejecting a * reservation * @param string $instruction The assignment instruction for reservation * @param string $dequeuePostWorkActivitySid The SID of the Activity resource * to start after executing a Dequeue * instruction * @param string $dequeueFrom The Caller ID of the call to the worker when * executing a Dequeue instruction * @param string $dequeueRecord Whether to record both legs of a call when * executing a Dequeue instruction * @param int $dequeueTimeout Timeout for call when executing a Dequeue * instruction * @param string $dequeueTo The Contact URI of the worker when executing a * Dequeue instruction * @param string $dequeueStatusCallbackUrl The Callback URL for completed call * event when executing a Dequeue * instruction * @param string $callFrom The Caller ID of the outbound call when executing a * Call instruction * @param string $callRecord Whether to record both legs of a call when * executing a Call instruction * @param int $callTimeout Timeout for call when executing a Call instruction * @param string $callTo The Contact URI of the worker when executing a Call * instruction * @param string $callUrl TwiML URI executed on answering the worker's leg as a * result of the Call instruction * @param string $callStatusCallbackUrl The URL to call for the completed call * event when executing a Call instruction * @param bool $callAccept Whether to accept a reservation when executing a * Call instruction * @param string $redirectCallSid The Call SID of the call parked in the queue * when executing a Redirect instruction * @param bool $redirectAccept Whether the reservation should be accepted when * executing a Redirect instruction * @param string $redirectUrl TwiML URI to redirect the call to when executing * the Redirect instruction * @param string $to The Contact URI of the worker when executing a Conference * instruction * @param string $from The Caller ID of the call to the worker when executing a * Conference instruction * @param string $statusCallback The URL we should call to send status * information to your application * @param string $statusCallbackMethod The HTTP method we should use to call * status_callback * @param string[] $statusCallbackEvent The call progress events that we will * send to status_callback * @param int $timeout Timeout for call when executing a Conference instruction * @param bool $record Whether to record the participant and their conferences * @param bool $muted Whether to mute the agent * @param string $beep Whether to play a notification beep when the participant * joins * @param bool $startConferenceOnEnter Whether the conference starts when the * participant joins the conference * @param bool $endConferenceOnExit Whether to end the conference when the * agent leaves * @param string $waitUrl URL that hosts pre-conference hold music * @param string $waitMethod The HTTP method we should use to call `wait_url` * @param bool $earlyMedia Whether agents can hear the state of the outbound * call * @param int $maxParticipants The maximum number of agent conference * participants * @param string $conferenceStatusCallback The callback URL for conference * events * @param string $conferenceStatusCallbackMethod HTTP method for requesting * `conference_status_callback` * URL * @param string[] $conferenceStatusCallbackEvent The conference status events * that we will send to * conference_status_callback * @param string $conferenceRecord Whether to record the conference the * participant is joining * @param string $conferenceTrim How to trim leading and trailing silence from * your recorded conference audio files * @param string $recordingChannels Specify `mono` or `dual` recording channels * @param string $recordingStatusCallback The URL that we should call using the * `recording_status_callback_method` * when the recording status changes * @param string $recordingStatusCallbackMethod The HTTP method we should use * when we call * `recording_status_callback` * @param string $conferenceRecordingStatusCallback The URL we should call * using the * `conference_recording_status_callback_method` when the conference recording is available * @param string $conferenceRecordingStatusCallbackMethod The HTTP method we * should use to call * `conference_recording_status_callback` * @param string $region The region where we should mix the conference audio * @param string $sipAuthUsername The SIP username used for authentication * @param string $sipAuthPassword The SIP password for authentication * @param string[] $dequeueStatusCallbackEvent The Call progress events sent * via webhooks as a result of a * Dequeue instruction * @param string $postWorkActivitySid The new worker activity SID after * executing a Conference instruction * @param string $supervisorMode The Supervisor mode when executing the * Supervise instruction * @param string $supervisor The Supervisor SID/URI when executing the * Supervise instruction * @param bool $endConferenceOnCustomerExit Whether to end the conference when * the customer leaves * @param bool $beepOnCustomerEntrance Whether to play a notification beep when * the customer joins * @param string $ifMatch The If-Match HTTP request header */ public function __construct(string $reservationStatus = Values::NONE, string $workerActivitySid = Values::NONE, string $instruction = Values::NONE, string $dequeuePostWorkActivitySid = Values::NONE, string $dequeueFrom = Values::NONE, string $dequeueRecord = Values::NONE, int $dequeueTimeout = Values::NONE, string $dequeueTo = Values::NONE, string $dequeueStatusCallbackUrl = Values::NONE, string $callFrom = Values::NONE, string $callRecord = Values::NONE, int $callTimeout = Values::NONE, string $callTo = Values::NONE, string $callUrl = Values::NONE, string $callStatusCallbackUrl = Values::NONE, bool $callAccept = Values::NONE, string $redirectCallSid = Values::NONE, bool $redirectAccept = Values::NONE, string $redirectUrl = Values::NONE, string $to = Values::NONE, string $from = Values::NONE, string $statusCallback = Values::NONE, string $statusCallbackMethod = Values::NONE, array $statusCallbackEvent = Values::ARRAY_NONE, int $timeout = Values::NONE, bool $record = Values::NONE, bool $muted = Values::NONE, string $beep = Values::NONE, bool $startConferenceOnEnter = Values::NONE, bool $endConferenceOnExit = Values::NONE, string $waitUrl = Values::NONE, string $waitMethod = Values::NONE, bool $earlyMedia = Values::NONE, int $maxParticipants = Values::NONE, string $conferenceStatusCallback = Values::NONE, string $conferenceStatusCallbackMethod = Values::NONE, array $conferenceStatusCallbackEvent = Values::ARRAY_NONE, string $conferenceRecord = Values::NONE, string $conferenceTrim = Values::NONE, string $recordingChannels = Values::NONE, string $recordingStatusCallback = Values::NONE, string $recordingStatusCallbackMethod = Values::NONE, string $conferenceRecordingStatusCallback = Values::NONE, string $conferenceRecordingStatusCallbackMethod = Values::NONE, string $region = Values::NONE, string $sipAuthUsername = Values::NONE, string $sipAuthPassword = Values::NONE, array $dequeueStatusCallbackEvent = Values::ARRAY_NONE, string $postWorkActivitySid = Values::NONE, string $supervisorMode = Values::NONE, string $supervisor = Values::NONE, bool $endConferenceOnCustomerExit = Values::NONE, bool $beepOnCustomerEntrance = Values::NONE, string $ifMatch = Values::NONE) { $this->options['reservationStatus'] = $reservationStatus; $this->options['workerActivitySid'] = $workerActivitySid; $this->options['instruction'] = $instruction; $this->options['dequeuePostWorkActivitySid'] = $dequeuePostWorkActivitySid; $this->options['dequeueFrom'] = $dequeueFrom; $this->options['dequeueRecord'] = $dequeueRecord; $this->options['dequeueTimeout'] = $dequeueTimeout; $this->options['dequeueTo'] = $dequeueTo; $this->options['dequeueStatusCallbackUrl'] = $dequeueStatusCallbackUrl; $this->options['callFrom'] = $callFrom; $this->options['callRecord'] = $callRecord; $this->options['callTimeout'] = $callTimeout; $this->options['callTo'] = $callTo; $this->options['callUrl'] = $callUrl; $this->options['callStatusCallbackUrl'] = $callStatusCallbackUrl; $this->options['callAccept'] = $callAccept; $this->options['redirectCallSid'] = $redirectCallSid; $this->options['redirectAccept'] = $redirectAccept; $this->options['redirectUrl'] = $redirectUrl; $this->options['to'] = $to; $this->options['from'] = $from; $this->options['statusCallback'] = $statusCallback; $this->options['statusCallbackMethod'] = $statusCallbackMethod; $this->options['statusCallbackEvent'] = $statusCallbackEvent; $this->options['timeout'] = $timeout; $this->options['record'] = $record; $this->options['muted'] = $muted; $this->options['beep'] = $beep; $this->options['startConferenceOnEnter'] = $startConferenceOnEnter; $this->options['endConferenceOnExit'] = $endConferenceOnExit; $this->options['waitUrl'] = $waitUrl; $this->options['waitMethod'] = $waitMethod; $this->options['earlyMedia'] = $earlyMedia; $this->options['maxParticipants'] = $maxParticipants; $this->options['conferenceStatusCallback'] = $conferenceStatusCallback; $this->options['conferenceStatusCallbackMethod'] = $conferenceStatusCallbackMethod; $this->options['conferenceStatusCallbackEvent'] = $conferenceStatusCallbackEvent; $this->options['conferenceRecord'] = $conferenceRecord; $this->options['conferenceTrim'] = $conferenceTrim; $this->options['recordingChannels'] = $recordingChannels; $this->options['recordingStatusCallback'] = $recordingStatusCallback; $this->options['recordingStatusCallbackMethod'] = $recordingStatusCallbackMethod; $this->options['conferenceRecordingStatusCallback'] = $conferenceRecordingStatusCallback; $this->options['conferenceRecordingStatusCallbackMethod'] = $conferenceRecordingStatusCallbackMethod; $this->options['region'] = $region; $this->options['sipAuthUsername'] = $sipAuthUsername; $this->options['sipAuthPassword'] = $sipAuthPassword; $this->options['dequeueStatusCallbackEvent'] = $dequeueStatusCallbackEvent; $this->options['postWorkActivitySid'] = $postWorkActivitySid; $this->options['supervisorMode'] = $supervisorMode; $this->options['supervisor'] = $supervisor; $this->options['endConferenceOnCustomerExit'] = $endConferenceOnCustomerExit; $this->options['beepOnCustomerEntrance'] = $beepOnCustomerEntrance; $this->options['ifMatch'] = $ifMatch; } /** * The new status of the reservation. Can be: `pending`, `accepted`, `rejected`, or `timeout`. * * @param string $reservationStatus The new status of the reservation * @return $this Fluent Builder */ public function setReservationStatus(string $reservationStatus): self { $this->options['reservationStatus'] = $reservationStatus; return $this; } /** * The new worker activity SID if rejecting a reservation. * * @param string $workerActivitySid The new worker activity SID if rejecting a * reservation * @return $this Fluent Builder */ public function setWorkerActivitySid(string $workerActivitySid): self { $this->options['workerActivitySid'] = $workerActivitySid; return $this; } /** * The assignment instruction for reservation. * * @param string $instruction The assignment instruction for reservation * @return $this Fluent Builder */ public function setInstruction(string $instruction): self { $this->options['instruction'] = $instruction; return $this; } /** * The SID of the Activity resource to start after executing a Dequeue instruction. * * @param string $dequeuePostWorkActivitySid The SID of the Activity resource * to start after executing a Dequeue * instruction * @return $this Fluent Builder */ public function setDequeuePostWorkActivitySid(string $dequeuePostWorkActivitySid): self { $this->options['dequeuePostWorkActivitySid'] = $dequeuePostWorkActivitySid; return $this; } /** * The Caller ID of the call to the worker when executing a Dequeue instruction. * * @param string $dequeueFrom The Caller ID of the call to the worker when * executing a Dequeue instruction * @return $this Fluent Builder */ public function setDequeueFrom(string $dequeueFrom): self { $this->options['dequeueFrom'] = $dequeueFrom; return $this; } /** * Whether to record both legs of a call when executing a Dequeue instruction or which leg to record. * * @param string $dequeueRecord Whether to record both legs of a call when * executing a Dequeue instruction * @return $this Fluent Builder */ public function setDequeueRecord(string $dequeueRecord): self { $this->options['dequeueRecord'] = $dequeueRecord; return $this; } /** * Timeout for call when executing a Dequeue instruction. * * @param int $dequeueTimeout Timeout for call when executing a Dequeue * instruction * @return $this Fluent Builder */ public function setDequeueTimeout(int $dequeueTimeout): self { $this->options['dequeueTimeout'] = $dequeueTimeout; return $this; } /** * The Contact URI of the worker when executing a Dequeue instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination. * * @param string $dequeueTo The Contact URI of the worker when executing a * Dequeue instruction * @return $this Fluent Builder */ public function setDequeueTo(string $dequeueTo): self { $this->options['dequeueTo'] = $dequeueTo; return $this; } /** * The Callback URL for completed call event when executing a Dequeue instruction. * * @param string $dequeueStatusCallbackUrl The Callback URL for completed call * event when executing a Dequeue * instruction * @return $this Fluent Builder */ public function setDequeueStatusCallbackUrl(string $dequeueStatusCallbackUrl): self { $this->options['dequeueStatusCallbackUrl'] = $dequeueStatusCallbackUrl; return $this; } /** * The Caller ID of the outbound call when executing a Call instruction. * * @param string $callFrom The Caller ID of the outbound call when executing a * Call instruction * @return $this Fluent Builder */ public function setCallFrom(string $callFrom): self { $this->options['callFrom'] = $callFrom; return $this; } /** * Whether to record both legs of a call when executing a Call instruction or which leg to record. * * @param string $callRecord Whether to record both legs of a call when * executing a Call instruction * @return $this Fluent Builder */ public function setCallRecord(string $callRecord): self { $this->options['callRecord'] = $callRecord; return $this; } /** * Timeout for call when executing a Call instruction. * * @param int $callTimeout Timeout for call when executing a Call instruction * @return $this Fluent Builder */ public function setCallTimeout(int $callTimeout): self { $this->options['callTimeout'] = $callTimeout; return $this; } /** * The Contact URI of the worker when executing a Call instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination. * * @param string $callTo The Contact URI of the worker when executing a Call * instruction * @return $this Fluent Builder */ public function setCallTo(string $callTo): self { $this->options['callTo'] = $callTo; return $this; } /** * TwiML URI executed on answering the worker's leg as a result of the Call instruction. * * @param string $callUrl TwiML URI executed on answering the worker's leg as a * result of the Call instruction * @return $this Fluent Builder */ public function setCallUrl(string $callUrl): self { $this->options['callUrl'] = $callUrl; return $this; } /** * The URL to call for the completed call event when executing a Call instruction. * * @param string $callStatusCallbackUrl The URL to call for the completed call * event when executing a Call instruction * @return $this Fluent Builder */ public function setCallStatusCallbackUrl(string $callStatusCallbackUrl): self { $this->options['callStatusCallbackUrl'] = $callStatusCallbackUrl; return $this; } /** * Whether to accept a reservation when executing a Call instruction. * * @param bool $callAccept Whether to accept a reservation when executing a * Call instruction * @return $this Fluent Builder */ public function setCallAccept(bool $callAccept): self { $this->options['callAccept'] = $callAccept; return $this; } /** * The Call SID of the call parked in the queue when executing a Redirect instruction. * * @param string $redirectCallSid The Call SID of the call parked in the queue * when executing a Redirect instruction * @return $this Fluent Builder */ public function setRedirectCallSid(string $redirectCallSid): self { $this->options['redirectCallSid'] = $redirectCallSid; return $this; } /** * Whether the reservation should be accepted when executing a Redirect instruction. * * @param bool $redirectAccept Whether the reservation should be accepted when * executing a Redirect instruction * @return $this Fluent Builder */ public function setRedirectAccept(bool $redirectAccept): self { $this->options['redirectAccept'] = $redirectAccept; return $this; } /** * TwiML URI to redirect the call to when executing the Redirect instruction. * * @param string $redirectUrl TwiML URI to redirect the call to when executing * the Redirect instruction * @return $this Fluent Builder */ public function setRedirectUrl(string $redirectUrl): self { $this->options['redirectUrl'] = $redirectUrl; return $this; } /** * The Contact URI of the worker when executing a Conference instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination. * * @param string $to The Contact URI of the worker when executing a Conference * instruction * @return $this Fluent Builder */ public function setTo(string $to): self { $this->options['to'] = $to; return $this; } /** * The Caller ID of the call to the worker when executing a Conference instruction. * * @param string $from The Caller ID of the call to the worker when executing a * Conference instruction * @return $this Fluent Builder */ public function setFrom(string $from): self { $this->options['from'] = $from; return $this; } /** * The URL we should call using the `status_callback_method` to send status information to your application. * * @param string $statusCallback The URL we should call to send status * information to your application * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * The HTTP method we should use to call `status_callback`. Can be: `POST` or `GET` and the default is `POST`. * * @param string $statusCallbackMethod The HTTP method we should use to call * status_callback * @return $this Fluent Builder */ public function setStatusCallbackMethod(string $statusCallbackMethod): self { $this->options['statusCallbackMethod'] = $statusCallbackMethod; return $this; } /** * The call progress events that we will send to `status_callback`. Can be: `initiated`, `ringing`, `answered`, or `completed`. * * @param string[] $statusCallbackEvent The call progress events that we will * send to status_callback * @return $this Fluent Builder */ public function setStatusCallbackEvent(array $statusCallbackEvent): self { $this->options['statusCallbackEvent'] = $statusCallbackEvent; return $this; } /** * Timeout for call when executing a Conference instruction. * * @param int $timeout Timeout for call when executing a Conference instruction * @return $this Fluent Builder */ public function setTimeout(int $timeout): self { $this->options['timeout'] = $timeout; return $this; } /** * Whether to record the participant and their conferences, including the time between conferences. The default is `false`. * * @param bool $record Whether to record the participant and their conferences * @return $this Fluent Builder */ public function setRecord(bool $record): self { $this->options['record'] = $record; return $this; } /** * Whether the agent is muted in the conference. The default is `false`. * * @param bool $muted Whether to mute the agent * @return $this Fluent Builder */ public function setMuted(bool $muted): self { $this->options['muted'] = $muted; return $this; } /** * Whether to play a notification beep when the participant joins or when to play a beep. Can be: `true`, `false`, `onEnter`, or `onExit`. The default value is `true`. * * @param string $beep Whether to play a notification beep when the participant * joins * @return $this Fluent Builder */ public function setBeep(string $beep): self { $this->options['beep'] = $beep; return $this; } /** * Whether to start the conference when the participant joins, if it has not already started. The default is `true`. If `false` and the conference has not started, the participant is muted and hears background music until another participant starts the conference. * * @param bool $startConferenceOnEnter Whether the conference starts when the * participant joins the conference * @return $this Fluent Builder */ public function setStartConferenceOnEnter(bool $startConferenceOnEnter): self { $this->options['startConferenceOnEnter'] = $startConferenceOnEnter; return $this; } /** * Whether to end the conference when the agent leaves. * * @param bool $endConferenceOnExit Whether to end the conference when the * agent leaves * @return $this Fluent Builder */ public function setEndConferenceOnExit(bool $endConferenceOnExit): self { $this->options['endConferenceOnExit'] = $endConferenceOnExit; return $this; } /** * The URL we should call using the `wait_method` for the music to play while participants are waiting for the conference to start. The default value is the URL of our standard hold music. [Learn more about hold music](https://www.twilio.com/labs/twimlets/holdmusic). * * @param string $waitUrl URL that hosts pre-conference hold music * @return $this Fluent Builder */ public function setWaitUrl(string $waitUrl): self { $this->options['waitUrl'] = $waitUrl; return $this; } /** * The HTTP method we should use to call `wait_url`. Can be `GET` or `POST` and the default is `POST`. When using a static audio file, this should be `GET` so that we can cache the file. * * @param string $waitMethod The HTTP method we should use to call `wait_url` * @return $this Fluent Builder */ public function setWaitMethod(string $waitMethod): self { $this->options['waitMethod'] = $waitMethod; return $this; } /** * Whether to allow an agent to hear the state of the outbound call, including ringing or disconnect messages. The default is `true`. * * @param bool $earlyMedia Whether agents can hear the state of the outbound * call * @return $this Fluent Builder */ public function setEarlyMedia(bool $earlyMedia): self { $this->options['earlyMedia'] = $earlyMedia; return $this; } /** * The maximum number of participants in the conference. Can be a positive integer from `2` to `250`. The default value is `250`. * * @param int $maxParticipants The maximum number of agent conference * participants * @return $this Fluent Builder */ public function setMaxParticipants(int $maxParticipants): self { $this->options['maxParticipants'] = $maxParticipants; return $this; } /** * The URL we should call using the `conference_status_callback_method` when the conference events in `conference_status_callback_event` occur. Only the value set by the first participant to join the conference is used. Subsequent `conference_status_callback` values are ignored. * * @param string $conferenceStatusCallback The callback URL for conference * events * @return $this Fluent Builder */ public function setConferenceStatusCallback(string $conferenceStatusCallback): self { $this->options['conferenceStatusCallback'] = $conferenceStatusCallback; return $this; } /** * The HTTP method we should use to call `conference_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $conferenceStatusCallbackMethod HTTP method for requesting * `conference_status_callback` * URL * @return $this Fluent Builder */ public function setConferenceStatusCallbackMethod(string $conferenceStatusCallbackMethod): self { $this->options['conferenceStatusCallbackMethod'] = $conferenceStatusCallbackMethod; return $this; } /** * The conference status events that we will send to `conference_status_callback`. Can be: `start`, `end`, `join`, `leave`, `mute`, `hold`, `speaker`. * * @param string[] $conferenceStatusCallbackEvent The conference status events * that we will send to * conference_status_callback * @return $this Fluent Builder */ public function setConferenceStatusCallbackEvent(array $conferenceStatusCallbackEvent): self { $this->options['conferenceStatusCallbackEvent'] = $conferenceStatusCallbackEvent; return $this; } /** * Whether to record the conference the participant is joining or when to record the conference. Can be: `true`, `false`, `record-from-start`, and `do-not-record`. The default value is `false`. * * @param string $conferenceRecord Whether to record the conference the * participant is joining * @return $this Fluent Builder */ public function setConferenceRecord(string $conferenceRecord): self { $this->options['conferenceRecord'] = $conferenceRecord; return $this; } /** * How to trim the leading and trailing silence from your recorded conference audio files. Can be: `trim-silence` or `do-not-trim` and defaults to `trim-silence`. * * @param string $conferenceTrim How to trim leading and trailing silence from * your recorded conference audio files * @return $this Fluent Builder */ public function setConferenceTrim(string $conferenceTrim): self { $this->options['conferenceTrim'] = $conferenceTrim; return $this; } /** * The recording channels for the final recording. Can be: `mono` or `dual` and the default is `mono`. * * @param string $recordingChannels Specify `mono` or `dual` recording channels * @return $this Fluent Builder */ public function setRecordingChannels(string $recordingChannels): self { $this->options['recordingChannels'] = $recordingChannels; return $this; } /** * The URL that we should call using the `recording_status_callback_method` when the recording status changes. * * @param string $recordingStatusCallback The URL that we should call using the * `recording_status_callback_method` * when the recording status changes * @return $this Fluent Builder */ public function setRecordingStatusCallback(string $recordingStatusCallback): self { $this->options['recordingStatusCallback'] = $recordingStatusCallback; return $this; } /** * The HTTP method we should use when we call `recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $recordingStatusCallbackMethod The HTTP method we should use * when we call * `recording_status_callback` * @return $this Fluent Builder */ public function setRecordingStatusCallbackMethod(string $recordingStatusCallbackMethod): self { $this->options['recordingStatusCallbackMethod'] = $recordingStatusCallbackMethod; return $this; } /** * The URL we should call using the `conference_recording_status_callback_method` when the conference recording is available. * * @param string $conferenceRecordingStatusCallback The URL we should call * using the * `conference_recording_status_callback_method` when the conference recording is available * @return $this Fluent Builder */ public function setConferenceRecordingStatusCallback(string $conferenceRecordingStatusCallback): self { $this->options['conferenceRecordingStatusCallback'] = $conferenceRecordingStatusCallback; return $this; } /** * The HTTP method we should use to call `conference_recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $conferenceRecordingStatusCallbackMethod The HTTP method we * should use to call * `conference_recording_status_callback` * @return $this Fluent Builder */ public function setConferenceRecordingStatusCallbackMethod(string $conferenceRecordingStatusCallbackMethod): self { $this->options['conferenceRecordingStatusCallbackMethod'] = $conferenceRecordingStatusCallbackMethod; return $this; } /** * The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. * * @param string $region The region where we should mix the conference audio * @return $this Fluent Builder */ public function setRegion(string $region): self { $this->options['region'] = $region; return $this; } /** * The SIP username used for authentication. * * @param string $sipAuthUsername The SIP username used for authentication * @return $this Fluent Builder */ public function setSipAuthUsername(string $sipAuthUsername): self { $this->options['sipAuthUsername'] = $sipAuthUsername; return $this; } /** * The SIP password for authentication. * * @param string $sipAuthPassword The SIP password for authentication * @return $this Fluent Builder */ public function setSipAuthPassword(string $sipAuthPassword): self { $this->options['sipAuthPassword'] = $sipAuthPassword; return $this; } /** * The Call progress events sent via webhooks as a result of a Dequeue instruction. * * @param string[] $dequeueStatusCallbackEvent The Call progress events sent * via webhooks as a result of a * Dequeue instruction * @return $this Fluent Builder */ public function setDequeueStatusCallbackEvent(array $dequeueStatusCallbackEvent): self { $this->options['dequeueStatusCallbackEvent'] = $dequeueStatusCallbackEvent; return $this; } /** * The new worker activity SID after executing a Conference instruction. * * @param string $postWorkActivitySid The new worker activity SID after * executing a Conference instruction * @return $this Fluent Builder */ public function setPostWorkActivitySid(string $postWorkActivitySid): self { $this->options['postWorkActivitySid'] = $postWorkActivitySid; return $this; } /** * The Supervisor mode when executing the Supervise instruction. * * @param string $supervisorMode The Supervisor mode when executing the * Supervise instruction * @return $this Fluent Builder */ public function setSupervisorMode(string $supervisorMode): self { $this->options['supervisorMode'] = $supervisorMode; return $this; } /** * The Supervisor SID/URI when executing the Supervise instruction. * * @param string $supervisor The Supervisor SID/URI when executing the * Supervise instruction * @return $this Fluent Builder */ public function setSupervisor(string $supervisor): self { $this->options['supervisor'] = $supervisor; return $this; } /** * Whether to end the conference when the customer leaves. * * @param bool $endConferenceOnCustomerExit Whether to end the conference when * the customer leaves * @return $this Fluent Builder */ public function setEndConferenceOnCustomerExit(bool $endConferenceOnCustomerExit): self { $this->options['endConferenceOnCustomerExit'] = $endConferenceOnCustomerExit; return $this; } /** * Whether to play a notification beep when the customer joins. * * @param bool $beepOnCustomerEntrance Whether to play a notification beep when * the customer joins * @return $this Fluent Builder */ public function setBeepOnCustomerEntrance(bool $beepOnCustomerEntrance): self { $this->options['beepOnCustomerEntrance'] = $beepOnCustomerEntrance; return $this; } /** * The If-Match HTTP request header * * @param string $ifMatch The If-Match HTTP request header * @return $this Fluent Builder */ public function setIfMatch(string $ifMatch): self { $this->options['ifMatch'] = $ifMatch; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.UpdateReservationOptions ' . $options . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Task/ReservationList.php000064400000013000150515725670020665 0ustar00solution = ['workspaceSid' => $workspaceSid, 'taskSid' => $taskSid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/Tasks/' . \rawurlencode($taskSid) . '/Reservations'; } /** * Streams ReservationInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ReservationInstance 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 ReservationInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of ReservationInstance 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 ReservationPage Page of ReservationInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ReservationPage { $options = new Values($options); $params = Values::of([ 'ReservationStatus' => $options['reservationStatus'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ReservationPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ReservationInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ReservationPage Page of ReservationInstance */ public function getPage(string $targetUrl): ReservationPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ReservationPage($this->version, $response, $this->solution); } /** * Constructs a ReservationContext * * @param string $sid The SID of the TaskReservation resource to fetch */ public function getContext(string $sid): ReservationContext { return new ReservationContext( $this->version, $this->solution['workspaceSid'], $this->solution['taskSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.ReservationList]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Task/ReservationPage.php000064400000002462150515725670020640 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ReservationInstance \Twilio\Rest\Taskrouter\V1\Workspace\Task\ReservationInstance */ public function buildInstance(array $payload): ReservationInstance { return new ReservationInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['taskSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.ReservationPage]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/ActivityPage.php000064400000002300150515725670017220 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ActivityInstance \Twilio\Rest\Taskrouter\V1\Workspace\ActivityInstance */ public function buildInstance(array $payload): ActivityInstance { return new ActivityInstance($this->version, $payload, $this->solution['workspaceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.ActivityPage]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskChannelContext.php000064400000005673150515725670020407 0ustar00solution = ['workspaceSid' => $workspaceSid, 'sid' => $sid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/TaskChannels/' . \rawurlencode($sid) . ''; } /** * Fetch the TaskChannelInstance * * @return TaskChannelInstance Fetched TaskChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TaskChannelInstance { $payload = $this->version->fetch('GET', $this->uri); return new TaskChannelInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['sid'] ); } /** * Update the TaskChannelInstance * * @param array|Options $options Optional Arguments * @return TaskChannelInstance Updated TaskChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): TaskChannelInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'ChannelOptimizedRouting' => Serialize::booleanToString($options['channelOptimizedRouting']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new TaskChannelInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['sid'] ); } /** * Delete the TaskChannelInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.TaskChannelContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/WorkspaceStatisticsInstance.php000064400000006372150515725670022342 0ustar00properties = [ 'realtime' => Values::array_get($payload, 'realtime'), 'cumulative' => Values::array_get($payload, 'cumulative'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'workspaceSid' => Values::array_get($payload, 'workspace_sid'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['workspaceSid' => $workspaceSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return WorkspaceStatisticsContext Context for this * WorkspaceStatisticsInstance */ protected function proxy(): WorkspaceStatisticsContext { if (!$this->context) { $this->context = new WorkspaceStatisticsContext($this->version, $this->solution['workspaceSid']); } return $this->context; } /** * Fetch the WorkspaceStatisticsInstance * * @param array|Options $options Optional Arguments * @return WorkspaceStatisticsInstance Fetched WorkspaceStatisticsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): WorkspaceStatisticsInstance { return $this->proxy()->fetch($options); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.WorkspaceStatisticsInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/WorkspaceCumulativeStatisticsPage.php000064400000002554150515725670023507 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return WorkspaceCumulativeStatisticsInstance \Twilio\Rest\Taskrouter\V1\Workspace\WorkspaceCumulativeStatisticsInstance */ public function buildInstance(array $payload): WorkspaceCumulativeStatisticsInstance { return new WorkspaceCumulativeStatisticsInstance( $this->version, $payload, $this->solution['workspaceSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.WorkspaceCumulativeStatisticsPage]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/WorkspaceRealTimeStatisticsContext.php000064400000004004150515725670023633 0ustar00solution = ['workspaceSid' => $workspaceSid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/RealTimeStatistics'; } /** * Fetch the WorkspaceRealTimeStatisticsInstance * * @param array|Options $options Optional Arguments * @return WorkspaceRealTimeStatisticsInstance Fetched * WorkspaceRealTimeStatisticsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): WorkspaceRealTimeStatisticsInstance { $options = new Values($options); $params = Values::of(['TaskChannel' => $options['taskChannel'], ]); $payload = $this->version->fetch('GET', $this->uri, $params); return new WorkspaceRealTimeStatisticsInstance( $this->version, $payload, $this->solution['workspaceSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.WorkspaceRealTimeStatisticsContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskOptions.php000064400000050726150515725670017124 0ustar00options['attributes'] = $attributes; $this->options['assignmentStatus'] = $assignmentStatus; $this->options['reason'] = $reason; $this->options['priority'] = $priority; $this->options['taskChannel'] = $taskChannel; $this->options['ifMatch'] = $ifMatch; } /** * The JSON string that describes the custom attributes of the task. * * @param string $attributes The JSON string that describes the custom * attributes of the task * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The new status of the task. Can be: `canceled`, to cancel a Task that is currently `pending` or `reserved`; `wrapping`, to move the Task to wrapup state; or `completed`, to move a Task to the completed state. * * @param string $assignmentStatus The new status of the task * @return $this Fluent Builder */ public function setAssignmentStatus(string $assignmentStatus): self { $this->options['assignmentStatus'] = $assignmentStatus; return $this; } /** * The reason that the Task was canceled or completed. This parameter is required only if the Task is canceled or completed. Setting this value queues the task for deletion and logs the reason. * * @param string $reason The reason that the Task was canceled or complete * @return $this Fluent Builder */ public function setReason(string $reason): self { $this->options['reason'] = $reason; return $this; } /** * The Task's new priority value. When supplied, the Task takes on the specified priority unless it matches a Workflow Target with a Priority set. Value can be 0 to 2^31^ (2,147,483,647). * * @param int $priority The Task's new priority value * @return $this Fluent Builder */ public function setPriority(int $priority): self { $this->options['priority'] = $priority; return $this; } /** * When MultiTasking is enabled, specify the TaskChannel with the task to update. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. * * @param string $taskChannel When MultiTasking is enabled, specify the * TaskChannel with the task to update * @return $this Fluent Builder */ public function setTaskChannel(string $taskChannel): self { $this->options['taskChannel'] = $taskChannel; return $this; } /** * If provided, applies this mutation if (and only if) the [ETag](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag) header of the Task matches the provided value. This matches the semantics of (and is implemented with) the HTTP [If-Match header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match). * * @param string $ifMatch The If-Match HTTP request header * @return $this Fluent Builder */ public function setIfMatch(string $ifMatch): self { $this->options['ifMatch'] = $ifMatch; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.UpdateTaskOptions ' . $options . ']'; } } class DeleteTaskOptions extends Options { /** * @param string $ifMatch The If-Match HTTP request header */ public function __construct(string $ifMatch = Values::NONE) { $this->options['ifMatch'] = $ifMatch; } /** * If provided, deletes this Task if (and only if) the [ETag](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag) header of the Task matches the provided value. This matches the semantics of (and is implemented with) the HTTP [If-Match header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match). * * @param string $ifMatch The If-Match HTTP request header * @return $this Fluent Builder */ public function setIfMatch(string $ifMatch): self { $this->options['ifMatch'] = $ifMatch; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.DeleteTaskOptions ' . $options . ']'; } } class ReadTaskOptions extends Options { /** * @param int $priority The priority value of the Tasks to read * @param string[] $assignmentStatus Returns the list of all Tasks in the * Workspace with the specified * assignment_status * @param string $workflowSid The SID of the Workflow with the Tasks to read * @param string $workflowName The friendly name of the Workflow with the Tasks * to read * @param string $taskQueueSid The SID of the TaskQueue with the Tasks to read * @param string $taskQueueName The friendly_name of the TaskQueue with the * Tasks to read * @param string $evaluateTaskAttributes The task attributes of the Tasks to * read * @param string $ordering Controls the order of the Tasks returned * @param bool $hasAddons Whether to read Tasks with addons */ public function __construct(int $priority = Values::NONE, array $assignmentStatus = Values::ARRAY_NONE, string $workflowSid = Values::NONE, string $workflowName = Values::NONE, string $taskQueueSid = Values::NONE, string $taskQueueName = Values::NONE, string $evaluateTaskAttributes = Values::NONE, string $ordering = Values::NONE, bool $hasAddons = Values::NONE) { $this->options['priority'] = $priority; $this->options['assignmentStatus'] = $assignmentStatus; $this->options['workflowSid'] = $workflowSid; $this->options['workflowName'] = $workflowName; $this->options['taskQueueSid'] = $taskQueueSid; $this->options['taskQueueName'] = $taskQueueName; $this->options['evaluateTaskAttributes'] = $evaluateTaskAttributes; $this->options['ordering'] = $ordering; $this->options['hasAddons'] = $hasAddons; } /** * The priority value of the Tasks to read. Returns the list of all Tasks in the Workspace with the specified priority. * * @param int $priority The priority value of the Tasks to read * @return $this Fluent Builder */ public function setPriority(int $priority): self { $this->options['priority'] = $priority; return $this; } /** * The `assignment_status` of the Tasks you want to read. Can be: `pending`, `reserved`, `assigned`, `canceled`, `wrapping`, or `completed`. Returns all Tasks in the Workspace with the specified `assignment_status`. * * @param string[] $assignmentStatus Returns the list of all Tasks in the * Workspace with the specified * assignment_status * @return $this Fluent Builder */ public function setAssignmentStatus(array $assignmentStatus): self { $this->options['assignmentStatus'] = $assignmentStatus; return $this; } /** * The SID of the Workflow with the Tasks to read. Returns the Tasks controlled by the Workflow identified by this SID. * * @param string $workflowSid The SID of the Workflow with the Tasks to read * @return $this Fluent Builder */ public function setWorkflowSid(string $workflowSid): self { $this->options['workflowSid'] = $workflowSid; return $this; } /** * The friendly name of the Workflow with the Tasks to read. Returns the Tasks controlled by the Workflow identified by this friendly name. * * @param string $workflowName The friendly name of the Workflow with the Tasks * to read * @return $this Fluent Builder */ public function setWorkflowName(string $workflowName): self { $this->options['workflowName'] = $workflowName; return $this; } /** * The SID of the TaskQueue with the Tasks to read. Returns the Tasks waiting in the TaskQueue identified by this SID. * * @param string $taskQueueSid The SID of the TaskQueue with the Tasks to read * @return $this Fluent Builder */ public function setTaskQueueSid(string $taskQueueSid): self { $this->options['taskQueueSid'] = $taskQueueSid; return $this; } /** * The `friendly_name` of the TaskQueue with the Tasks to read. Returns the Tasks waiting in the TaskQueue identified by this friendly name. * * @param string $taskQueueName The friendly_name of the TaskQueue with the * Tasks to read * @return $this Fluent Builder */ public function setTaskQueueName(string $taskQueueName): self { $this->options['taskQueueName'] = $taskQueueName; return $this; } /** * The attributes of the Tasks to read. Returns the Tasks that match the attributes specified in this parameter. * * @param string $evaluateTaskAttributes The task attributes of the Tasks to * read * @return $this Fluent Builder */ public function setEvaluateTaskAttributes(string $evaluateTaskAttributes): self { $this->options['evaluateTaskAttributes'] = $evaluateTaskAttributes; return $this; } /** * How to order the returned Task resources. y default, Tasks are sorted by ascending DateCreated. This value is specified as: `Attribute:Order`, where `Attribute` can be either `Priority` or `DateCreated` and `Order` can be either `asc` or `desc`. For example, `Priority:desc` returns Tasks ordered in descending order of their Priority. Multiple sort orders can be specified in a comma-separated list such as `Priority:desc,DateCreated:asc`, which returns the Tasks in descending Priority order and ascending DateCreated Order. * * @param string $ordering Controls the order of the Tasks returned * @return $this Fluent Builder */ public function setOrdering(string $ordering): self { $this->options['ordering'] = $ordering; return $this; } /** * Whether to read Tasks with addons. If `true`, returns only Tasks with addons. If `false`, returns only Tasks without addons. * * @param bool $hasAddons Whether to read Tasks with addons * @return $this Fluent Builder */ public function setHasAddons(bool $hasAddons): self { $this->options['hasAddons'] = $hasAddons; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.ReadTaskOptions ' . $options . ']'; } } class CreateTaskOptions extends Options { /** * @param int $timeout The amount of time in seconds the task can live before * being assigned * @param int $priority The priority to assign the new task and override the * default * @param string $taskChannel When MultiTasking is enabled specify the * TaskChannel by passing either its unique_name or * SID * @param string $workflowSid The SID of the Workflow that you would like to * handle routing for the new Task * @param string $attributes A URL-encoded JSON string describing the * attributes of the task */ public function __construct(int $timeout = Values::NONE, int $priority = Values::NONE, string $taskChannel = Values::NONE, string $workflowSid = Values::NONE, string $attributes = Values::NONE) { $this->options['timeout'] = $timeout; $this->options['priority'] = $priority; $this->options['taskChannel'] = $taskChannel; $this->options['workflowSid'] = $workflowSid; $this->options['attributes'] = $attributes; } /** * The amount of time in seconds the new task can live before being assigned. Can be up to a maximum of 2 weeks (1,209,600 seconds). The default value is 24 hours (86,400 seconds). On timeout, the `task.canceled` event will fire with description `Task TTL Exceeded`. * * @param int $timeout The amount of time in seconds the task can live before * being assigned * @return $this Fluent Builder */ public function setTimeout(int $timeout): self { $this->options['timeout'] = $timeout; return $this; } /** * The priority to assign the new task and override the default. When supplied, the new Task will have this priority unless it matches a Workflow Target with a Priority set. When not supplied, the new Task will have the priority of the matching Workflow Target. Value can be 0 to 2^31^ (2,147,483,647). * * @param int $priority The priority to assign the new task and override the * default * @return $this Fluent Builder */ public function setPriority(int $priority): self { $this->options['priority'] = $priority; return $this; } /** * When MultiTasking is enabled, specify the TaskChannel by passing either its `unique_name` or `sid`. Default value is `default`. * * @param string $taskChannel When MultiTasking is enabled specify the * TaskChannel by passing either its unique_name or * SID * @return $this Fluent Builder */ public function setTaskChannel(string $taskChannel): self { $this->options['taskChannel'] = $taskChannel; return $this; } /** * The SID of the Workflow that you would like to handle routing for the new Task. If there is only one Workflow defined for the Workspace that you are posting the new task to, this parameter is optional. * * @param string $workflowSid The SID of the Workflow that you would like to * handle routing for the new Task * @return $this Fluent Builder */ public function setWorkflowSid(string $workflowSid): self { $this->options['workflowSid'] = $workflowSid; return $this; } /** * A URL-encoded JSON string with the attributes of the new task. This value is passed to the Workflow's `assignment_callback_url` when the Task is assigned to a Worker. For example: `{ "task_type": "call", "twilio_call_sid": "CAxxx", "customer_ticket_number": "12345" }`. * * @param string $attributes A URL-encoded JSON string describing the * attributes of the task * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.CreateTaskOptions ' . $options . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskChannelList.php000064400000013670150515725670017672 0ustar00solution = ['workspaceSid' => $workspaceSid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/TaskChannels'; } /** * Streams TaskChannelInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads TaskChannelInstance 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 TaskChannelInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of TaskChannelInstance 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 TaskChannelPage Page of TaskChannelInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): TaskChannelPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new TaskChannelPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of TaskChannelInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return TaskChannelPage Page of TaskChannelInstance */ public function getPage(string $targetUrl): TaskChannelPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new TaskChannelPage($this->version, $response, $this->solution); } /** * Create the TaskChannelInstance * * @param string $friendlyName A string to describe the Task Channel resource * @param string $uniqueName An application-defined string that uniquely * identifies the Task Channel * @param array|Options $options Optional Arguments * @return TaskChannelInstance Created TaskChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, string $uniqueName, array $options = []): TaskChannelInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $friendlyName, 'UniqueName' => $uniqueName, 'ChannelOptimizedRouting' => Serialize::booleanToString($options['channelOptimizedRouting']), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new TaskChannelInstance($this->version, $payload, $this->solution['workspaceSid']); } /** * Constructs a TaskChannelContext * * @param string $sid The SID of the Task Channel resource to fetch */ public function getContext(string $sid): TaskChannelContext { return new TaskChannelContext($this->version, $this->solution['workspaceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.TaskChannelList]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/WorkspaceRealTimeStatisticsPage.php000064400000002540150515725670023066 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return WorkspaceRealTimeStatisticsInstance \Twilio\Rest\Taskrouter\V1\Workspace\WorkspaceRealTimeStatisticsInstance */ public function buildInstance(array $payload): WorkspaceRealTimeStatisticsInstance { return new WorkspaceRealTimeStatisticsInstance( $this->version, $payload, $this->solution['workspaceSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.WorkspaceRealTimeStatisticsPage]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/EventPage.php000064400000002256150515725670016517 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return EventInstance \Twilio\Rest\Taskrouter\V1\Workspace\EventInstance */ public function buildInstance(array $payload): EventInstance { return new EventInstance($this->version, $payload, $this->solution['workspaceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.EventPage]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueueStatisticsPage.php000064400000002561150515725670023326 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return TaskQueueStatisticsInstance \Twilio\Rest\Taskrouter\V1\Workspace\TaskQueue\TaskQueueStatisticsInstance */ public function buildInstance(array $payload): TaskQueueStatisticsInstance { return new TaskQueueStatisticsInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['taskQueueSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.TaskQueueStatisticsPage]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueueStatisticsOptions.php000064400000012676150515725670024115 0ustar00options['endDate'] = $endDate; $this->options['minutes'] = $minutes; $this->options['startDate'] = $startDate; $this->options['taskChannel'] = $taskChannel; $this->options['splitByWaitTime'] = $splitByWaitTime; } /** * Only calculate statistics from this date and time and earlier, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. * * @param \DateTime $endDate Only calculate statistics from on or before this * date * @return $this Fluent Builder */ public function setEndDate(\DateTime $endDate): self { $this->options['endDate'] = $endDate; return $this; } /** * Only calculate statistics since this many minutes in the past. The default is 15 minutes. * * @param int $minutes Only calculate statistics since this many minutes in the * past * @return $this Fluent Builder */ public function setMinutes(int $minutes): self { $this->options['minutes'] = $minutes; return $this; } /** * Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. * * @param \DateTime $startDate Only calculate statistics from on or after this * date * @return $this Fluent Builder */ public function setStartDate(\DateTime $startDate): self { $this->options['startDate'] = $startDate; return $this; } /** * Only calculate real-time and cumulative statistics for the specified TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. * * @param string $taskChannel Only calculate real-time and cumulative * statistics for the specified TaskChannel * @return $this Fluent Builder */ public function setTaskChannel(string $taskChannel): self { $this->options['taskChannel'] = $taskChannel; return $this; } /** * A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. * * @param string $splitByWaitTime A comma separated list of values that * describes the thresholds to calculate * statistics on * @return $this Fluent Builder */ public function setSplitByWaitTime(string $splitByWaitTime): self { $this->options['splitByWaitTime'] = $splitByWaitTime; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.FetchTaskQueueStatisticsOptions ' . $options . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueueStatisticsInstance.php000064400000007323150515725670024217 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'cumulative' => Values::array_get($payload, 'cumulative'), 'realtime' => Values::array_get($payload, 'realtime'), 'taskQueueSid' => Values::array_get($payload, 'task_queue_sid'), 'workspaceSid' => Values::array_get($payload, 'workspace_sid'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['workspaceSid' => $workspaceSid, 'taskQueueSid' => $taskQueueSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return TaskQueueStatisticsContext Context for this * TaskQueueStatisticsInstance */ protected function proxy(): TaskQueueStatisticsContext { if (!$this->context) { $this->context = new TaskQueueStatisticsContext( $this->version, $this->solution['workspaceSid'], $this->solution['taskQueueSid'] ); } return $this->context; } /** * Fetch the TaskQueueStatisticsInstance * * @param array|Options $options Optional Arguments * @return TaskQueueStatisticsInstance Fetched TaskQueueStatisticsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): TaskQueueStatisticsInstance { return $this->proxy()->fetch($options); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.TaskQueueStatisticsInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueueCumulativeStatisticsOptions.php000064400000012632150515725670026144 0ustar00options['endDate'] = $endDate; $this->options['minutes'] = $minutes; $this->options['startDate'] = $startDate; $this->options['taskChannel'] = $taskChannel; $this->options['splitByWaitTime'] = $splitByWaitTime; } /** * Only calculate statistics from this date and time and earlier, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. * * @param \DateTime $endDate Only calculate statistics from on or before this * date * @return $this Fluent Builder */ public function setEndDate(\DateTime $endDate): self { $this->options['endDate'] = $endDate; return $this; } /** * Only calculate statistics since this many minutes in the past. The default is 15 minutes. * * @param int $minutes Only calculate statistics since this many minutes in the * past * @return $this Fluent Builder */ public function setMinutes(int $minutes): self { $this->options['minutes'] = $minutes; return $this; } /** * Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. * * @param \DateTime $startDate Only calculate statistics from on or after this * date * @return $this Fluent Builder */ public function setStartDate(\DateTime $startDate): self { $this->options['startDate'] = $startDate; return $this; } /** * Only calculate cumulative statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. * * @param string $taskChannel Only calculate cumulative statistics on this * TaskChannel * @return $this Fluent Builder */ public function setTaskChannel(string $taskChannel): self { $this->options['taskChannel'] = $taskChannel; return $this; } /** * A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. * * @param string $splitByWaitTime A comma separated list of values that * describes the thresholds to calculate * statistics on * @return $this Fluent Builder */ public function setSplitByWaitTime(string $splitByWaitTime): self { $this->options['splitByWaitTime'] = $splitByWaitTime; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.FetchTaskQueueCumulativeStatisticsOptions ' . $options . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueueRealTimeStatisticsInstance.php000064400000011723150515725670025641 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'activityStatistics' => Values::array_get($payload, 'activity_statistics'), 'longestTaskWaitingAge' => Values::array_get($payload, 'longest_task_waiting_age'), 'longestTaskWaitingSid' => Values::array_get($payload, 'longest_task_waiting_sid'), 'longestRelativeTaskAgeInQueue' => Values::array_get($payload, 'longest_relative_task_age_in_queue'), 'longestRelativeTaskSidInQueue' => Values::array_get($payload, 'longest_relative_task_sid_in_queue'), 'taskQueueSid' => Values::array_get($payload, 'task_queue_sid'), 'tasksByPriority' => Values::array_get($payload, 'tasks_by_priority'), 'tasksByStatus' => Values::array_get($payload, 'tasks_by_status'), 'totalAvailableWorkers' => Values::array_get($payload, 'total_available_workers'), 'totalEligibleWorkers' => Values::array_get($payload, 'total_eligible_workers'), 'totalTasks' => Values::array_get($payload, 'total_tasks'), 'workspaceSid' => Values::array_get($payload, 'workspace_sid'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['workspaceSid' => $workspaceSid, 'taskQueueSid' => $taskQueueSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return TaskQueueRealTimeStatisticsContext Context for this * TaskQueueRealTimeStatisticsInstance */ protected function proxy(): TaskQueueRealTimeStatisticsContext { if (!$this->context) { $this->context = new TaskQueueRealTimeStatisticsContext( $this->version, $this->solution['workspaceSid'], $this->solution['taskQueueSid'] ); } return $this->context; } /** * Fetch the TaskQueueRealTimeStatisticsInstance * * @param array|Options $options Optional Arguments * @return TaskQueueRealTimeStatisticsInstance Fetched * TaskQueueRealTimeStatisticsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): TaskQueueRealTimeStatisticsInstance { return $this->proxy()->fetch($options); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.TaskQueueRealTimeStatisticsInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueuesStatisticsPage.php000064400000002434150515725670023510 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return TaskQueuesStatisticsInstance \Twilio\Rest\Taskrouter\V1\Workspace\TaskQueue\TaskQueuesStatisticsInstance */ public function buildInstance(array $payload): TaskQueuesStatisticsInstance { return new TaskQueuesStatisticsInstance($this->version, $payload, $this->solution['workspaceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.TaskQueuesStatisticsPage]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueuesStatisticsOptions.php000064400000013746150515725670024277 0ustar00options['endDate'] = $endDate; $this->options['friendlyName'] = $friendlyName; $this->options['minutes'] = $minutes; $this->options['startDate'] = $startDate; $this->options['taskChannel'] = $taskChannel; $this->options['splitByWaitTime'] = $splitByWaitTime; } /** * Only calculate statistics from this date and time and earlier, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. * * @param \DateTime $endDate Only calculate statistics from on or before this * date * @return $this Fluent Builder */ public function setEndDate(\DateTime $endDate): self { $this->options['endDate'] = $endDate; return $this; } /** * The `friendly_name` of the TaskQueue statistics to read. * * @param string $friendlyName The friendly_name of the TaskQueue statistics to * read * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Only calculate statistics since this many minutes in the past. The default is 15 minutes. * * @param int $minutes Only calculate statistics since this many minutes in the * past * @return $this Fluent Builder */ public function setMinutes(int $minutes): self { $this->options['minutes'] = $minutes; return $this; } /** * Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. * * @param \DateTime $startDate Only calculate statistics from on or after this * date * @return $this Fluent Builder */ public function setStartDate(\DateTime $startDate): self { $this->options['startDate'] = $startDate; return $this; } /** * Only calculate statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. * * @param string $taskChannel Only calculate statistics on this TaskChannel. * @return $this Fluent Builder */ public function setTaskChannel(string $taskChannel): self { $this->options['taskChannel'] = $taskChannel; return $this; } /** * A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. * * @param string $splitByWaitTime A comma separated list of values that * describes the thresholds to calculate * statistics on * @return $this Fluent Builder */ public function setSplitByWaitTime(string $splitByWaitTime): self { $this->options['splitByWaitTime'] = $splitByWaitTime; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.ReadTaskQueuesStatisticsOptions ' . $options . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueueRealTimeStatisticsList.php000064400000002763150515725670025014 0ustar00solution = ['workspaceSid' => $workspaceSid, 'taskQueueSid' => $taskQueueSid, ]; } /** * Constructs a TaskQueueRealTimeStatisticsContext */ public function getContext(): TaskQueueRealTimeStatisticsContext { return new TaskQueueRealTimeStatisticsContext( $this->version, $this->solution['workspaceSid'], $this->solution['taskQueueSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.TaskQueueRealTimeStatisticsList]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueueCumulativeStatisticsInstance.php000064400000013720150515725670026254 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'avgTaskAcceptanceTime' => Values::array_get($payload, 'avg_task_acceptance_time'), 'startTime' => Deserialize::dateTime(Values::array_get($payload, 'start_time')), 'endTime' => Deserialize::dateTime(Values::array_get($payload, 'end_time')), 'reservationsCreated' => Values::array_get($payload, 'reservations_created'), 'reservationsAccepted' => Values::array_get($payload, 'reservations_accepted'), 'reservationsRejected' => Values::array_get($payload, 'reservations_rejected'), 'reservationsTimedOut' => Values::array_get($payload, 'reservations_timed_out'), 'reservationsCanceled' => Values::array_get($payload, 'reservations_canceled'), 'reservationsRescinded' => Values::array_get($payload, 'reservations_rescinded'), 'splitByWaitTime' => Values::array_get($payload, 'split_by_wait_time'), 'taskQueueSid' => Values::array_get($payload, 'task_queue_sid'), 'waitDurationUntilAccepted' => Values::array_get($payload, 'wait_duration_until_accepted'), 'waitDurationUntilCanceled' => Values::array_get($payload, 'wait_duration_until_canceled'), 'waitDurationInQueueUntilAccepted' => Values::array_get($payload, 'wait_duration_in_queue_until_accepted'), 'tasksCanceled' => Values::array_get($payload, 'tasks_canceled'), 'tasksCompleted' => Values::array_get($payload, 'tasks_completed'), 'tasksDeleted' => Values::array_get($payload, 'tasks_deleted'), 'tasksEntered' => Values::array_get($payload, 'tasks_entered'), 'tasksMoved' => Values::array_get($payload, 'tasks_moved'), 'workspaceSid' => Values::array_get($payload, 'workspace_sid'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['workspaceSid' => $workspaceSid, 'taskQueueSid' => $taskQueueSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return TaskQueueCumulativeStatisticsContext Context for this * TaskQueueCumulativeStatisticsInstance */ protected function proxy(): TaskQueueCumulativeStatisticsContext { if (!$this->context) { $this->context = new TaskQueueCumulativeStatisticsContext( $this->version, $this->solution['workspaceSid'], $this->solution['taskQueueSid'] ); } return $this->context; } /** * Fetch the TaskQueueCumulativeStatisticsInstance * * @param array|Options $options Optional Arguments * @return TaskQueueCumulativeStatisticsInstance Fetched * TaskQueueCumulativeStatisticsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): TaskQueueCumulativeStatisticsInstance { return $this->proxy()->fetch($options); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.TaskQueueCumulativeStatisticsInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueuesStatisticsList.php000064400000012722150515725670023550 0ustar00solution = ['workspaceSid' => $workspaceSid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/TaskQueues/Statistics'; } /** * Streams TaskQueuesStatisticsInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads TaskQueuesStatisticsInstance 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 TaskQueuesStatisticsInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of TaskQueuesStatisticsInstance 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 TaskQueuesStatisticsPage Page of TaskQueuesStatisticsInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): TaskQueuesStatisticsPage { $options = new Values($options); $params = Values::of([ 'EndDate' => Serialize::iso8601DateTime($options['endDate']), 'FriendlyName' => $options['friendlyName'], 'Minutes' => $options['minutes'], 'StartDate' => Serialize::iso8601DateTime($options['startDate']), 'TaskChannel' => $options['taskChannel'], 'SplitByWaitTime' => $options['splitByWaitTime'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new TaskQueuesStatisticsPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of TaskQueuesStatisticsInstance records from the * API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return TaskQueuesStatisticsPage Page of TaskQueuesStatisticsInstance */ public function getPage(string $targetUrl): TaskQueuesStatisticsPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new TaskQueuesStatisticsPage($this->version, $response, $this->solution); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.TaskQueuesStatisticsList]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueuesStatisticsInstance.php000064400000004357150515725670024406 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'cumulative' => Values::array_get($payload, 'cumulative'), 'realtime' => Values::array_get($payload, 'realtime'), 'taskQueueSid' => Values::array_get($payload, 'task_queue_sid'), 'workspaceSid' => Values::array_get($payload, 'workspace_sid'), ]; $this->solution = ['workspaceSid' => $workspaceSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Taskrouter.V1.TaskQueuesStatisticsInstance]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueueStatisticsContext.php000064400000005002150515725670024067 0ustar00solution = ['workspaceSid' => $workspaceSid, 'taskQueueSid' => $taskQueueSid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/TaskQueues/' . \rawurlencode($taskQueueSid) . '/Statistics'; } /** * Fetch the TaskQueueStatisticsInstance * * @param array|Options $options Optional Arguments * @return TaskQueueStatisticsInstance Fetched TaskQueueStatisticsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): TaskQueueStatisticsInstance { $options = new Values($options); $params = Values::of([ 'EndDate' => Serialize::iso8601DateTime($options['endDate']), 'Minutes' => $options['minutes'], 'StartDate' => Serialize::iso8601DateTime($options['startDate']), 'TaskChannel' => $options['taskChannel'], 'SplitByWaitTime' => $options['splitByWaitTime'], ]); $payload = $this->version->fetch('GET', $this->uri, $params); return new TaskQueueStatisticsInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['taskQueueSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.TaskQueueStatisticsContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueueRealTimeStatisticsPage.php000064400000002641150515725670024750 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return TaskQueueRealTimeStatisticsInstance \Twilio\Rest\Taskrouter\V1\Workspace\TaskQueue\TaskQueueRealTimeStatisticsInstance */ public function buildInstance(array $payload): TaskQueueRealTimeStatisticsInstance { return new TaskQueueRealTimeStatisticsInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['taskQueueSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.TaskQueueRealTimeStatisticsPage]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueueCumulativeStatisticsContext.php000064400000005221150515725670026131 0ustar00solution = ['workspaceSid' => $workspaceSid, 'taskQueueSid' => $taskQueueSid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/TaskQueues/' . \rawurlencode($taskQueueSid) . '/CumulativeStatistics'; } /** * Fetch the TaskQueueCumulativeStatisticsInstance * * @param array|Options $options Optional Arguments * @return TaskQueueCumulativeStatisticsInstance Fetched * TaskQueueCumulativeStatisticsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): TaskQueueCumulativeStatisticsInstance { $options = new Values($options); $params = Values::of([ 'EndDate' => Serialize::iso8601DateTime($options['endDate']), 'Minutes' => $options['minutes'], 'StartDate' => Serialize::iso8601DateTime($options['startDate']), 'TaskChannel' => $options['taskChannel'], 'SplitByWaitTime' => $options['splitByWaitTime'], ]); $payload = $this->version->fetch('GET', $this->uri, $params); return new TaskQueueCumulativeStatisticsInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['taskQueueSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.TaskQueueCumulativeStatisticsContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueueRealTimeStatisticsOptions.php000064400000003232150515725670025524 0ustar00options['taskChannel'] = $taskChannel; } /** * The TaskChannel for which to fetch statistics. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. * * @param string $taskChannel The TaskChannel for which to fetch statistics * @return $this Fluent Builder */ public function setTaskChannel(string $taskChannel): self { $this->options['taskChannel'] = $taskChannel; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.FetchTaskQueueRealTimeStatisticsOptions ' . $options . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueueStatisticsList.php000064400000002703150515725670023363 0ustar00solution = ['workspaceSid' => $workspaceSid, 'taskQueueSid' => $taskQueueSid, ]; } /** * Constructs a TaskQueueStatisticsContext */ public function getContext(): TaskQueueStatisticsContext { return new TaskQueueStatisticsContext( $this->version, $this->solution['workspaceSid'], $this->solution['taskQueueSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.TaskQueueStatisticsList]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueueCumulativeStatisticsPage.php000064400000002655150515725670025371 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return TaskQueueCumulativeStatisticsInstance \Twilio\Rest\Taskrouter\V1\Workspace\TaskQueue\TaskQueueCumulativeStatisticsInstance */ public function buildInstance(array $payload): TaskQueueCumulativeStatisticsInstance { return new TaskQueueCumulativeStatisticsInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['taskQueueSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.TaskQueueCumulativeStatisticsPage]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueueRealTimeStatisticsContext.php000064400000004516150515725670025523 0ustar00solution = ['workspaceSid' => $workspaceSid, 'taskQueueSid' => $taskQueueSid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/TaskQueues/' . \rawurlencode($taskQueueSid) . '/RealTimeStatistics'; } /** * Fetch the TaskQueueRealTimeStatisticsInstance * * @param array|Options $options Optional Arguments * @return TaskQueueRealTimeStatisticsInstance Fetched * TaskQueueRealTimeStatisticsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): TaskQueueRealTimeStatisticsInstance { $options = new Values($options); $params = Values::of(['TaskChannel' => $options['taskChannel'], ]); $payload = $this->version->fetch('GET', $this->uri, $params); return new TaskQueueRealTimeStatisticsInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['taskQueueSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.TaskQueueRealTimeStatisticsContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueue/TaskQueueCumulativeStatisticsList.php000064400000002777150515725670025435 0ustar00solution = ['workspaceSid' => $workspaceSid, 'taskQueueSid' => $taskQueueSid, ]; } /** * Constructs a TaskQueueCumulativeStatisticsContext */ public function getContext(): TaskQueueCumulativeStatisticsContext { return new TaskQueueCumulativeStatisticsContext( $this->version, $this->solution['workspaceSid'], $this->solution['taskQueueSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.TaskQueueCumulativeStatisticsList]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/WorkspaceRealTimeStatisticsInstance.php000064400000010101150515725670023746 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'activityStatistics' => Values::array_get($payload, 'activity_statistics'), 'longestTaskWaitingAge' => Values::array_get($payload, 'longest_task_waiting_age'), 'longestTaskWaitingSid' => Values::array_get($payload, 'longest_task_waiting_sid'), 'tasksByPriority' => Values::array_get($payload, 'tasks_by_priority'), 'tasksByStatus' => Values::array_get($payload, 'tasks_by_status'), 'totalTasks' => Values::array_get($payload, 'total_tasks'), 'totalWorkers' => Values::array_get($payload, 'total_workers'), 'workspaceSid' => Values::array_get($payload, 'workspace_sid'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['workspaceSid' => $workspaceSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return WorkspaceRealTimeStatisticsContext Context for this * WorkspaceRealTimeStatisticsInstance */ protected function proxy(): WorkspaceRealTimeStatisticsContext { if (!$this->context) { $this->context = new WorkspaceRealTimeStatisticsContext( $this->version, $this->solution['workspaceSid'] ); } return $this->context; } /** * Fetch the WorkspaceRealTimeStatisticsInstance * * @param array|Options $options Optional Arguments * @return WorkspaceRealTimeStatisticsInstance Fetched * WorkspaceRealTimeStatisticsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): WorkspaceRealTimeStatisticsInstance { return $this->proxy()->fetch($options); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.WorkspaceRealTimeStatisticsInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/WorkspaceStatisticsOptions.php000064400000013073150515725670022225 0ustar00options['minutes'] = $minutes; $this->options['startDate'] = $startDate; $this->options['endDate'] = $endDate; $this->options['taskChannel'] = $taskChannel; $this->options['splitByWaitTime'] = $splitByWaitTime; } /** * Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. * * @param int $minutes Only calculate statistics since this many minutes in the * past * @return $this Fluent Builder */ public function setMinutes(int $minutes): self { $this->options['minutes'] = $minutes; return $this; } /** * Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. * * @param \DateTime $startDate Only calculate statistics from on or after this * date * @return $this Fluent Builder */ public function setStartDate(\DateTime $startDate): self { $this->options['startDate'] = $startDate; return $this; } /** * Only calculate statistics from this date and time and earlier, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. * * @param \DateTime $endDate Only calculate statistics from this date and time * and earlier * @return $this Fluent Builder */ public function setEndDate(\DateTime $endDate): self { $this->options['endDate'] = $endDate; return $this; } /** * Only calculate statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. * * @param string $taskChannel Only calculate statistics on this TaskChannel. * @return $this Fluent Builder */ public function setTaskChannel(string $taskChannel): self { $this->options['taskChannel'] = $taskChannel; return $this; } /** * A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. For example, `5,30` would show splits of Tasks that were canceled or accepted before and after 5 seconds and before and after 30 seconds. This can be used to show short abandoned Tasks or Tasks that failed to meet an SLA. * * @param string $splitByWaitTime A comma separated list of values that * describes the thresholds to calculate * statistics on * @return $this Fluent Builder */ public function setSplitByWaitTime(string $splitByWaitTime): self { $this->options['splitByWaitTime'] = $splitByWaitTime; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.FetchWorkspaceStatisticsOptions ' . $options . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/ActivityList.php000064400000014062150515725670017267 0ustar00solution = ['workspaceSid' => $workspaceSid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/Activities'; } /** * Streams ActivityInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ActivityInstance 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 ActivityInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of ActivityInstance 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 ActivityPage Page of ActivityInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ActivityPage { $options = new Values($options); $params = Values::of([ 'FriendlyName' => $options['friendlyName'], 'Available' => $options['available'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ActivityPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ActivityInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ActivityPage Page of ActivityInstance */ public function getPage(string $targetUrl): ActivityPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ActivityPage($this->version, $response, $this->solution); } /** * Create the ActivityInstance * * @param string $friendlyName A string to describe the Activity resource * @param array|Options $options Optional Arguments * @return ActivityInstance Created ActivityInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, array $options = []): ActivityInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $friendlyName, 'Available' => Serialize::booleanToString($options['available']), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ActivityInstance($this->version, $payload, $this->solution['workspaceSid']); } /** * Constructs a ActivityContext * * @param string $sid The SID of the resource to fetch */ public function getContext(string $sid): ActivityContext { return new ActivityContext($this->version, $this->solution['workspaceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.ActivityList]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/WorkerOptions.php000064400000034770150515725670017474 0ustar00options['activityName'] = $activityName; $this->options['activitySid'] = $activitySid; $this->options['available'] = $available; $this->options['friendlyName'] = $friendlyName; $this->options['targetWorkersExpression'] = $targetWorkersExpression; $this->options['taskQueueName'] = $taskQueueName; $this->options['taskQueueSid'] = $taskQueueSid; } /** * The `activity_name` of the Worker resources to read. * * @param string $activityName The activity_name of the Worker resources to read * @return $this Fluent Builder */ public function setActivityName(string $activityName): self { $this->options['activityName'] = $activityName; return $this; } /** * The `activity_sid` of the Worker resources to read. * * @param string $activitySid The activity_sid of the Worker resources to read * @return $this Fluent Builder */ public function setActivitySid(string $activitySid): self { $this->options['activitySid'] = $activitySid; return $this; } /** * Whether to return only Worker resources that are available or unavailable. Can be `true`, `1`, or `yes` to return Worker resources that are available, and `false`, or any value returns the Worker resources that are not available. * * @param string $available Whether to return Worker resources that are * available or unavailable * @return $this Fluent Builder */ public function setAvailable(string $available): self { $this->options['available'] = $available; return $this; } /** * The `friendly_name` of the Worker resources to read. * * @param string $friendlyName The friendly_name of the Worker resources to read * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Filter by Workers that would match an expression on a TaskQueue. This is helpful for debugging which Workers would match a potential queue. * * @param string $targetWorkersExpression Filter by Workers that would match an * expression on a TaskQueue * @return $this Fluent Builder */ public function setTargetWorkersExpression(string $targetWorkersExpression): self { $this->options['targetWorkersExpression'] = $targetWorkersExpression; return $this; } /** * The `friendly_name` of the TaskQueue that the Workers to read are eligible for. * * @param string $taskQueueName The friendly_name of the TaskQueue that the * Workers to read are eligible for * @return $this Fluent Builder */ public function setTaskQueueName(string $taskQueueName): self { $this->options['taskQueueName'] = $taskQueueName; return $this; } /** * The SID of the TaskQueue that the Workers to read are eligible for. * * @param string $taskQueueSid The SID of the TaskQueue that the Workers to * read are eligible for * @return $this Fluent Builder */ public function setTaskQueueSid(string $taskQueueSid): self { $this->options['taskQueueSid'] = $taskQueueSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.ReadWorkerOptions ' . $options . ']'; } } class CreateWorkerOptions extends Options { /** * @param string $activitySid The SID of a valid Activity that describes the * new Worker's initial state * @param string $attributes A valid JSON string that describes the new Worker */ public function __construct(string $activitySid = Values::NONE, string $attributes = Values::NONE) { $this->options['activitySid'] = $activitySid; $this->options['attributes'] = $attributes; } /** * The SID of a valid Activity that will describe the new Worker's initial state. See [Activities](https://www.twilio.com/docs/taskrouter/api/activity) for more information. If not provided, the new Worker's initial state is the `default_activity_sid` configured on the Workspace. * * @param string $activitySid The SID of a valid Activity that describes the * new Worker's initial state * @return $this Fluent Builder */ public function setActivitySid(string $activitySid): self { $this->options['activitySid'] = $activitySid; return $this; } /** * A valid JSON string that describes the new Worker. For example: `{ "email": "Bob@example.com", "phone": "+5095551234" }`. This data is passed to the `assignment_callback_url` when TaskRouter assigns a Task to the Worker. Defaults to {}. * * @param string $attributes A valid JSON string that describes the new Worker * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.CreateWorkerOptions ' . $options . ']'; } } class UpdateWorkerOptions extends Options { /** * @param string $activitySid The SID of the Activity that describes the * Worker's initial state * @param string $attributes The JSON string that describes the Worker * @param string $friendlyName A string to describe the Worker * @param bool $rejectPendingReservations Whether to reject the Worker's * pending reservations * @param string $ifMatch The If-Match HTTP request header */ public function __construct(string $activitySid = Values::NONE, string $attributes = Values::NONE, string $friendlyName = Values::NONE, bool $rejectPendingReservations = Values::NONE, string $ifMatch = Values::NONE) { $this->options['activitySid'] = $activitySid; $this->options['attributes'] = $attributes; $this->options['friendlyName'] = $friendlyName; $this->options['rejectPendingReservations'] = $rejectPendingReservations; $this->options['ifMatch'] = $ifMatch; } /** * The SID of a valid Activity that will describe the Worker's initial state. See [Activities](https://www.twilio.com/docs/taskrouter/api/activity) for more information. * * @param string $activitySid The SID of the Activity that describes the * Worker's initial state * @return $this Fluent Builder */ public function setActivitySid(string $activitySid): self { $this->options['activitySid'] = $activitySid; return $this; } /** * The JSON string that describes the Worker. For example: `{ "email": "Bob@example.com", "phone": "+5095551234" }`. This data is passed to the `assignment_callback_url` when TaskRouter assigns a Task to the Worker. Defaults to {}. * * @param string $attributes The JSON string that describes the Worker * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * A descriptive string that you create to describe the Worker. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the Worker * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Whether to reject the Worker's pending reservations. This option is only valid if the Worker's new [Activity](https://www.twilio.com/docs/taskrouter/api/activity) resource has its `availability` property set to `False`. * * @param bool $rejectPendingReservations Whether to reject the Worker's * pending reservations * @return $this Fluent Builder */ public function setRejectPendingReservations(bool $rejectPendingReservations): self { $this->options['rejectPendingReservations'] = $rejectPendingReservations; return $this; } /** * The If-Match HTTP request header * * @param string $ifMatch The If-Match HTTP request header * @return $this Fluent Builder */ public function setIfMatch(string $ifMatch): self { $this->options['ifMatch'] = $ifMatch; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.UpdateWorkerOptions ' . $options . ']'; } } class DeleteWorkerOptions extends Options { /** * @param string $ifMatch The If-Match HTTP request header */ public function __construct(string $ifMatch = Values::NONE) { $this->options['ifMatch'] = $ifMatch; } /** * The If-Match HTTP request header * * @param string $ifMatch The If-Match HTTP request header * @return $this Fluent Builder */ public function setIfMatch(string $ifMatch): self { $this->options['ifMatch'] = $ifMatch; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.DeleteWorkerOptions ' . $options . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/WorkerList.php000064400000017660150515725670016753 0ustar00solution = ['workspaceSid' => $workspaceSid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/Workers'; } /** * Streams WorkerInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads WorkerInstance 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 WorkerInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of WorkerInstance 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 WorkerPage Page of WorkerInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): WorkerPage { $options = new Values($options); $params = Values::of([ 'ActivityName' => $options['activityName'], 'ActivitySid' => $options['activitySid'], 'Available' => $options['available'], 'FriendlyName' => $options['friendlyName'], 'TargetWorkersExpression' => $options['targetWorkersExpression'], 'TaskQueueName' => $options['taskQueueName'], 'TaskQueueSid' => $options['taskQueueSid'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new WorkerPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of WorkerInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return WorkerPage Page of WorkerInstance */ public function getPage(string $targetUrl): WorkerPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new WorkerPage($this->version, $response, $this->solution); } /** * Create the WorkerInstance * * @param string $friendlyName A string to describe the resource * @param array|Options $options Optional Arguments * @return WorkerInstance Created WorkerInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, array $options = []): WorkerInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $friendlyName, 'ActivitySid' => $options['activitySid'], 'Attributes' => $options['attributes'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new WorkerInstance($this->version, $payload, $this->solution['workspaceSid']); } /** * Access the statistics */ protected function getStatistics(): WorkersStatisticsList { if (!$this->_statistics) { $this->_statistics = new WorkersStatisticsList($this->version, $this->solution['workspaceSid']); } return $this->_statistics; } /** * Constructs a WorkerContext * * @param string $sid The SID of the resource to fetch */ public function getContext(string $sid): WorkerContext { return new WorkerContext($this->version, $this->solution['workspaceSid'], $sid); } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return \Twilio\ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Taskrouter.V1.WorkerList]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/ReservationContext.php000064400000014711150515725670021757 0ustar00solution = ['workspaceSid' => $workspaceSid, 'workerSid' => $workerSid, 'sid' => $sid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/Workers/' . \rawurlencode($workerSid) . '/Reservations/' . \rawurlencode($sid) . ''; } /** * Fetch the ReservationInstance * * @return ReservationInstance Fetched ReservationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ReservationInstance { $payload = $this->version->fetch('GET', $this->uri); return new ReservationInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['workerSid'], $this->solution['sid'] ); } /** * Update the ReservationInstance * * @param array|Options $options Optional Arguments * @return ReservationInstance Updated ReservationInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ReservationInstance { $options = new Values($options); $data = Values::of([ 'ReservationStatus' => $options['reservationStatus'], 'WorkerActivitySid' => $options['workerActivitySid'], 'Instruction' => $options['instruction'], 'DequeuePostWorkActivitySid' => $options['dequeuePostWorkActivitySid'], 'DequeueFrom' => $options['dequeueFrom'], 'DequeueRecord' => $options['dequeueRecord'], 'DequeueTimeout' => $options['dequeueTimeout'], 'DequeueTo' => $options['dequeueTo'], 'DequeueStatusCallbackUrl' => $options['dequeueStatusCallbackUrl'], 'CallFrom' => $options['callFrom'], 'CallRecord' => $options['callRecord'], 'CallTimeout' => $options['callTimeout'], 'CallTo' => $options['callTo'], 'CallUrl' => $options['callUrl'], 'CallStatusCallbackUrl' => $options['callStatusCallbackUrl'], 'CallAccept' => Serialize::booleanToString($options['callAccept']), 'RedirectCallSid' => $options['redirectCallSid'], 'RedirectAccept' => Serialize::booleanToString($options['redirectAccept']), 'RedirectUrl' => $options['redirectUrl'], 'To' => $options['to'], 'From' => $options['from'], 'StatusCallback' => $options['statusCallback'], 'StatusCallbackMethod' => $options['statusCallbackMethod'], 'StatusCallbackEvent' => Serialize::map($options['statusCallbackEvent'], function($e) { return $e; }), 'Timeout' => $options['timeout'], 'Record' => Serialize::booleanToString($options['record']), 'Muted' => Serialize::booleanToString($options['muted']), 'Beep' => $options['beep'], 'StartConferenceOnEnter' => Serialize::booleanToString($options['startConferenceOnEnter']), 'EndConferenceOnExit' => Serialize::booleanToString($options['endConferenceOnExit']), 'WaitUrl' => $options['waitUrl'], 'WaitMethod' => $options['waitMethod'], 'EarlyMedia' => Serialize::booleanToString($options['earlyMedia']), 'MaxParticipants' => $options['maxParticipants'], 'ConferenceStatusCallback' => $options['conferenceStatusCallback'], 'ConferenceStatusCallbackMethod' => $options['conferenceStatusCallbackMethod'], 'ConferenceStatusCallbackEvent' => Serialize::map($options['conferenceStatusCallbackEvent'], function($e) { return $e; }), 'ConferenceRecord' => $options['conferenceRecord'], 'ConferenceTrim' => $options['conferenceTrim'], 'RecordingChannels' => $options['recordingChannels'], 'RecordingStatusCallback' => $options['recordingStatusCallback'], 'RecordingStatusCallbackMethod' => $options['recordingStatusCallbackMethod'], 'ConferenceRecordingStatusCallback' => $options['conferenceRecordingStatusCallback'], 'ConferenceRecordingStatusCallbackMethod' => $options['conferenceRecordingStatusCallbackMethod'], 'Region' => $options['region'], 'SipAuthUsername' => $options['sipAuthUsername'], 'SipAuthPassword' => $options['sipAuthPassword'], 'DequeueStatusCallbackEvent' => Serialize::map($options['dequeueStatusCallbackEvent'], function($e) { return $e; }), 'PostWorkActivitySid' => $options['postWorkActivitySid'], 'EndConferenceOnCustomerExit' => Serialize::booleanToString($options['endConferenceOnCustomerExit']), 'BeepOnCustomerEntrance' => Serialize::booleanToString($options['beepOnCustomerEntrance']), ]); $headers = Values::of(['If-Match' => $options['ifMatch'], ]); $payload = $this->version->update('POST', $this->uri, [], $data, $headers); return new ReservationInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['workerSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.ReservationContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkersStatisticsPage.php000064400000002404150515725670022411 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return WorkersStatisticsInstance \Twilio\Rest\Taskrouter\V1\Workspace\Worker\WorkersStatisticsInstance */ public function buildInstance(array $payload): WorkersStatisticsInstance { return new WorkersStatisticsInstance($this->version, $payload, $this->solution['workspaceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.WorkersStatisticsPage]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkersRealTimeStatisticsOptions.php000064400000003431150515725670024614 0ustar00options['taskChannel'] = $taskChannel; } /** * Only calculate real-time statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. * * @param string $taskChannel Only calculate real-time statistics on this * TaskChannel * @return $this Fluent Builder */ public function setTaskChannel(string $taskChannel): self { $this->options['taskChannel'] = $taskChannel; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.FetchWorkersRealTimeStatisticsOptions ' . $options . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkerStatisticsContext.php000064400000004624150515725670023004 0ustar00solution = ['workspaceSid' => $workspaceSid, 'workerSid' => $workerSid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/Workers/' . \rawurlencode($workerSid) . '/Statistics'; } /** * Fetch the WorkerStatisticsInstance * * @param array|Options $options Optional Arguments * @return WorkerStatisticsInstance Fetched WorkerStatisticsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): WorkerStatisticsInstance { $options = new Values($options); $params = Values::of([ 'Minutes' => $options['minutes'], 'StartDate' => Serialize::iso8601DateTime($options['startDate']), 'EndDate' => Serialize::iso8601DateTime($options['endDate']), 'TaskChannel' => $options['taskChannel'], ]); $payload = $this->version->fetch('GET', $this->uri, $params); return new WorkerStatisticsInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['workerSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.WorkerStatisticsContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkersStatisticsInstance.php000064400000006332150515725670023305 0ustar00properties = [ 'realtime' => Values::array_get($payload, 'realtime'), 'cumulative' => Values::array_get($payload, 'cumulative'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'workspaceSid' => Values::array_get($payload, 'workspace_sid'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['workspaceSid' => $workspaceSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return WorkersStatisticsContext Context for this WorkersStatisticsInstance */ protected function proxy(): WorkersStatisticsContext { if (!$this->context) { $this->context = new WorkersStatisticsContext($this->version, $this->solution['workspaceSid']); } return $this->context; } /** * Fetch the WorkersStatisticsInstance * * @param array|Options $options Optional Arguments * @return WorkersStatisticsInstance Fetched WorkersStatisticsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): WorkersStatisticsInstance { return $this->proxy()->fetch($options); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.WorkersStatisticsInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkerChannelList.php000064400000012235150515725670021506 0ustar00solution = ['workspaceSid' => $workspaceSid, 'workerSid' => $workerSid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/Workers/' . \rawurlencode($workerSid) . '/Channels'; } /** * Streams WorkerChannelInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads WorkerChannelInstance 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 WorkerChannelInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of WorkerChannelInstance 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 WorkerChannelPage Page of WorkerChannelInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): WorkerChannelPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new WorkerChannelPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of WorkerChannelInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return WorkerChannelPage Page of WorkerChannelInstance */ public function getPage(string $targetUrl): WorkerChannelPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new WorkerChannelPage($this->version, $response, $this->solution); } /** * Constructs a WorkerChannelContext * * @param string $sid The SID of the to fetch */ public function getContext(string $sid): WorkerChannelContext { return new WorkerChannelContext( $this->version, $this->solution['workspaceSid'], $this->solution['workerSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.WorkerChannelList]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkersStatisticsList.php000064400000002175150515725670022455 0ustar00solution = ['workspaceSid' => $workspaceSid, ]; } /** * Constructs a WorkersStatisticsContext */ public function getContext(): WorkersStatisticsContext { return new WorkersStatisticsContext($this->version, $this->solution['workspaceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.WorkersStatisticsList]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkersRealTimeStatisticsList.php000064400000002321150515725670024071 0ustar00solution = ['workspaceSid' => $workspaceSid, ]; } /** * Constructs a WorkersRealTimeStatisticsContext */ public function getContext(): WorkersRealTimeStatisticsContext { return new WorkersRealTimeStatisticsContext($this->version, $this->solution['workspaceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.WorkersRealTimeStatisticsList]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/ReservationInstance.php000064400000011103150515725670022067 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'reservationStatus' => Values::array_get($payload, 'reservation_status'), 'sid' => Values::array_get($payload, 'sid'), 'taskSid' => Values::array_get($payload, 'task_sid'), 'workerName' => Values::array_get($payload, 'worker_name'), 'workerSid' => Values::array_get($payload, 'worker_sid'), 'workspaceSid' => Values::array_get($payload, 'workspace_sid'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = [ 'workspaceSid' => $workspaceSid, 'workerSid' => $workerSid, '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 ReservationContext Context for this ReservationInstance */ protected function proxy(): ReservationContext { if (!$this->context) { $this->context = new ReservationContext( $this->version, $this->solution['workspaceSid'], $this->solution['workerSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the ReservationInstance * * @return ReservationInstance Fetched ReservationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ReservationInstance { return $this->proxy()->fetch(); } /** * Update the ReservationInstance * * @param array|Options $options Optional Arguments * @return ReservationInstance Updated ReservationInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ReservationInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.ReservationInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkersStatisticsContext.php000064400000004405150515725670023164 0ustar00solution = ['workspaceSid' => $workspaceSid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/Workers/Statistics'; } /** * Fetch the WorkersStatisticsInstance * * @param array|Options $options Optional Arguments * @return WorkersStatisticsInstance Fetched WorkersStatisticsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): WorkersStatisticsInstance { $options = new Values($options); $params = Values::of([ 'Minutes' => $options['minutes'], 'StartDate' => Serialize::iso8601DateTime($options['startDate']), 'EndDate' => Serialize::iso8601DateTime($options['endDate']), 'TaskQueueSid' => $options['taskQueueSid'], 'TaskQueueName' => $options['taskQueueName'], 'FriendlyName' => $options['friendlyName'], 'TaskChannel' => $options['taskChannel'], ]); $payload = $this->version->fetch('GET', $this->uri, $params); return new WorkersStatisticsInstance($this->version, $payload, $this->solution['workspaceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.WorkersStatisticsContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkersCumulativeStatisticsInstance.php000064400000010732150515725670025343 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'startTime' => Deserialize::dateTime(Values::array_get($payload, 'start_time')), 'endTime' => Deserialize::dateTime(Values::array_get($payload, 'end_time')), 'activityDurations' => Values::array_get($payload, 'activity_durations'), 'reservationsCreated' => Values::array_get($payload, 'reservations_created'), 'reservationsAccepted' => Values::array_get($payload, 'reservations_accepted'), 'reservationsRejected' => Values::array_get($payload, 'reservations_rejected'), 'reservationsTimedOut' => Values::array_get($payload, 'reservations_timed_out'), 'reservationsCanceled' => Values::array_get($payload, 'reservations_canceled'), 'reservationsRescinded' => Values::array_get($payload, 'reservations_rescinded'), 'workspaceSid' => Values::array_get($payload, 'workspace_sid'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['workspaceSid' => $workspaceSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return WorkersCumulativeStatisticsContext Context for this * WorkersCumulativeStatisticsInstance */ protected function proxy(): WorkersCumulativeStatisticsContext { if (!$this->context) { $this->context = new WorkersCumulativeStatisticsContext( $this->version, $this->solution['workspaceSid'] ); } return $this->context; } /** * Fetch the WorkersCumulativeStatisticsInstance * * @param array|Options $options Optional Arguments * @return WorkersCumulativeStatisticsInstance Fetched * WorkersCumulativeStatisticsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): WorkersCumulativeStatisticsInstance { return $this->proxy()->fetch($options); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.WorkersCumulativeStatisticsInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkersCumulativeStatisticsPage.php000064400000002556150515725670024460 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return WorkersCumulativeStatisticsInstance \Twilio\Rest\Taskrouter\V1\Workspace\Worker\WorkersCumulativeStatisticsInstance */ public function buildInstance(array $payload): WorkersCumulativeStatisticsInstance { return new WorkersCumulativeStatisticsInstance( $this->version, $payload, $this->solution['workspaceSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.WorkersCumulativeStatisticsPage]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkersRealTimeStatisticsInstance.php000064400000007013150515725670024725 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'activityStatistics' => Values::array_get($payload, 'activity_statistics'), 'totalWorkers' => Values::array_get($payload, 'total_workers'), 'workspaceSid' => Values::array_get($payload, 'workspace_sid'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['workspaceSid' => $workspaceSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return WorkersRealTimeStatisticsContext Context for this * WorkersRealTimeStatisticsInstance */ protected function proxy(): WorkersRealTimeStatisticsContext { if (!$this->context) { $this->context = new WorkersRealTimeStatisticsContext( $this->version, $this->solution['workspaceSid'] ); } return $this->context; } /** * Fetch the WorkersRealTimeStatisticsInstance * * @param array|Options $options Optional Arguments * @return WorkersRealTimeStatisticsInstance Fetched * WorkersRealTimeStatisticsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): WorkersRealTimeStatisticsInstance { return $this->proxy()->fetch($options); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.WorkersRealTimeStatisticsInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkerStatisticsInstance.php000064400000006776150515725670023136 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'cumulative' => Values::array_get($payload, 'cumulative'), 'workerSid' => Values::array_get($payload, 'worker_sid'), 'workspaceSid' => Values::array_get($payload, 'workspace_sid'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['workspaceSid' => $workspaceSid, 'workerSid' => $workerSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return WorkerStatisticsContext Context for this WorkerStatisticsInstance */ protected function proxy(): WorkerStatisticsContext { if (!$this->context) { $this->context = new WorkerStatisticsContext( $this->version, $this->solution['workspaceSid'], $this->solution['workerSid'] ); } return $this->context; } /** * Fetch the WorkerStatisticsInstance * * @param array|Options $options Optional Arguments * @return WorkerStatisticsInstance Fetched WorkerStatisticsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): WorkerStatisticsInstance { return $this->proxy()->fetch($options); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.WorkerStatisticsInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkerStatisticsOptions.php000064400000010117150515725670023005 0ustar00options['minutes'] = $minutes; $this->options['startDate'] = $startDate; $this->options['endDate'] = $endDate; $this->options['taskChannel'] = $taskChannel; } /** * Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. * * @param int $minutes Only calculate statistics since this many minutes in the * past * @return $this Fluent Builder */ public function setMinutes(int $minutes): self { $this->options['minutes'] = $minutes; return $this; } /** * Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. * * @param \DateTime $startDate Only calculate statistics from on or after this * date * @return $this Fluent Builder */ public function setStartDate(\DateTime $startDate): self { $this->options['startDate'] = $startDate; return $this; } /** * Only include usage that occurred on or before this date, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. * * @param \DateTime $endDate Only include usage that occurred on or before this * date * @return $this Fluent Builder */ public function setEndDate(\DateTime $endDate): self { $this->options['endDate'] = $endDate; return $this; } /** * Only calculate statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. * * @param string $taskChannel Only calculate statistics on this TaskChannel * @return $this Fluent Builder */ public function setTaskChannel(string $taskChannel): self { $this->options['taskChannel'] = $taskChannel; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.FetchWorkerStatisticsOptions ' . $options . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkerStatisticsList.php000064400000002621150515725670022266 0ustar00solution = ['workspaceSid' => $workspaceSid, 'workerSid' => $workerSid, ]; } /** * Constructs a WorkerStatisticsContext */ public function getContext(): WorkerStatisticsContext { return new WorkerStatisticsContext( $this->version, $this->solution['workspaceSid'], $this->solution['workerSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.WorkerStatisticsList]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkerStatisticsPage.php000064400000002526150515725670022233 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return WorkerStatisticsInstance \Twilio\Rest\Taskrouter\V1\Workspace\Worker\WorkerStatisticsInstance */ public function buildInstance(array $payload): WorkerStatisticsInstance { return new WorkerStatisticsInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['workerSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.WorkerStatisticsPage]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkersStatisticsOptions.php000064400000015171150515725670023175 0ustar00options['minutes'] = $minutes; $this->options['startDate'] = $startDate; $this->options['endDate'] = $endDate; $this->options['taskQueueSid'] = $taskQueueSid; $this->options['taskQueueName'] = $taskQueueName; $this->options['friendlyName'] = $friendlyName; $this->options['taskChannel'] = $taskChannel; } /** * Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. * * @param int $minutes Only calculate statistics since this many minutes in the * past * @return $this Fluent Builder */ public function setMinutes(int $minutes): self { $this->options['minutes'] = $minutes; return $this; } /** * Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. * * @param \DateTime $startDate Only calculate statistics from on or after this * date * @return $this Fluent Builder */ public function setStartDate(\DateTime $startDate): self { $this->options['startDate'] = $startDate; return $this; } /** * Only calculate statistics from this date and time and earlier, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. * * @param \DateTime $endDate Only calculate statistics from this date and time * and earlier * @return $this Fluent Builder */ public function setEndDate(\DateTime $endDate): self { $this->options['endDate'] = $endDate; return $this; } /** * The SID of the TaskQueue for which to fetch Worker statistics. * * @param string $taskQueueSid The SID of the TaskQueue for which to fetch * Worker statistics * @return $this Fluent Builder */ public function setTaskQueueSid(string $taskQueueSid): self { $this->options['taskQueueSid'] = $taskQueueSid; return $this; } /** * The `friendly_name` of the TaskQueue for which to fetch Worker statistics. * * @param string $taskQueueName The friendly_name of the TaskQueue for which to * fetch Worker statistics * @return $this Fluent Builder */ public function setTaskQueueName(string $taskQueueName): self { $this->options['taskQueueName'] = $taskQueueName; return $this; } /** * Only include Workers with `friendly_name` values that match this parameter. * * @param string $friendlyName Only include Workers with `friendly_name` values * that match this parameter * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Only calculate statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. * * @param string $taskChannel Only calculate statistics on this TaskChannel * @return $this Fluent Builder */ public function setTaskChannel(string $taskChannel): self { $this->options['taskChannel'] = $taskChannel; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.FetchWorkersStatisticsOptions ' . $options . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkerChannelPage.php000064400000002504150515725670021445 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return WorkerChannelInstance \Twilio\Rest\Taskrouter\V1\Workspace\Worker\WorkerChannelInstance */ public function buildInstance(array $payload): WorkerChannelInstance { return new WorkerChannelInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['workerSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.WorkerChannelPage]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkersCumulativeStatisticsOptions.php000064400000010426150515725670025232 0ustar00options['endDate'] = $endDate; $this->options['minutes'] = $minutes; $this->options['startDate'] = $startDate; $this->options['taskChannel'] = $taskChannel; } /** * Only calculate statistics from this date and time and earlier, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. * * @param \DateTime $endDate Only calculate statistics from on or before this * date * @return $this Fluent Builder */ public function setEndDate(\DateTime $endDate): self { $this->options['endDate'] = $endDate; return $this; } /** * Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. * * @param int $minutes Only calculate statistics since this many minutes in the * past * @return $this Fluent Builder */ public function setMinutes(int $minutes): self { $this->options['minutes'] = $minutes; return $this; } /** * Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. * * @param \DateTime $startDate Only calculate statistics from on or after this * date * @return $this Fluent Builder */ public function setStartDate(\DateTime $startDate): self { $this->options['startDate'] = $startDate; return $this; } /** * Only calculate cumulative statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. * * @param string $taskChannel Only calculate cumulative statistics on this * TaskChannel * @return $this Fluent Builder */ public function setTaskChannel(string $taskChannel): self { $this->options['taskChannel'] = $taskChannel; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.FetchWorkersCumulativeStatisticsOptions ' . $options . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkerChannelInstance.php000064400000011671150515725670022342 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'assignedTasks' => Values::array_get($payload, 'assigned_tasks'), 'available' => Values::array_get($payload, 'available'), 'availableCapacityPercentage' => Values::array_get($payload, 'available_capacity_percentage'), 'configuredCapacity' => Values::array_get($payload, 'configured_capacity'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'sid' => Values::array_get($payload, 'sid'), 'taskChannelSid' => Values::array_get($payload, 'task_channel_sid'), 'taskChannelUniqueName' => Values::array_get($payload, 'task_channel_unique_name'), 'workerSid' => Values::array_get($payload, 'worker_sid'), 'workspaceSid' => Values::array_get($payload, 'workspace_sid'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'workspaceSid' => $workspaceSid, 'workerSid' => $workerSid, '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 WorkerChannelContext Context for this WorkerChannelInstance */ protected function proxy(): WorkerChannelContext { if (!$this->context) { $this->context = new WorkerChannelContext( $this->version, $this->solution['workspaceSid'], $this->solution['workerSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the WorkerChannelInstance * * @return WorkerChannelInstance Fetched WorkerChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): WorkerChannelInstance { return $this->proxy()->fetch(); } /** * Update the WorkerChannelInstance * * @param array|Options $options Optional Arguments * @return WorkerChannelInstance Updated WorkerChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): WorkerChannelInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.WorkerChannelInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/ReservationOptions.php000064400000144115150515725670021770 0ustar00options['reservationStatus'] = $reservationStatus; } /** * Returns the list of reservations for a worker with a specified ReservationStatus. Can be: `pending`, `accepted`, `rejected`, `timeout`, `canceled`, or `rescinded`. * * @param string $reservationStatus Returns the list of reservations for a * worker with a specified ReservationStatus * @return $this Fluent Builder */ public function setReservationStatus(string $reservationStatus): self { $this->options['reservationStatus'] = $reservationStatus; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.ReadReservationOptions ' . $options . ']'; } } class UpdateReservationOptions extends Options { /** * @param string $reservationStatus The new status of the reservation * @param string $workerActivitySid The new worker activity SID if rejecting a * reservation * @param string $instruction The assignment instruction for the reservation * @param string $dequeuePostWorkActivitySid The SID of the Activity resource * to start after executing a Dequeue * instruction * @param string $dequeueFrom The caller ID of the call to the worker when * executing a Dequeue instruction * @param string $dequeueRecord Whether to record both legs of a call when * executing a Dequeue instruction * @param int $dequeueTimeout The timeout for call when executing a Dequeue * instruction * @param string $dequeueTo The contact URI of the worker when executing a * Dequeue instruction * @param string $dequeueStatusCallbackUrl The callback URL for completed call * event when executing a Dequeue * instruction * @param string $callFrom The Caller ID of the outbound call when executing a * Call instruction * @param string $callRecord Whether to record both legs of a call when * executing a Call instruction * @param int $callTimeout The timeout for a call when executing a Call * instruction * @param string $callTo The contact URI of the worker when executing a Call * instruction * @param string $callUrl TwiML URI executed on answering the worker's leg as a * result of the Call instruction * @param string $callStatusCallbackUrl The URL to call for the completed call * event when executing a Call instruction * @param bool $callAccept Whether to accept a reservation when executing a * Call instruction * @param string $redirectCallSid The Call SID of the call parked in the queue * when executing a Redirect instruction * @param bool $redirectAccept Whether the reservation should be accepted when * executing a Redirect instruction * @param string $redirectUrl TwiML URI to redirect the call to when executing * the Redirect instruction * @param string $to The Contact URI of the worker when executing a Conference * instruction * @param string $from The caller ID of the call to the worker when executing a * Conference instruction * @param string $statusCallback The URL we should call to send status * information to your application * @param string $statusCallbackMethod The HTTP method we should use to call * status_callback * @param string[] $statusCallbackEvent The call progress events that we will * send to status_callback * @param int $timeout The timeout for a call when executing a Conference * instruction * @param bool $record Whether to record the participant and their conferences * @param bool $muted Whether to mute the agent * @param string $beep Whether to play a notification beep when the participant * joins * @param bool $startConferenceOnEnter Whether the conference starts when the * participant joins the conference * @param bool $endConferenceOnExit Whether to end the conference when the * agent leaves * @param string $waitUrl URL that hosts pre-conference hold music * @param string $waitMethod The HTTP method we should use to call `wait_url` * @param bool $earlyMedia Whether agents can hear the state of the outbound * call * @param int $maxParticipants The maximum number of agent conference * participants * @param string $conferenceStatusCallback The callback URL for conference * events * @param string $conferenceStatusCallbackMethod HTTP method for requesting * `conference_status_callback` * URL * @param string[] $conferenceStatusCallbackEvent The conference status events * that we will send to * conference_status_callback * @param string $conferenceRecord Whether to record the conference the * participant is joining * @param string $conferenceTrim Whether to trim leading and trailing silence * from your recorded conference audio files * @param string $recordingChannels Specify `mono` or `dual` recording channels * @param string $recordingStatusCallback The URL that we should call using the * `recording_status_callback_method` * when the recording status changes * @param string $recordingStatusCallbackMethod The HTTP method we should use * when we call * `recording_status_callback` * @param string $conferenceRecordingStatusCallback The URL we should call * using the * `conference_recording_status_callback_method` when the conference recording is available * @param string $conferenceRecordingStatusCallbackMethod The HTTP method we * should use to call * `conference_recording_status_callback` * @param string $region The region where we should mix the conference audio * @param string $sipAuthUsername The SIP username used for authentication * @param string $sipAuthPassword The SIP password for authentication * @param string[] $dequeueStatusCallbackEvent The call progress events sent * via webhooks as a result of a * Dequeue instruction * @param string $postWorkActivitySid The new worker activity SID after * executing a Conference instruction * @param bool $endConferenceOnCustomerExit Whether to end the conference when * the customer leaves * @param bool $beepOnCustomerEntrance Whether to play a notification beep when * the customer joins * @param string $ifMatch The If-Match HTTP request header */ public function __construct(string $reservationStatus = Values::NONE, string $workerActivitySid = Values::NONE, string $instruction = Values::NONE, string $dequeuePostWorkActivitySid = Values::NONE, string $dequeueFrom = Values::NONE, string $dequeueRecord = Values::NONE, int $dequeueTimeout = Values::NONE, string $dequeueTo = Values::NONE, string $dequeueStatusCallbackUrl = Values::NONE, string $callFrom = Values::NONE, string $callRecord = Values::NONE, int $callTimeout = Values::NONE, string $callTo = Values::NONE, string $callUrl = Values::NONE, string $callStatusCallbackUrl = Values::NONE, bool $callAccept = Values::NONE, string $redirectCallSid = Values::NONE, bool $redirectAccept = Values::NONE, string $redirectUrl = Values::NONE, string $to = Values::NONE, string $from = Values::NONE, string $statusCallback = Values::NONE, string $statusCallbackMethod = Values::NONE, array $statusCallbackEvent = Values::ARRAY_NONE, int $timeout = Values::NONE, bool $record = Values::NONE, bool $muted = Values::NONE, string $beep = Values::NONE, bool $startConferenceOnEnter = Values::NONE, bool $endConferenceOnExit = Values::NONE, string $waitUrl = Values::NONE, string $waitMethod = Values::NONE, bool $earlyMedia = Values::NONE, int $maxParticipants = Values::NONE, string $conferenceStatusCallback = Values::NONE, string $conferenceStatusCallbackMethod = Values::NONE, array $conferenceStatusCallbackEvent = Values::ARRAY_NONE, string $conferenceRecord = Values::NONE, string $conferenceTrim = Values::NONE, string $recordingChannels = Values::NONE, string $recordingStatusCallback = Values::NONE, string $recordingStatusCallbackMethod = Values::NONE, string $conferenceRecordingStatusCallback = Values::NONE, string $conferenceRecordingStatusCallbackMethod = Values::NONE, string $region = Values::NONE, string $sipAuthUsername = Values::NONE, string $sipAuthPassword = Values::NONE, array $dequeueStatusCallbackEvent = Values::ARRAY_NONE, string $postWorkActivitySid = Values::NONE, bool $endConferenceOnCustomerExit = Values::NONE, bool $beepOnCustomerEntrance = Values::NONE, string $ifMatch = Values::NONE) { $this->options['reservationStatus'] = $reservationStatus; $this->options['workerActivitySid'] = $workerActivitySid; $this->options['instruction'] = $instruction; $this->options['dequeuePostWorkActivitySid'] = $dequeuePostWorkActivitySid; $this->options['dequeueFrom'] = $dequeueFrom; $this->options['dequeueRecord'] = $dequeueRecord; $this->options['dequeueTimeout'] = $dequeueTimeout; $this->options['dequeueTo'] = $dequeueTo; $this->options['dequeueStatusCallbackUrl'] = $dequeueStatusCallbackUrl; $this->options['callFrom'] = $callFrom; $this->options['callRecord'] = $callRecord; $this->options['callTimeout'] = $callTimeout; $this->options['callTo'] = $callTo; $this->options['callUrl'] = $callUrl; $this->options['callStatusCallbackUrl'] = $callStatusCallbackUrl; $this->options['callAccept'] = $callAccept; $this->options['redirectCallSid'] = $redirectCallSid; $this->options['redirectAccept'] = $redirectAccept; $this->options['redirectUrl'] = $redirectUrl; $this->options['to'] = $to; $this->options['from'] = $from; $this->options['statusCallback'] = $statusCallback; $this->options['statusCallbackMethod'] = $statusCallbackMethod; $this->options['statusCallbackEvent'] = $statusCallbackEvent; $this->options['timeout'] = $timeout; $this->options['record'] = $record; $this->options['muted'] = $muted; $this->options['beep'] = $beep; $this->options['startConferenceOnEnter'] = $startConferenceOnEnter; $this->options['endConferenceOnExit'] = $endConferenceOnExit; $this->options['waitUrl'] = $waitUrl; $this->options['waitMethod'] = $waitMethod; $this->options['earlyMedia'] = $earlyMedia; $this->options['maxParticipants'] = $maxParticipants; $this->options['conferenceStatusCallback'] = $conferenceStatusCallback; $this->options['conferenceStatusCallbackMethod'] = $conferenceStatusCallbackMethod; $this->options['conferenceStatusCallbackEvent'] = $conferenceStatusCallbackEvent; $this->options['conferenceRecord'] = $conferenceRecord; $this->options['conferenceTrim'] = $conferenceTrim; $this->options['recordingChannels'] = $recordingChannels; $this->options['recordingStatusCallback'] = $recordingStatusCallback; $this->options['recordingStatusCallbackMethod'] = $recordingStatusCallbackMethod; $this->options['conferenceRecordingStatusCallback'] = $conferenceRecordingStatusCallback; $this->options['conferenceRecordingStatusCallbackMethod'] = $conferenceRecordingStatusCallbackMethod; $this->options['region'] = $region; $this->options['sipAuthUsername'] = $sipAuthUsername; $this->options['sipAuthPassword'] = $sipAuthPassword; $this->options['dequeueStatusCallbackEvent'] = $dequeueStatusCallbackEvent; $this->options['postWorkActivitySid'] = $postWorkActivitySid; $this->options['endConferenceOnCustomerExit'] = $endConferenceOnCustomerExit; $this->options['beepOnCustomerEntrance'] = $beepOnCustomerEntrance; $this->options['ifMatch'] = $ifMatch; } /** * The new status of the reservation. Can be: `pending`, `accepted`, `rejected`, `timeout`, `canceled`, or `rescinded`. * * @param string $reservationStatus The new status of the reservation * @return $this Fluent Builder */ public function setReservationStatus(string $reservationStatus): self { $this->options['reservationStatus'] = $reservationStatus; return $this; } /** * The new worker activity SID if rejecting a reservation. * * @param string $workerActivitySid The new worker activity SID if rejecting a * reservation * @return $this Fluent Builder */ public function setWorkerActivitySid(string $workerActivitySid): self { $this->options['workerActivitySid'] = $workerActivitySid; return $this; } /** * The assignment instruction for the reservation. * * @param string $instruction The assignment instruction for the reservation * @return $this Fluent Builder */ public function setInstruction(string $instruction): self { $this->options['instruction'] = $instruction; return $this; } /** * The SID of the Activity resource to start after executing a Dequeue instruction. * * @param string $dequeuePostWorkActivitySid The SID of the Activity resource * to start after executing a Dequeue * instruction * @return $this Fluent Builder */ public function setDequeuePostWorkActivitySid(string $dequeuePostWorkActivitySid): self { $this->options['dequeuePostWorkActivitySid'] = $dequeuePostWorkActivitySid; return $this; } /** * The caller ID of the call to the worker when executing a Dequeue instruction. * * @param string $dequeueFrom The caller ID of the call to the worker when * executing a Dequeue instruction * @return $this Fluent Builder */ public function setDequeueFrom(string $dequeueFrom): self { $this->options['dequeueFrom'] = $dequeueFrom; return $this; } /** * Whether to record both legs of a call when executing a Dequeue instruction or which leg to record. * * @param string $dequeueRecord Whether to record both legs of a call when * executing a Dequeue instruction * @return $this Fluent Builder */ public function setDequeueRecord(string $dequeueRecord): self { $this->options['dequeueRecord'] = $dequeueRecord; return $this; } /** * The timeout for call when executing a Dequeue instruction. * * @param int $dequeueTimeout The timeout for call when executing a Dequeue * instruction * @return $this Fluent Builder */ public function setDequeueTimeout(int $dequeueTimeout): self { $this->options['dequeueTimeout'] = $dequeueTimeout; return $this; } /** * The contact URI of the worker when executing a Dequeue instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination. * * @param string $dequeueTo The contact URI of the worker when executing a * Dequeue instruction * @return $this Fluent Builder */ public function setDequeueTo(string $dequeueTo): self { $this->options['dequeueTo'] = $dequeueTo; return $this; } /** * The callback URL for completed call event when executing a Dequeue instruction. * * @param string $dequeueStatusCallbackUrl The callback URL for completed call * event when executing a Dequeue * instruction * @return $this Fluent Builder */ public function setDequeueStatusCallbackUrl(string $dequeueStatusCallbackUrl): self { $this->options['dequeueStatusCallbackUrl'] = $dequeueStatusCallbackUrl; return $this; } /** * The Caller ID of the outbound call when executing a Call instruction. * * @param string $callFrom The Caller ID of the outbound call when executing a * Call instruction * @return $this Fluent Builder */ public function setCallFrom(string $callFrom): self { $this->options['callFrom'] = $callFrom; return $this; } /** * Whether to record both legs of a call when executing a Call instruction. * * @param string $callRecord Whether to record both legs of a call when * executing a Call instruction * @return $this Fluent Builder */ public function setCallRecord(string $callRecord): self { $this->options['callRecord'] = $callRecord; return $this; } /** * The timeout for a call when executing a Call instruction. * * @param int $callTimeout The timeout for a call when executing a Call * instruction * @return $this Fluent Builder */ public function setCallTimeout(int $callTimeout): self { $this->options['callTimeout'] = $callTimeout; return $this; } /** * The contact URI of the worker when executing a Call instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination. * * @param string $callTo The contact URI of the worker when executing a Call * instruction * @return $this Fluent Builder */ public function setCallTo(string $callTo): self { $this->options['callTo'] = $callTo; return $this; } /** * TwiML URI executed on answering the worker's leg as a result of the Call instruction. * * @param string $callUrl TwiML URI executed on answering the worker's leg as a * result of the Call instruction * @return $this Fluent Builder */ public function setCallUrl(string $callUrl): self { $this->options['callUrl'] = $callUrl; return $this; } /** * The URL to call for the completed call event when executing a Call instruction. * * @param string $callStatusCallbackUrl The URL to call for the completed call * event when executing a Call instruction * @return $this Fluent Builder */ public function setCallStatusCallbackUrl(string $callStatusCallbackUrl): self { $this->options['callStatusCallbackUrl'] = $callStatusCallbackUrl; return $this; } /** * Whether to accept a reservation when executing a Call instruction. * * @param bool $callAccept Whether to accept a reservation when executing a * Call instruction * @return $this Fluent Builder */ public function setCallAccept(bool $callAccept): self { $this->options['callAccept'] = $callAccept; return $this; } /** * The Call SID of the call parked in the queue when executing a Redirect instruction. * * @param string $redirectCallSid The Call SID of the call parked in the queue * when executing a Redirect instruction * @return $this Fluent Builder */ public function setRedirectCallSid(string $redirectCallSid): self { $this->options['redirectCallSid'] = $redirectCallSid; return $this; } /** * Whether the reservation should be accepted when executing a Redirect instruction. * * @param bool $redirectAccept Whether the reservation should be accepted when * executing a Redirect instruction * @return $this Fluent Builder */ public function setRedirectAccept(bool $redirectAccept): self { $this->options['redirectAccept'] = $redirectAccept; return $this; } /** * TwiML URI to redirect the call to when executing the Redirect instruction. * * @param string $redirectUrl TwiML URI to redirect the call to when executing * the Redirect instruction * @return $this Fluent Builder */ public function setRedirectUrl(string $redirectUrl): self { $this->options['redirectUrl'] = $redirectUrl; return $this; } /** * The Contact URI of the worker when executing a Conference instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination. * * @param string $to The Contact URI of the worker when executing a Conference * instruction * @return $this Fluent Builder */ public function setTo(string $to): self { $this->options['to'] = $to; return $this; } /** * The caller ID of the call to the worker when executing a Conference instruction. * * @param string $from The caller ID of the call to the worker when executing a * Conference instruction * @return $this Fluent Builder */ public function setFrom(string $from): self { $this->options['from'] = $from; return $this; } /** * The URL we should call using the `status_callback_method` to send status information to your application. * * @param string $statusCallback The URL we should call to send status * information to your application * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * The HTTP method we should use to call `status_callback`. Can be: `POST` or `GET` and the default is `POST`. * * @param string $statusCallbackMethod The HTTP method we should use to call * status_callback * @return $this Fluent Builder */ public function setStatusCallbackMethod(string $statusCallbackMethod): self { $this->options['statusCallbackMethod'] = $statusCallbackMethod; return $this; } /** * The call progress events that we will send to `status_callback`. Can be: `initiated`, `ringing`, `answered`, or `completed`. * * @param string[] $statusCallbackEvent The call progress events that we will * send to status_callback * @return $this Fluent Builder */ public function setStatusCallbackEvent(array $statusCallbackEvent): self { $this->options['statusCallbackEvent'] = $statusCallbackEvent; return $this; } /** * The timeout for a call when executing a Conference instruction. * * @param int $timeout The timeout for a call when executing a Conference * instruction * @return $this Fluent Builder */ public function setTimeout(int $timeout): self { $this->options['timeout'] = $timeout; return $this; } /** * Whether to record the participant and their conferences, including the time between conferences. Can be `true` or `false` and the default is `false`. * * @param bool $record Whether to record the participant and their conferences * @return $this Fluent Builder */ public function setRecord(bool $record): self { $this->options['record'] = $record; return $this; } /** * Whether the agent is muted in the conference. Defaults to `false`. * * @param bool $muted Whether to mute the agent * @return $this Fluent Builder */ public function setMuted(bool $muted): self { $this->options['muted'] = $muted; return $this; } /** * Whether to play a notification beep when the participant joins or when to play a beep. Can be: `true`, `false`, `onEnter`, or `onExit`. The default value is `true`. * * @param string $beep Whether to play a notification beep when the participant * joins * @return $this Fluent Builder */ public function setBeep(string $beep): self { $this->options['beep'] = $beep; return $this; } /** * Whether to start the conference when the participant joins, if it has not already started. Can be: `true` or `false` and the default is `true`. If `false` and the conference has not started, the participant is muted and hears background music until another participant starts the conference. * * @param bool $startConferenceOnEnter Whether the conference starts when the * participant joins the conference * @return $this Fluent Builder */ public function setStartConferenceOnEnter(bool $startConferenceOnEnter): self { $this->options['startConferenceOnEnter'] = $startConferenceOnEnter; return $this; } /** * Whether to end the conference when the agent leaves. * * @param bool $endConferenceOnExit Whether to end the conference when the * agent leaves * @return $this Fluent Builder */ public function setEndConferenceOnExit(bool $endConferenceOnExit): self { $this->options['endConferenceOnExit'] = $endConferenceOnExit; return $this; } /** * The URL we should call using the `wait_method` for the music to play while participants are waiting for the conference to start. The default value is the URL of our standard hold music. [Learn more about hold music](https://www.twilio.com/labs/twimlets/holdmusic). * * @param string $waitUrl URL that hosts pre-conference hold music * @return $this Fluent Builder */ public function setWaitUrl(string $waitUrl): self { $this->options['waitUrl'] = $waitUrl; return $this; } /** * The HTTP method we should use to call `wait_url`. Can be `GET` or `POST` and the default is `POST`. When using a static audio file, this should be `GET` so that we can cache the file. * * @param string $waitMethod The HTTP method we should use to call `wait_url` * @return $this Fluent Builder */ public function setWaitMethod(string $waitMethod): self { $this->options['waitMethod'] = $waitMethod; return $this; } /** * Whether to allow an agent to hear the state of the outbound call, including ringing or disconnect messages. The default is `true`. * * @param bool $earlyMedia Whether agents can hear the state of the outbound * call * @return $this Fluent Builder */ public function setEarlyMedia(bool $earlyMedia): self { $this->options['earlyMedia'] = $earlyMedia; return $this; } /** * The maximum number of participants allowed in the conference. Can be a positive integer from `2` to `250`. The default value is `250`. * * @param int $maxParticipants The maximum number of agent conference * participants * @return $this Fluent Builder */ public function setMaxParticipants(int $maxParticipants): self { $this->options['maxParticipants'] = $maxParticipants; return $this; } /** * The URL we should call using the `conference_status_callback_method` when the conference events in `conference_status_callback_event` occur. Only the value set by the first participant to join the conference is used. Subsequent `conference_status_callback` values are ignored. * * @param string $conferenceStatusCallback The callback URL for conference * events * @return $this Fluent Builder */ public function setConferenceStatusCallback(string $conferenceStatusCallback): self { $this->options['conferenceStatusCallback'] = $conferenceStatusCallback; return $this; } /** * The HTTP method we should use to call `conference_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $conferenceStatusCallbackMethod HTTP method for requesting * `conference_status_callback` * URL * @return $this Fluent Builder */ public function setConferenceStatusCallbackMethod(string $conferenceStatusCallbackMethod): self { $this->options['conferenceStatusCallbackMethod'] = $conferenceStatusCallbackMethod; return $this; } /** * The conference status events that we will send to `conference_status_callback`. Can be: `start`, `end`, `join`, `leave`, `mute`, `hold`, `speaker`. * * @param string[] $conferenceStatusCallbackEvent The conference status events * that we will send to * conference_status_callback * @return $this Fluent Builder */ public function setConferenceStatusCallbackEvent(array $conferenceStatusCallbackEvent): self { $this->options['conferenceStatusCallbackEvent'] = $conferenceStatusCallbackEvent; return $this; } /** * Whether to record the conference the participant is joining or when to record the conference. Can be: `true`, `false`, `record-from-start`, and `do-not-record`. The default value is `false`. * * @param string $conferenceRecord Whether to record the conference the * participant is joining * @return $this Fluent Builder */ public function setConferenceRecord(string $conferenceRecord): self { $this->options['conferenceRecord'] = $conferenceRecord; return $this; } /** * Whether to trim leading and trailing silence from your recorded conference audio files. Can be: `trim-silence` or `do-not-trim` and defaults to `trim-silence`. * * @param string $conferenceTrim Whether to trim leading and trailing silence * from your recorded conference audio files * @return $this Fluent Builder */ public function setConferenceTrim(string $conferenceTrim): self { $this->options['conferenceTrim'] = $conferenceTrim; return $this; } /** * The recording channels for the final recording. Can be: `mono` or `dual` and the default is `mono`. * * @param string $recordingChannels Specify `mono` or `dual` recording channels * @return $this Fluent Builder */ public function setRecordingChannels(string $recordingChannels): self { $this->options['recordingChannels'] = $recordingChannels; return $this; } /** * The URL that we should call using the `recording_status_callback_method` when the recording status changes. * * @param string $recordingStatusCallback The URL that we should call using the * `recording_status_callback_method` * when the recording status changes * @return $this Fluent Builder */ public function setRecordingStatusCallback(string $recordingStatusCallback): self { $this->options['recordingStatusCallback'] = $recordingStatusCallback; return $this; } /** * The HTTP method we should use when we call `recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $recordingStatusCallbackMethod The HTTP method we should use * when we call * `recording_status_callback` * @return $this Fluent Builder */ public function setRecordingStatusCallbackMethod(string $recordingStatusCallbackMethod): self { $this->options['recordingStatusCallbackMethod'] = $recordingStatusCallbackMethod; return $this; } /** * The URL we should call using the `conference_recording_status_callback_method` when the conference recording is available. * * @param string $conferenceRecordingStatusCallback The URL we should call * using the * `conference_recording_status_callback_method` when the conference recording is available * @return $this Fluent Builder */ public function setConferenceRecordingStatusCallback(string $conferenceRecordingStatusCallback): self { $this->options['conferenceRecordingStatusCallback'] = $conferenceRecordingStatusCallback; return $this; } /** * The HTTP method we should use to call `conference_recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. * * @param string $conferenceRecordingStatusCallbackMethod The HTTP method we * should use to call * `conference_recording_status_callback` * @return $this Fluent Builder */ public function setConferenceRecordingStatusCallbackMethod(string $conferenceRecordingStatusCallbackMethod): self { $this->options['conferenceRecordingStatusCallbackMethod'] = $conferenceRecordingStatusCallbackMethod; return $this; } /** * The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. * * @param string $region The region where we should mix the conference audio * @return $this Fluent Builder */ public function setRegion(string $region): self { $this->options['region'] = $region; return $this; } /** * The SIP username used for authentication. * * @param string $sipAuthUsername The SIP username used for authentication * @return $this Fluent Builder */ public function setSipAuthUsername(string $sipAuthUsername): self { $this->options['sipAuthUsername'] = $sipAuthUsername; return $this; } /** * The SIP password for authentication. * * @param string $sipAuthPassword The SIP password for authentication * @return $this Fluent Builder */ public function setSipAuthPassword(string $sipAuthPassword): self { $this->options['sipAuthPassword'] = $sipAuthPassword; return $this; } /** * The call progress events sent via webhooks as a result of a Dequeue instruction. * * @param string[] $dequeueStatusCallbackEvent The call progress events sent * via webhooks as a result of a * Dequeue instruction * @return $this Fluent Builder */ public function setDequeueStatusCallbackEvent(array $dequeueStatusCallbackEvent): self { $this->options['dequeueStatusCallbackEvent'] = $dequeueStatusCallbackEvent; return $this; } /** * The new worker activity SID after executing a Conference instruction. * * @param string $postWorkActivitySid The new worker activity SID after * executing a Conference instruction * @return $this Fluent Builder */ public function setPostWorkActivitySid(string $postWorkActivitySid): self { $this->options['postWorkActivitySid'] = $postWorkActivitySid; return $this; } /** * Whether to end the conference when the customer leaves. * * @param bool $endConferenceOnCustomerExit Whether to end the conference when * the customer leaves * @return $this Fluent Builder */ public function setEndConferenceOnCustomerExit(bool $endConferenceOnCustomerExit): self { $this->options['endConferenceOnCustomerExit'] = $endConferenceOnCustomerExit; return $this; } /** * Whether to play a notification beep when the customer joins. * * @param bool $beepOnCustomerEntrance Whether to play a notification beep when * the customer joins * @return $this Fluent Builder */ public function setBeepOnCustomerEntrance(bool $beepOnCustomerEntrance): self { $this->options['beepOnCustomerEntrance'] = $beepOnCustomerEntrance; return $this; } /** * The If-Match HTTP request header * * @param string $ifMatch The If-Match HTTP request header * @return $this Fluent Builder */ public function setIfMatch(string $ifMatch): self { $this->options['ifMatch'] = $ifMatch; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.UpdateReservationOptions ' . $options . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/ReservationList.php000064400000013026150515725670021244 0ustar00solution = ['workspaceSid' => $workspaceSid, 'workerSid' => $workerSid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/Workers/' . \rawurlencode($workerSid) . '/Reservations'; } /** * Streams ReservationInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ReservationInstance 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 ReservationInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of ReservationInstance 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 ReservationPage Page of ReservationInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ReservationPage { $options = new Values($options); $params = Values::of([ 'ReservationStatus' => $options['reservationStatus'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ReservationPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ReservationInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ReservationPage Page of ReservationInstance */ public function getPage(string $targetUrl): ReservationPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ReservationPage($this->version, $response, $this->solution); } /** * Constructs a ReservationContext * * @param string $sid The SID of the WorkerReservation resource to fetch */ public function getContext(string $sid): ReservationContext { return new ReservationContext( $this->version, $this->solution['workspaceSid'], $this->solution['workerSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.ReservationList]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkerChannelContext.php000064400000005635150515725670022225 0ustar00solution = ['workspaceSid' => $workspaceSid, 'workerSid' => $workerSid, 'sid' => $sid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/Workers/' . \rawurlencode($workerSid) . '/Channels/' . \rawurlencode($sid) . ''; } /** * Fetch the WorkerChannelInstance * * @return WorkerChannelInstance Fetched WorkerChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): WorkerChannelInstance { $payload = $this->version->fetch('GET', $this->uri); return new WorkerChannelInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['workerSid'], $this->solution['sid'] ); } /** * Update the WorkerChannelInstance * * @param array|Options $options Optional Arguments * @return WorkerChannelInstance Updated WorkerChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): WorkerChannelInstance { $options = new Values($options); $data = Values::of([ 'Capacity' => $options['capacity'], 'Available' => Serialize::booleanToString($options['available']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new WorkerChannelInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['workerSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.WorkerChannelContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkersRealTimeStatisticsContext.php000064400000004066150515725670024612 0ustar00solution = ['workspaceSid' => $workspaceSid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/Workers/RealTimeStatistics'; } /** * Fetch the WorkersRealTimeStatisticsInstance * * @param array|Options $options Optional Arguments * @return WorkersRealTimeStatisticsInstance Fetched * WorkersRealTimeStatisticsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): WorkersRealTimeStatisticsInstance { $options = new Values($options); $params = Values::of(['TaskChannel' => $options['taskChannel'], ]); $payload = $this->version->fetch('GET', $this->uri, $params); return new WorkersRealTimeStatisticsInstance( $this->version, $payload, $this->solution['workspaceSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.WorkersRealTimeStatisticsContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/ReservationPage.php000064400000002470150515725670021206 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ReservationInstance \Twilio\Rest\Taskrouter\V1\Workspace\Worker\ReservationInstance */ public function buildInstance(array $payload): ReservationInstance { return new ReservationInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['workerSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.ReservationPage]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkersRealTimeStatisticsPage.php000064400000002542150515725670024037 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return WorkersRealTimeStatisticsInstance \Twilio\Rest\Taskrouter\V1\Workspace\Worker\WorkersRealTimeStatisticsInstance */ public function buildInstance(array $payload): WorkersRealTimeStatisticsInstance { return new WorkersRealTimeStatisticsInstance( $this->version, $payload, $this->solution['workspaceSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.WorkersRealTimeStatisticsPage]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkerChannelOptions.php000064400000004722150515725670022230 0ustar00options['capacity'] = $capacity; $this->options['available'] = $available; } /** * The total number of Tasks that the Worker should handle for the TaskChannel type. TaskRouter creates reservations for Tasks of this TaskChannel type up to the specified capacity. If the capacity is 0, no new reservations will be created. * * @param int $capacity The total number of Tasks that the Worker should handle * for the TaskChannel type * @return $this Fluent Builder */ public function setCapacity(int $capacity): self { $this->options['capacity'] = $capacity; return $this; } /** * Whether the WorkerChannel is available. Set to `false` to prevent the Worker from receiving any new Tasks of this TaskChannel type. * * @param bool $available Whether the WorkerChannel is available * @return $this Fluent Builder */ public function setAvailable(bool $available): self { $this->options['available'] = $available; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.UpdateWorkerChannelOptions ' . $options . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkersCumulativeStatisticsContext.php000064400000004473150515725670025230 0ustar00solution = ['workspaceSid' => $workspaceSid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/Workers/CumulativeStatistics'; } /** * Fetch the WorkersCumulativeStatisticsInstance * * @param array|Options $options Optional Arguments * @return WorkersCumulativeStatisticsInstance Fetched * WorkersCumulativeStatisticsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): WorkersCumulativeStatisticsInstance { $options = new Values($options); $params = Values::of([ 'EndDate' => Serialize::iso8601DateTime($options['endDate']), 'Minutes' => $options['minutes'], 'StartDate' => Serialize::iso8601DateTime($options['startDate']), 'TaskChannel' => $options['taskChannel'], ]); $payload = $this->version->fetch('GET', $this->uri, $params); return new WorkersCumulativeStatisticsInstance( $this->version, $payload, $this->solution['workspaceSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.WorkersCumulativeStatisticsContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/Worker/WorkersCumulativeStatisticsList.php000064400000002335150515725670024512 0ustar00solution = ['workspaceSid' => $workspaceSid, ]; } /** * Constructs a WorkersCumulativeStatisticsContext */ public function getContext(): WorkersCumulativeStatisticsContext { return new WorkersCumulativeStatisticsContext($this->version, $this->solution['workspaceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.WorkersCumulativeStatisticsList]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/WorkflowInstance.php000064400000013412150515725670020134 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'assignmentCallbackUrl' => Values::array_get($payload, 'assignment_callback_url'), 'configuration' => Values::array_get($payload, 'configuration'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'documentContentType' => Values::array_get($payload, 'document_content_type'), 'fallbackAssignmentCallbackUrl' => Values::array_get($payload, 'fallback_assignment_callback_url'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'sid' => Values::array_get($payload, 'sid'), 'taskReservationTimeout' => Values::array_get($payload, 'task_reservation_timeout'), 'workspaceSid' => Values::array_get($payload, 'workspace_sid'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['workspaceSid' => $workspaceSid, '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 WorkflowContext Context for this WorkflowInstance */ protected function proxy(): WorkflowContext { if (!$this->context) { $this->context = new WorkflowContext( $this->version, $this->solution['workspaceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the WorkflowInstance * * @return WorkflowInstance Fetched WorkflowInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): WorkflowInstance { return $this->proxy()->fetch(); } /** * Update the WorkflowInstance * * @param array|Options $options Optional Arguments * @return WorkflowInstance Updated WorkflowInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): WorkflowInstance { return $this->proxy()->update($options); } /** * Delete the WorkflowInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the statistics */ protected function getStatistics(): WorkflowStatisticsList { return $this->proxy()->statistics; } /** * Access the realTimeStatistics */ protected function getRealTimeStatistics(): WorkflowRealTimeStatisticsList { return $this->proxy()->realTimeStatistics; } /** * Access the cumulativeStatistics */ protected function getCumulativeStatistics(): WorkflowCumulativeStatisticsList { return $this->proxy()->cumulativeStatistics; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.WorkflowInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskQueueContext.php000064400000014520150515725670020112 0ustar00solution = ['workspaceSid' => $workspaceSid, 'sid' => $sid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/TaskQueues/' . \rawurlencode($sid) . ''; } /** * Fetch the TaskQueueInstance * * @return TaskQueueInstance Fetched TaskQueueInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TaskQueueInstance { $payload = $this->version->fetch('GET', $this->uri); return new TaskQueueInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['sid'] ); } /** * Update the TaskQueueInstance * * @param array|Options $options Optional Arguments * @return TaskQueueInstance Updated TaskQueueInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): TaskQueueInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'TargetWorkers' => $options['targetWorkers'], 'ReservationActivitySid' => $options['reservationActivitySid'], 'AssignmentActivitySid' => $options['assignmentActivitySid'], 'MaxReservedWorkers' => $options['maxReservedWorkers'], 'TaskOrder' => $options['taskOrder'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new TaskQueueInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['sid'] ); } /** * Delete the TaskQueueInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the statistics */ protected function getStatistics(): TaskQueueStatisticsList { if (!$this->_statistics) { $this->_statistics = new TaskQueueStatisticsList( $this->version, $this->solution['workspaceSid'], $this->solution['sid'] ); } return $this->_statistics; } /** * Access the realTimeStatistics */ protected function getRealTimeStatistics(): TaskQueueRealTimeStatisticsList { if (!$this->_realTimeStatistics) { $this->_realTimeStatistics = new TaskQueueRealTimeStatisticsList( $this->version, $this->solution['workspaceSid'], $this->solution['sid'] ); } return $this->_realTimeStatistics; } /** * Access the cumulativeStatistics */ protected function getCumulativeStatistics(): TaskQueueCumulativeStatisticsList { if (!$this->_cumulativeStatistics) { $this->_cumulativeStatistics = new TaskQueueCumulativeStatisticsList( $this->version, $this->solution['workspaceSid'], $this->solution['sid'] ); } return $this->_cumulativeStatistics; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.TaskQueueContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskChannelOptions.php000064400000010354150515725670020406 0ustar00options['friendlyName'] = $friendlyName; $this->options['channelOptimizedRouting'] = $channelOptimizedRouting; } /** * A descriptive string that you create to describe the Task Channel. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the Task Channel resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Whether the TaskChannel should prioritize Workers that have been idle. If `true`, Workers that have been idle the longest are prioritized. * * @param bool $channelOptimizedRouting Whether the TaskChannel should * prioritize Workers that have been idle * @return $this Fluent Builder */ public function setChannelOptimizedRouting(bool $channelOptimizedRouting): self { $this->options['channelOptimizedRouting'] = $channelOptimizedRouting; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.UpdateTaskChannelOptions ' . $options . ']'; } } class CreateTaskChannelOptions extends Options { /** * @param bool $channelOptimizedRouting Whether the Task Channel should * prioritize Workers that have been idle */ public function __construct(bool $channelOptimizedRouting = Values::NONE) { $this->options['channelOptimizedRouting'] = $channelOptimizedRouting; } /** * Whether the Task Channel should prioritize Workers that have been idle. If `true`, Workers that have been idle the longest are prioritized. * * @param bool $channelOptimizedRouting Whether the Task Channel should * prioritize Workers that have been idle * @return $this Fluent Builder */ public function setChannelOptimizedRouting(bool $channelOptimizedRouting): self { $this->options['channelOptimizedRouting'] = $channelOptimizedRouting; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.CreateTaskChannelOptions ' . $options . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/WorkspaceCumulativeStatisticsOptions.php000064400000013356150515725670024270 0ustar00options['endDate'] = $endDate; $this->options['minutes'] = $minutes; $this->options['startDate'] = $startDate; $this->options['taskChannel'] = $taskChannel; $this->options['splitByWaitTime'] = $splitByWaitTime; } /** * Only include usage that occurred on or before this date, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time. * * @param \DateTime $endDate Only include usage that occurred on or before this * date * @return $this Fluent Builder */ public function setEndDate(\DateTime $endDate): self { $this->options['endDate'] = $endDate; return $this; } /** * Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends. * * @param int $minutes Only calculate statistics since this many minutes in the * past * @return $this Fluent Builder */ public function setMinutes(int $minutes): self { $this->options['minutes'] = $minutes; return $this; } /** * Only calculate statistics from this date and time and later, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. * * @param \DateTime $startDate Only calculate statistics from on or after this * date * @return $this Fluent Builder */ public function setStartDate(\DateTime $startDate): self { $this->options['startDate'] = $startDate; return $this; } /** * Only calculate cumulative statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`. * * @param string $taskChannel Only calculate cumulative statistics on this * TaskChannel * @return $this Fluent Builder */ public function setTaskChannel(string $taskChannel): self { $this->options['taskChannel'] = $taskChannel; return $this; } /** * A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. For example, `5,30` would show splits of Tasks that were canceled or accepted before and after 5 seconds and before and after 30 seconds. This can be used to show short abandoned Tasks or Tasks that failed to meet an SLA. * * @param string $splitByWaitTime A comma separated list of values that * describes the thresholds to calculate * statistics on * @return $this Fluent Builder */ public function setSplitByWaitTime(string $splitByWaitTime): self { $this->options['splitByWaitTime'] = $splitByWaitTime; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.FetchWorkspaceCumulativeStatisticsOptions ' . $options . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskList.php000064400000014642150515725670016401 0ustar00solution = ['workspaceSid' => $workspaceSid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/Tasks'; } /** * Streams TaskInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads TaskInstance 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 TaskInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of TaskInstance 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 TaskPage Page of TaskInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): TaskPage { $options = new Values($options); $params = Values::of([ 'Priority' => $options['priority'], 'AssignmentStatus' => Serialize::map($options['assignmentStatus'], function($e) { return $e; }), 'WorkflowSid' => $options['workflowSid'], 'WorkflowName' => $options['workflowName'], 'TaskQueueSid' => $options['taskQueueSid'], 'TaskQueueName' => $options['taskQueueName'], 'EvaluateTaskAttributes' => $options['evaluateTaskAttributes'], 'Ordering' => $options['ordering'], 'HasAddons' => Serialize::booleanToString($options['hasAddons']), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new TaskPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of TaskInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return TaskPage Page of TaskInstance */ public function getPage(string $targetUrl): TaskPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new TaskPage($this->version, $response, $this->solution); } /** * Create the TaskInstance * * @param array|Options $options Optional Arguments * @return TaskInstance Created TaskInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): TaskInstance { $options = new Values($options); $data = Values::of([ 'Timeout' => $options['timeout'], 'Priority' => $options['priority'], 'TaskChannel' => $options['taskChannel'], 'WorkflowSid' => $options['workflowSid'], 'Attributes' => $options['attributes'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new TaskInstance($this->version, $payload, $this->solution['workspaceSid']); } /** * Constructs a TaskContext * * @param string $sid The SID of the resource to fetch */ public function getContext(string $sid): TaskContext { return new TaskContext($this->version, $this->solution['workspaceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.TaskList]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/ActivityOptions.php000064400000013121150515725670020002 0ustar00options['friendlyName'] = $friendlyName; } /** * A descriptive string that you create to describe the Activity resource. It can be up to 64 characters long. These names are used to calculate and expose statistics about Workers, and provide visibility into the state of each Worker. Examples of friendly names include: `on-call`, `break`, and `email`. * * @param string $friendlyName A string to describe the Activity resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.UpdateActivityOptions ' . $options . ']'; } } class ReadActivityOptions extends Options { /** * @param string $friendlyName The friendly_name of the Activity resources to * read * @param string $available Whether to return activities that are available or * unavailable */ public function __construct(string $friendlyName = Values::NONE, string $available = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['available'] = $available; } /** * The `friendly_name` of the Activity resources to read. * * @param string $friendlyName The friendly_name of the Activity resources to * read * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Whether return only Activity resources that are available or unavailable. A value of `true` returns only available activities. Values of '1' or `yes` also indicate `true`. All other values represent `false` and return activities that are unavailable. * * @param string $available Whether to return activities that are available or * unavailable * @return $this Fluent Builder */ public function setAvailable(string $available): self { $this->options['available'] = $available; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.ReadActivityOptions ' . $options . ']'; } } class CreateActivityOptions extends Options { /** * @param bool $available Whether the Worker should be eligible to receive a * Task when it occupies the Activity */ public function __construct(bool $available = Values::NONE) { $this->options['available'] = $available; } /** * Whether the Worker should be eligible to receive a Task when it occupies the Activity. A value of `true`, `1`, or `yes` specifies the Activity is available. All other values specify that it is not. The value cannot be changed after the Activity is created. * * @param bool $available Whether the Worker should be eligible to receive a * Task when it occupies the Activity * @return $this Fluent Builder */ public function setAvailable(bool $available): self { $this->options['available'] = $available; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.CreateActivityOptions ' . $options . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/WorkflowPage.php000064400000002300150515725670017236 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return WorkflowInstance \Twilio\Rest\Taskrouter\V1\Workspace\WorkflowInstance */ public function buildInstance(array $payload): WorkflowInstance { return new WorkflowInstance($this->version, $payload, $this->solution['workspaceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.WorkflowPage]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/WorkspaceStatisticsContext.php000064400000004212150515725670022211 0ustar00solution = ['workspaceSid' => $workspaceSid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/Statistics'; } /** * Fetch the WorkspaceStatisticsInstance * * @param array|Options $options Optional Arguments * @return WorkspaceStatisticsInstance Fetched WorkspaceStatisticsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(array $options = []): WorkspaceStatisticsInstance { $options = new Values($options); $params = Values::of([ 'Minutes' => $options['minutes'], 'StartDate' => Serialize::iso8601DateTime($options['startDate']), 'EndDate' => Serialize::iso8601DateTime($options['endDate']), 'TaskChannel' => $options['taskChannel'], 'SplitByWaitTime' => $options['splitByWaitTime'], ]); $payload = $this->version->fetch('GET', $this->uri, $params); return new WorkspaceStatisticsInstance($this->version, $payload, $this->solution['workspaceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.WorkspaceStatisticsContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/EventContext.php000064400000003325150515725670017265 0ustar00solution = ['workspaceSid' => $workspaceSid, 'sid' => $sid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/Events/' . \rawurlencode($sid) . ''; } /** * Fetch the EventInstance * * @return EventInstance Fetched EventInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): EventInstance { $payload = $this->version->fetch('GET', $this->uri); return new EventInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.EventContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/WorkflowContext.php000064400000014512150515725670020016 0ustar00solution = ['workspaceSid' => $workspaceSid, 'sid' => $sid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/Workflows/' . \rawurlencode($sid) . ''; } /** * Fetch the WorkflowInstance * * @return WorkflowInstance Fetched WorkflowInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): WorkflowInstance { $payload = $this->version->fetch('GET', $this->uri); return new WorkflowInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['sid'] ); } /** * Update the WorkflowInstance * * @param array|Options $options Optional Arguments * @return WorkflowInstance Updated WorkflowInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): WorkflowInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'AssignmentCallbackUrl' => $options['assignmentCallbackUrl'], 'FallbackAssignmentCallbackUrl' => $options['fallbackAssignmentCallbackUrl'], 'Configuration' => $options['configuration'], 'TaskReservationTimeout' => $options['taskReservationTimeout'], 'ReEvaluateTasks' => $options['reEvaluateTasks'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new WorkflowInstance( $this->version, $payload, $this->solution['workspaceSid'], $this->solution['sid'] ); } /** * Delete the WorkflowInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the statistics */ protected function getStatistics(): WorkflowStatisticsList { if (!$this->_statistics) { $this->_statistics = new WorkflowStatisticsList( $this->version, $this->solution['workspaceSid'], $this->solution['sid'] ); } return $this->_statistics; } /** * Access the realTimeStatistics */ protected function getRealTimeStatistics(): WorkflowRealTimeStatisticsList { if (!$this->_realTimeStatistics) { $this->_realTimeStatistics = new WorkflowRealTimeStatisticsList( $this->version, $this->solution['workspaceSid'], $this->solution['sid'] ); } return $this->_realTimeStatistics; } /** * Access the cumulativeStatistics */ protected function getCumulativeStatistics(): WorkflowCumulativeStatisticsList { if (!$this->_cumulativeStatistics) { $this->_cumulativeStatistics = new WorkflowCumulativeStatisticsList( $this->version, $this->solution['workspaceSid'], $this->solution['sid'] ); } return $this->_cumulativeStatistics; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.WorkflowContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/TaskPage.php000064400000002250150515725670016332 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return TaskInstance \Twilio\Rest\Taskrouter\V1\Workspace\TaskInstance */ public function buildInstance(array $payload): TaskInstance { return new TaskInstance($this->version, $payload, $this->solution['workspaceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.TaskPage]'; } }src/Twilio/Rest/Taskrouter/V1/Workspace/WorkflowList.php000064400000014614150515725670017310 0ustar00solution = ['workspaceSid' => $workspaceSid, ]; $this->uri = '/Workspaces/' . \rawurlencode($workspaceSid) . '/Workflows'; } /** * Streams WorkflowInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads WorkflowInstance 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 WorkflowInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of WorkflowInstance 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 WorkflowPage Page of WorkflowInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): WorkflowPage { $options = new Values($options); $params = Values::of([ 'FriendlyName' => $options['friendlyName'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new WorkflowPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of WorkflowInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return WorkflowPage Page of WorkflowInstance */ public function getPage(string $targetUrl): WorkflowPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new WorkflowPage($this->version, $response, $this->solution); } /** * Create the WorkflowInstance * * @param string $friendlyName descriptive string that you create to describe * the Workflow resource * @param string $configuration A JSON string that contains the rules to apply * to the Workflow * @param array|Options $options Optional Arguments * @return WorkflowInstance Created WorkflowInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, string $configuration, array $options = []): WorkflowInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $friendlyName, 'Configuration' => $configuration, 'AssignmentCallbackUrl' => $options['assignmentCallbackUrl'], 'FallbackAssignmentCallbackUrl' => $options['fallbackAssignmentCallbackUrl'], 'TaskReservationTimeout' => $options['taskReservationTimeout'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new WorkflowInstance($this->version, $payload, $this->solution['workspaceSid']); } /** * Constructs a WorkflowContext * * @param string $sid The SID of the resource */ public function getContext(string $sid): WorkflowContext { return new WorkflowContext($this->version, $this->solution['workspaceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.WorkflowList]'; } }src/Twilio/Rest/Taskrouter/V1/WorkspaceList.php000064400000013752150515725670015500 0ustar00solution = []; $this->uri = '/Workspaces'; } /** * Streams WorkspaceInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads WorkspaceInstance 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 WorkspaceInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of WorkspaceInstance 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 WorkspacePage Page of WorkspaceInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): WorkspacePage { $options = new Values($options); $params = Values::of([ 'FriendlyName' => $options['friendlyName'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new WorkspacePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of WorkspaceInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return WorkspacePage Page of WorkspaceInstance */ public function getPage(string $targetUrl): WorkspacePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new WorkspacePage($this->version, $response, $this->solution); } /** * Create the WorkspaceInstance * * @param string $friendlyName A string to describe the Workspace resource * @param array|Options $options Optional Arguments * @return WorkspaceInstance Created WorkspaceInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, array $options = []): WorkspaceInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $friendlyName, 'EventCallbackUrl' => $options['eventCallbackUrl'], 'EventsFilter' => $options['eventsFilter'], 'MultiTaskEnabled' => Serialize::booleanToString($options['multiTaskEnabled']), 'Template' => $options['template'], 'PrioritizeQueueOrder' => $options['prioritizeQueueOrder'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new WorkspaceInstance($this->version, $payload); } /** * Constructs a WorkspaceContext * * @param string $sid The SID of the resource to fetch */ public function getContext(string $sid): WorkspaceContext { return new WorkspaceContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.WorkspaceList]'; } }src/Twilio/Rest/Taskrouter/V1/WorkspaceOptions.php000064400000037661150515725670016225 0ustar00options['defaultActivitySid'] = $defaultActivitySid; $this->options['eventCallbackUrl'] = $eventCallbackUrl; $this->options['eventsFilter'] = $eventsFilter; $this->options['friendlyName'] = $friendlyName; $this->options['multiTaskEnabled'] = $multiTaskEnabled; $this->options['timeoutActivitySid'] = $timeoutActivitySid; $this->options['prioritizeQueueOrder'] = $prioritizeQueueOrder; } /** * The SID of the Activity that will be used when new Workers are created in the Workspace. * * @param string $defaultActivitySid The SID of the Activity that will be used * when new Workers are created in the * Workspace * @return $this Fluent Builder */ public function setDefaultActivitySid(string $defaultActivitySid): self { $this->options['defaultActivitySid'] = $defaultActivitySid; return $this; } /** * The URL we should call when an event occurs. See [Workspace Events](https://www.twilio.com/docs/taskrouter/api/event) for more information. This parameter supports Twilio's [Webhooks (HTTP callbacks) Connection Overrides](https://www.twilio.com/docs/usage/webhooks/webhooks-connection-overrides). * * @param string $eventCallbackUrl The URL we should call when an event occurs * @return $this Fluent Builder */ public function setEventCallbackUrl(string $eventCallbackUrl): self { $this->options['eventCallbackUrl'] = $eventCallbackUrl; return $this; } /** * The list of Workspace events for which to call event_callback_url. For example if `EventsFilter=task.created,task.canceled,worker.activity.update`, then TaskRouter will call event_callback_url only when a task is created, canceled, or a Worker activity is updated. * * @param string $eventsFilter The list of Workspace events for which to call * event_callback_url * @return $this Fluent Builder */ public function setEventsFilter(string $eventsFilter): self { $this->options['eventsFilter'] = $eventsFilter; return $this; } /** * A descriptive string that you create to describe the Workspace resource. For example: `Sales Call Center` or `Customer Support Team`. * * @param string $friendlyName A string to describe the Workspace resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Whether to enable multi-tasking. Can be: `true` to enable multi-tasking, or `false` to disable it. However, all workspaces should be maintained as multi-tasking. There is no default when omitting this parameter. A multi-tasking Workspace can't be updated to single-tasking unless it is not a Flex Project and another (legacy) single-tasking Workspace exists. Multi-tasking allows Workers to handle multiple Tasks simultaneously. In multi-tasking mode, each Worker can receive parallel reservations up to the per-channel maximums defined in the Workers section. In single-tasking mode (legacy mode), each Worker will only receive a new reservation when the previous task is completed. Learn more at [Multitasking](https://www.twilio.com/docs/taskrouter/multitasking). * * @param bool $multiTaskEnabled Whether multi-tasking is enabled * @return $this Fluent Builder */ public function setMultiTaskEnabled(bool $multiTaskEnabled): self { $this->options['multiTaskEnabled'] = $multiTaskEnabled; return $this; } /** * The SID of the Activity that will be assigned to a Worker when a Task reservation times out without a response. * * @param string $timeoutActivitySid The SID of the Activity that will be * assigned to a Worker when a Task * reservation times out without a response * @return $this Fluent Builder */ public function setTimeoutActivitySid(string $timeoutActivitySid): self { $this->options['timeoutActivitySid'] = $timeoutActivitySid; return $this; } /** * The type of TaskQueue to prioritize when Workers are receiving Tasks from both types of TaskQueues. Can be: `LIFO` or `FIFO`. For more information, see [Queue Ordering](https://www.twilio.com/docs/taskrouter/queue-ordering-last-first-out-lifo). * * @param string $prioritizeQueueOrder The type of TaskQueue to prioritize when * Workers are receiving Tasks from both * types of TaskQueues * @return $this Fluent Builder */ public function setPrioritizeQueueOrder(string $prioritizeQueueOrder): self { $this->options['prioritizeQueueOrder'] = $prioritizeQueueOrder; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.UpdateWorkspaceOptions ' . $options . ']'; } } class ReadWorkspaceOptions extends Options { /** * @param string $friendlyName The friendly_name of the Workspace resources to * read */ public function __construct(string $friendlyName = Values::NONE) { $this->options['friendlyName'] = $friendlyName; } /** * The `friendly_name` of the Workspace resources to read. For example `Customer Support` or `2014 Election Campaign`. * * @param string $friendlyName The friendly_name of the Workspace resources to * read * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.ReadWorkspaceOptions ' . $options . ']'; } } class CreateWorkspaceOptions extends Options { /** * @param string $eventCallbackUrl The URL we should call when an event occurs * @param string $eventsFilter The list of Workspace events for which to call * event_callback_url * @param bool $multiTaskEnabled Whether multi-tasking is enabled * @param string $template An available template name * @param string $prioritizeQueueOrder The type of TaskQueue to prioritize when * Workers are receiving Tasks from both * types of TaskQueues */ public function __construct(string $eventCallbackUrl = Values::NONE, string $eventsFilter = Values::NONE, bool $multiTaskEnabled = Values::NONE, string $template = Values::NONE, string $prioritizeQueueOrder = Values::NONE) { $this->options['eventCallbackUrl'] = $eventCallbackUrl; $this->options['eventsFilter'] = $eventsFilter; $this->options['multiTaskEnabled'] = $multiTaskEnabled; $this->options['template'] = $template; $this->options['prioritizeQueueOrder'] = $prioritizeQueueOrder; } /** * The URL we should call when an event occurs. If provided, the Workspace will publish events to this URL, for example, to collect data for reporting. See [Workspace Events](https://www.twilio.com/docs/taskrouter/api/event) for more information. This parameter supports Twilio's [Webhooks (HTTP callbacks) Connection Overrides](https://www.twilio.com/docs/usage/webhooks/webhooks-connection-overrides). * * @param string $eventCallbackUrl The URL we should call when an event occurs * @return $this Fluent Builder */ public function setEventCallbackUrl(string $eventCallbackUrl): self { $this->options['eventCallbackUrl'] = $eventCallbackUrl; return $this; } /** * The list of Workspace events for which to call event_callback_url. For example, if `EventsFilter=task.created, task.canceled, worker.activity.update`, then TaskRouter will call event_callback_url only when a task is created, canceled, or a Worker activity is updated. * * @param string $eventsFilter The list of Workspace events for which to call * event_callback_url * @return $this Fluent Builder */ public function setEventsFilter(string $eventsFilter): self { $this->options['eventsFilter'] = $eventsFilter; return $this; } /** * Whether to enable multi-tasking. Can be: `true` to enable multi-tasking, or `false` to disable it. However, all workspaces should be created as multi-tasking. The default is `true`. Multi-tasking allows Workers to handle multiple Tasks simultaneously. When enabled (`true`), each Worker can receive parallel reservations up to the per-channel maximums defined in the Workers section. In single-tasking mode (legacy mode), each Worker will only receive a new reservation when the previous task is completed. Learn more at [Multitasking](https://www.twilio.com/docs/taskrouter/multitasking). * * @param bool $multiTaskEnabled Whether multi-tasking is enabled * @return $this Fluent Builder */ public function setMultiTaskEnabled(bool $multiTaskEnabled): self { $this->options['multiTaskEnabled'] = $multiTaskEnabled; return $this; } /** * An available template name. Can be: `NONE` or `FIFO` and the default is `NONE`. Pre-configures the Workspace with the Workflow and Activities specified in the template. `NONE` will create a Workspace with only a set of default activities. `FIFO` will configure TaskRouter with a set of default activities and a single TaskQueue for first-in, first-out distribution, which can be useful when you are getting started with TaskRouter. * * @param string $template An available template name * @return $this Fluent Builder */ public function setTemplate(string $template): self { $this->options['template'] = $template; return $this; } /** * The type of TaskQueue to prioritize when Workers are receiving Tasks from both types of TaskQueues. Can be: `LIFO` or `FIFO` and the default is `FIFO`. For more information, see [Queue Ordering](https://www.twilio.com/docs/taskrouter/queue-ordering-last-first-out-lifo). * * @param string $prioritizeQueueOrder The type of TaskQueue to prioritize when * Workers are receiving Tasks from both * types of TaskQueues * @return $this Fluent Builder */ public function setPrioritizeQueueOrder(string $prioritizeQueueOrder): self { $this->options['prioritizeQueueOrder'] = $prioritizeQueueOrder; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Taskrouter.V1.CreateWorkspaceOptions ' . $options . ']'; } }src/Twilio/Rest/Taskrouter/V1/WorkspaceInstance.php000064400000016360150515725670016327 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'defaultActivityName' => Values::array_get($payload, 'default_activity_name'), 'defaultActivitySid' => Values::array_get($payload, 'default_activity_sid'), 'eventCallbackUrl' => Values::array_get($payload, 'event_callback_url'), 'eventsFilter' => Values::array_get($payload, 'events_filter'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'multiTaskEnabled' => Values::array_get($payload, 'multi_task_enabled'), 'sid' => Values::array_get($payload, 'sid'), 'timeoutActivityName' => Values::array_get($payload, 'timeout_activity_name'), 'timeoutActivitySid' => Values::array_get($payload, 'timeout_activity_sid'), 'prioritizeQueueOrder' => Values::array_get($payload, 'prioritize_queue_order'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 WorkspaceContext Context for this WorkspaceInstance */ protected function proxy(): WorkspaceContext { if (!$this->context) { $this->context = new WorkspaceContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the WorkspaceInstance * * @return WorkspaceInstance Fetched WorkspaceInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): WorkspaceInstance { return $this->proxy()->fetch(); } /** * Update the WorkspaceInstance * * @param array|Options $options Optional Arguments * @return WorkspaceInstance Updated WorkspaceInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): WorkspaceInstance { return $this->proxy()->update($options); } /** * Delete the WorkspaceInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the activities */ protected function getActivities(): ActivityList { return $this->proxy()->activities; } /** * Access the events */ protected function getEvents(): EventList { return $this->proxy()->events; } /** * Access the tasks */ protected function getTasks(): TaskList { return $this->proxy()->tasks; } /** * Access the taskQueues */ protected function getTaskQueues(): TaskQueueList { return $this->proxy()->taskQueues; } /** * Access the workers */ protected function getWorkers(): WorkerList { return $this->proxy()->workers; } /** * Access the workflows */ protected function getWorkflows(): WorkflowList { return $this->proxy()->workflows; } /** * Access the statistics */ protected function getStatistics(): WorkspaceStatisticsList { return $this->proxy()->statistics; } /** * Access the realTimeStatistics */ protected function getRealTimeStatistics(): WorkspaceRealTimeStatisticsList { return $this->proxy()->realTimeStatistics; } /** * Access the cumulativeStatistics */ protected function getCumulativeStatistics(): WorkspaceCumulativeStatisticsList { return $this->proxy()->cumulativeStatistics; } /** * Access the taskChannels */ protected function getTaskChannels(): TaskChannelList { return $this->proxy()->taskChannels; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.WorkspaceInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/WorkspaceContext.php000064400000022022150515725670016177 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Workspaces/' . \rawurlencode($sid) . ''; } /** * Fetch the WorkspaceInstance * * @return WorkspaceInstance Fetched WorkspaceInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): WorkspaceInstance { $payload = $this->version->fetch('GET', $this->uri); return new WorkspaceInstance($this->version, $payload, $this->solution['sid']); } /** * Update the WorkspaceInstance * * @param array|Options $options Optional Arguments * @return WorkspaceInstance Updated WorkspaceInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): WorkspaceInstance { $options = new Values($options); $data = Values::of([ 'DefaultActivitySid' => $options['defaultActivitySid'], 'EventCallbackUrl' => $options['eventCallbackUrl'], 'EventsFilter' => $options['eventsFilter'], 'FriendlyName' => $options['friendlyName'], 'MultiTaskEnabled' => Serialize::booleanToString($options['multiTaskEnabled']), 'TimeoutActivitySid' => $options['timeoutActivitySid'], 'PrioritizeQueueOrder' => $options['prioritizeQueueOrder'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new WorkspaceInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the WorkspaceInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the activities */ protected function getActivities(): ActivityList { if (!$this->_activities) { $this->_activities = new ActivityList($this->version, $this->solution['sid']); } return $this->_activities; } /** * Access the events */ protected function getEvents(): EventList { if (!$this->_events) { $this->_events = new EventList($this->version, $this->solution['sid']); } return $this->_events; } /** * Access the tasks */ protected function getTasks(): TaskList { if (!$this->_tasks) { $this->_tasks = new TaskList($this->version, $this->solution['sid']); } return $this->_tasks; } /** * Access the taskQueues */ protected function getTaskQueues(): TaskQueueList { if (!$this->_taskQueues) { $this->_taskQueues = new TaskQueueList($this->version, $this->solution['sid']); } return $this->_taskQueues; } /** * Access the workers */ protected function getWorkers(): WorkerList { if (!$this->_workers) { $this->_workers = new WorkerList($this->version, $this->solution['sid']); } return $this->_workers; } /** * Access the workflows */ protected function getWorkflows(): WorkflowList { if (!$this->_workflows) { $this->_workflows = new WorkflowList($this->version, $this->solution['sid']); } return $this->_workflows; } /** * Access the statistics */ protected function getStatistics(): WorkspaceStatisticsList { if (!$this->_statistics) { $this->_statistics = new WorkspaceStatisticsList($this->version, $this->solution['sid']); } return $this->_statistics; } /** * Access the realTimeStatistics */ protected function getRealTimeStatistics(): WorkspaceRealTimeStatisticsList { if (!$this->_realTimeStatistics) { $this->_realTimeStatistics = new WorkspaceRealTimeStatisticsList( $this->version, $this->solution['sid'] ); } return $this->_realTimeStatistics; } /** * Access the cumulativeStatistics */ protected function getCumulativeStatistics(): WorkspaceCumulativeStatisticsList { if (!$this->_cumulativeStatistics) { $this->_cumulativeStatistics = new WorkspaceCumulativeStatisticsList( $this->version, $this->solution['sid'] ); } return $this->_cumulativeStatistics; } /** * Access the taskChannels */ protected function getTaskChannels(): TaskChannelList { if (!$this->_taskChannels) { $this->_taskChannels = new TaskChannelList($this->version, $this->solution['sid']); } return $this->_taskChannels; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Taskrouter.V1.WorkspaceContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Taskrouter/V1/WorkspacePage.php000064400000002221150515725670015426 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return WorkspaceInstance \Twilio\Rest\Taskrouter\V1\WorkspaceInstance */ public function buildInstance(array $payload): WorkspaceInstance { return new WorkspaceInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Taskrouter.V1.WorkspacePage]'; } }src/Twilio/Rest/Taskrouter/V1.php000064400000004314150515725670012700 0ustar00version = 'v1'; } protected function getWorkspaces(): WorkspaceList { if (!$this->_workspaces) { $this->_workspaces = new WorkspaceList($this); } return $this->_workspaces; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Taskrouter.V1]'; } }src/Twilio/Rest/Proxy.php000064400000004735150515725670011377 0ustar00baseUrl = 'https://proxy.twilio.com'; } /** * @return V1 Version v1 of proxy */ protected function getV1(): V1 { 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 TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } protected function getServices(): \Twilio\Rest\Proxy\V1\ServiceList { return $this->v1->services; } /** * @param string $sid The unique string that identifies the resource */ protected function contextServices(string $sid): \Twilio\Rest\Proxy\V1\ServiceContext { return $this->v1->services($sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Proxy]'; } }src/Twilio/Rest/Trunking/V1/Trunk/OriginationUrlList.php000064400000014140150515725670017240 0ustar00solution = ['trunkSid' => $trunkSid, ]; $this->uri = '/Trunks/' . \rawurlencode($trunkSid) . '/OriginationUrls'; } /** * Create the OriginationUrlInstance * * @param int $weight The value that determines the relative load the URI * should receive compared to others with the same priority * @param int $priority The relative importance of the URI * @param bool $enabled Whether the URL is enabled * @param string $friendlyName A string to describe the resource * @param string $sipUrl The SIP address you want Twilio to route your * Origination calls to * @return OriginationUrlInstance Created OriginationUrlInstance * @throws TwilioException When an HTTP error occurs. */ public function create(int $weight, int $priority, bool $enabled, string $friendlyName, string $sipUrl): OriginationUrlInstance { $data = Values::of([ 'Weight' => $weight, 'Priority' => $priority, 'Enabled' => Serialize::booleanToString($enabled), 'FriendlyName' => $friendlyName, 'SipUrl' => $sipUrl, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new OriginationUrlInstance($this->version, $payload, $this->solution['trunkSid']); } /** * Streams OriginationUrlInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads OriginationUrlInstance 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 OriginationUrlInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of OriginationUrlInstance 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 OriginationUrlPage Page of OriginationUrlInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): OriginationUrlPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new OriginationUrlPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of OriginationUrlInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return OriginationUrlPage Page of OriginationUrlInstance */ public function getPage(string $targetUrl): OriginationUrlPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new OriginationUrlPage($this->version, $response, $this->solution); } /** * Constructs a OriginationUrlContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): OriginationUrlContext { return new OriginationUrlContext($this->version, $this->solution['trunkSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trunking.V1.OriginationUrlList]'; } }src/Twilio/Rest/Trunking/V1/Trunk/IpAccessControlListContext.php000064400000004224150515725670020675 0ustar00solution = ['trunkSid' => $trunkSid, 'sid' => $sid, ]; $this->uri = '/Trunks/' . \rawurlencode($trunkSid) . '/IpAccessControlLists/' . \rawurlencode($sid) . ''; } /** * Fetch the IpAccessControlListInstance * * @return IpAccessControlListInstance Fetched IpAccessControlListInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): IpAccessControlListInstance { $payload = $this->version->fetch('GET', $this->uri); return new IpAccessControlListInstance( $this->version, $payload, $this->solution['trunkSid'], $this->solution['sid'] ); } /** * Delete the IpAccessControlListInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trunking.V1.IpAccessControlListContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trunking/V1/Trunk/PhoneNumberContext.php000064400000004102150515725670017223 0ustar00solution = ['trunkSid' => $trunkSid, 'sid' => $sid, ]; $this->uri = '/Trunks/' . \rawurlencode($trunkSid) . '/PhoneNumbers/' . \rawurlencode($sid) . ''; } /** * Fetch the PhoneNumberInstance * * @return PhoneNumberInstance Fetched PhoneNumberInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): PhoneNumberInstance { $payload = $this->version->fetch('GET', $this->uri); return new PhoneNumberInstance( $this->version, $payload, $this->solution['trunkSid'], $this->solution['sid'] ); } /** * Delete the PhoneNumberInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trunking.V1.PhoneNumberContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trunking/V1/Trunk/CredentialListList.php000064400000013113150515725670017200 0ustar00solution = ['trunkSid' => $trunkSid, ]; $this->uri = '/Trunks/' . \rawurlencode($trunkSid) . '/CredentialLists'; } /** * Create the CredentialListInstance * * @param string $credentialListSid The SID of the Credential List that you * want to associate with the trunk * @return CredentialListInstance Created CredentialListInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $credentialListSid): CredentialListInstance { $data = Values::of(['CredentialListSid' => $credentialListSid, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new CredentialListInstance($this->version, $payload, $this->solution['trunkSid']); } /** * Streams CredentialListInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads CredentialListInstance 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 CredentialListInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of CredentialListInstance 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 CredentialListPage Page of CredentialListInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): CredentialListPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new CredentialListPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of CredentialListInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return CredentialListPage Page of CredentialListInstance */ public function getPage(string $targetUrl): CredentialListPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new CredentialListPage($this->version, $response, $this->solution); } /** * Constructs a CredentialListContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): CredentialListContext { return new CredentialListContext($this->version, $this->solution['trunkSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trunking.V1.CredentialListList]'; } }src/Twilio/Rest/Trunking/V1/Trunk/RecordingOptions.php000064400000004014150515725670016726 0ustar00options['mode'] = $mode; $this->options['trim'] = $trim; } /** * The recording mode for the trunk. Can be do-not-record (default), record-from-ringing, record-from-answer, record-from-ringing-dual, or record-from-answer-dual. * * @param string $mode The recording mode for the trunk. * @return $this Fluent Builder */ public function setMode(string $mode): self { $this->options['mode'] = $mode; return $this; } /** * The recording trim setting for the trunk. Can be do-not-trim (default) or trim-silence. * * @param string $trim The recording trim setting for the trunk. * @return $this Fluent Builder */ public function setTrim(string $trim): self { $this->options['trim'] = $trim; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Trunking.V1.UpdateRecordingOptions ' . $options . ']'; } }src/Twilio/Rest/Trunking/V1/Trunk/IpAccessControlListInstance.php000064400000007622150515725670021022 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'sid' => Values::array_get($payload, 'sid'), 'trunkSid' => Values::array_get($payload, 'trunk_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 = ['trunkSid' => $trunkSid, '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 IpAccessControlListContext Context for this * IpAccessControlListInstance */ protected function proxy(): IpAccessControlListContext { if (!$this->context) { $this->context = new IpAccessControlListContext( $this->version, $this->solution['trunkSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the IpAccessControlListInstance * * @return IpAccessControlListInstance Fetched IpAccessControlListInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): IpAccessControlListInstance { return $this->proxy()->fetch(); } /** * Delete the IpAccessControlListInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trunking.V1.IpAccessControlListInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trunking/V1/Trunk/IpAccessControlListList.php000064400000013366150515725670020173 0ustar00solution = ['trunkSid' => $trunkSid, ]; $this->uri = '/Trunks/' . \rawurlencode($trunkSid) . '/IpAccessControlLists'; } /** * Create the IpAccessControlListInstance * * @param string $ipAccessControlListSid The SID of the IP Access Control List * that you want to associate with the * trunk * @return IpAccessControlListInstance Created IpAccessControlListInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $ipAccessControlListSid): IpAccessControlListInstance { $data = Values::of(['IpAccessControlListSid' => $ipAccessControlListSid, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new IpAccessControlListInstance($this->version, $payload, $this->solution['trunkSid']); } /** * Streams IpAccessControlListInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads IpAccessControlListInstance 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 IpAccessControlListInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of IpAccessControlListInstance 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 IpAccessControlListPage Page of IpAccessControlListInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): IpAccessControlListPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new IpAccessControlListPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of IpAccessControlListInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return IpAccessControlListPage Page of IpAccessControlListInstance */ public function getPage(string $targetUrl): IpAccessControlListPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new IpAccessControlListPage($this->version, $response, $this->solution); } /** * Constructs a IpAccessControlListContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): IpAccessControlListContext { return new IpAccessControlListContext($this->version, $this->solution['trunkSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trunking.V1.IpAccessControlListList]'; } }src/Twilio/Rest/Trunking/V1/Trunk/CredentialListInstance.php000064400000007522150515725670020040 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'sid' => Values::array_get($payload, 'sid'), 'trunkSid' => Values::array_get($payload, 'trunk_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 = ['trunkSid' => $trunkSid, '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 CredentialListContext Context for this CredentialListInstance */ protected function proxy(): CredentialListContext { if (!$this->context) { $this->context = new CredentialListContext( $this->version, $this->solution['trunkSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the CredentialListInstance * * @return CredentialListInstance Fetched CredentialListInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CredentialListInstance { return $this->proxy()->fetch(); } /** * Delete the CredentialListInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trunking.V1.CredentialListInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trunking/V1/Trunk/RecordingList.php000064400000002047150515725670016212 0ustar00solution = ['trunkSid' => $trunkSid, ]; } /** * Constructs a RecordingContext */ public function getContext(): RecordingContext { return new RecordingContext($this->version, $this->solution['trunkSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trunking.V1.RecordingList]'; } }src/Twilio/Rest/Trunking/V1/Trunk/PhoneNumberPage.php000064400000002300150515725670016451 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return PhoneNumberInstance \Twilio\Rest\Trunking\V1\Trunk\PhoneNumberInstance */ public function buildInstance(array $payload): PhoneNumberInstance { return new PhoneNumberInstance($this->version, $payload, $this->solution['trunkSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trunking.V1.PhoneNumberPage]'; } }src/Twilio/Rest/Trunking/V1/Trunk/OriginationUrlOptions.php000064400000010777150515725670017774 0ustar00options['weight'] = $weight; $this->options['priority'] = $priority; $this->options['enabled'] = $enabled; $this->options['friendlyName'] = $friendlyName; $this->options['sipUrl'] = $sipUrl; } /** * The value that determines the relative share of the load the URI should receive compared to other URIs with the same priority. Can be an integer from 1 to 65535, inclusive, and the default is 10. URLs with higher values receive more load than those with lower ones with the same priority. * * @param int $weight The value that determines the relative load the URI * should receive compared to others with the same priority * @return $this Fluent Builder */ public function setWeight(int $weight): self { $this->options['weight'] = $weight; return $this; } /** * The relative importance of the URI. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important URI. * * @param int $priority The relative importance of the URI * @return $this Fluent Builder */ public function setPriority(int $priority): self { $this->options['priority'] = $priority; return $this; } /** * Whether the URL is enabled. The default is `true`. * * @param bool $enabled Whether the URL is enabled * @return $this Fluent Builder */ public function setEnabled(bool $enabled): self { $this->options['enabled'] = $enabled; return $this; } /** * A descriptive string that you create to describe the resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The SIP address you want Twilio to route your Origination calls to. This must be a `sip:` schema. `sips` is NOT supported. * * @param string $sipUrl The SIP address you want Twilio to route your * Origination calls to * @return $this Fluent Builder */ public function setSipUrl(string $sipUrl): self { $this->options['sipUrl'] = $sipUrl; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Trunking.V1.UpdateOriginationUrlOptions ' . $options . ']'; } }src/Twilio/Rest/Trunking/V1/Trunk/IpAccessControlListPage.php000064400000002360150515725670020124 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return IpAccessControlListInstance \Twilio\Rest\Trunking\V1\Trunk\IpAccessControlListInstance */ public function buildInstance(array $payload): IpAccessControlListInstance { return new IpAccessControlListInstance($this->version, $payload, $this->solution['trunkSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trunking.V1.IpAccessControlListPage]'; } }src/Twilio/Rest/Trunking/V1/Trunk/RecordingContext.php000064400000004270150515725670016723 0ustar00solution = ['trunkSid' => $trunkSid, ]; $this->uri = '/Trunks/' . \rawurlencode($trunkSid) . '/Recording'; } /** * Fetch the RecordingInstance * * @return RecordingInstance Fetched RecordingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RecordingInstance { $payload = $this->version->fetch('GET', $this->uri); return new RecordingInstance($this->version, $payload, $this->solution['trunkSid']); } /** * Update the RecordingInstance * * @param array|Options $options Optional Arguments * @return RecordingInstance Updated RecordingInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): RecordingInstance { $options = new Values($options); $data = Values::of(['Mode' => $options['mode'], 'Trim' => $options['trim'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new RecordingInstance($this->version, $payload, $this->solution['trunkSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trunking.V1.RecordingContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trunking/V1/Trunk/OriginationUrlPage.php000064400000002322150515725670017200 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return OriginationUrlInstance \Twilio\Rest\Trunking\V1\Trunk\OriginationUrlInstance */ public function buildInstance(array $payload): OriginationUrlInstance { return new OriginationUrlInstance($this->version, $payload, $this->solution['trunkSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trunking.V1.OriginationUrlPage]'; } }src/Twilio/Rest/Trunking/V1/Trunk/CredentialListContext.php000064400000004133150515725670017713 0ustar00solution = ['trunkSid' => $trunkSid, 'sid' => $sid, ]; $this->uri = '/Trunks/' . \rawurlencode($trunkSid) . '/CredentialLists/' . \rawurlencode($sid) . ''; } /** * Fetch the CredentialListInstance * * @return CredentialListInstance Fetched CredentialListInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CredentialListInstance { $payload = $this->version->fetch('GET', $this->uri); return new CredentialListInstance( $this->version, $payload, $this->solution['trunkSid'], $this->solution['sid'] ); } /** * Delete the CredentialListInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trunking.V1.CredentialListContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trunking/V1/Trunk/RecordingInstance.php000064400000006052150515725670017043 0ustar00properties = [ 'mode' => Values::array_get($payload, 'mode'), 'trim' => Values::array_get($payload, 'trim'), ]; $this->solution = ['trunkSid' => $trunkSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return RecordingContext Context for this RecordingInstance */ protected function proxy(): RecordingContext { if (!$this->context) { $this->context = new RecordingContext($this->version, $this->solution['trunkSid']); } return $this->context; } /** * Fetch the RecordingInstance * * @return RecordingInstance Fetched RecordingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RecordingInstance { return $this->proxy()->fetch(); } /** * Update the RecordingInstance * * @param array|Options $options Optional Arguments * @return RecordingInstance Updated RecordingInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): RecordingInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trunking.V1.RecordingInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trunking/V1/Trunk/RecordingPage.php000064400000002264150515725670016154 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return RecordingInstance \Twilio\Rest\Trunking\V1\Trunk\RecordingInstance */ public function buildInstance(array $payload): RecordingInstance { return new RecordingInstance($this->version, $payload, $this->solution['trunkSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trunking.V1.RecordingPage]'; } }src/Twilio/Rest/Trunking/V1/Trunk/OriginationUrlInstance.php000064400000011045150515725670020072 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'sid' => Values::array_get($payload, 'sid'), 'trunkSid' => Values::array_get($payload, 'trunk_sid'), 'weight' => Values::array_get($payload, 'weight'), 'enabled' => Values::array_get($payload, 'enabled'), 'sipUrl' => Values::array_get($payload, 'sip_url'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'priority' => Values::array_get($payload, 'priority'), '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 = ['trunkSid' => $trunkSid, '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 OriginationUrlContext Context for this OriginationUrlInstance */ protected function proxy(): OriginationUrlContext { if (!$this->context) { $this->context = new OriginationUrlContext( $this->version, $this->solution['trunkSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the OriginationUrlInstance * * @return OriginationUrlInstance Fetched OriginationUrlInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): OriginationUrlInstance { return $this->proxy()->fetch(); } /** * Delete the OriginationUrlInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the OriginationUrlInstance * * @param array|Options $options Optional Arguments * @return OriginationUrlInstance Updated OriginationUrlInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): OriginationUrlInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trunking.V1.OriginationUrlInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trunking/V1/Trunk/PhoneNumberInstance.php000064400000013632150515725670017353 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'addressRequirements' => Values::array_get($payload, 'address_requirements'), 'apiVersion' => Values::array_get($payload, 'api_version'), 'beta' => Values::array_get($payload, 'beta'), 'capabilities' => Values::array_get($payload, 'capabilities'), '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'), 'links' => Values::array_get($payload, 'links'), 'phoneNumber' => Values::array_get($payload, 'phone_number'), 'sid' => Values::array_get($payload, 'sid'), 'smsApplicationSid' => Values::array_get($payload, 'sms_application_sid'), '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'), 'statusCallback' => Values::array_get($payload, 'status_callback'), 'statusCallbackMethod' => Values::array_get($payload, 'status_callback_method'), 'trunkSid' => Values::array_get($payload, 'trunk_sid'), 'url' => Values::array_get($payload, 'url'), 'voiceApplicationSid' => Values::array_get($payload, 'voice_application_sid'), '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 = ['trunkSid' => $trunkSid, '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 PhoneNumberContext Context for this PhoneNumberInstance */ protected function proxy(): PhoneNumberContext { if (!$this->context) { $this->context = new PhoneNumberContext( $this->version, $this->solution['trunkSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the PhoneNumberInstance * * @return PhoneNumberInstance Fetched PhoneNumberInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): PhoneNumberInstance { return $this->proxy()->fetch(); } /** * Delete the PhoneNumberInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trunking.V1.PhoneNumberInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trunking/V1/Trunk/CredentialListPage.php000064400000002322150515725670017141 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CredentialListInstance \Twilio\Rest\Trunking\V1\Trunk\CredentialListInstance */ public function buildInstance(array $payload): CredentialListInstance { return new CredentialListInstance($this->version, $payload, $this->solution['trunkSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trunking.V1.CredentialListPage]'; } }src/Twilio/Rest/Trunking/V1/Trunk/OriginationUrlContext.php000064400000006051150515725670017753 0ustar00solution = ['trunkSid' => $trunkSid, 'sid' => $sid, ]; $this->uri = '/Trunks/' . \rawurlencode($trunkSid) . '/OriginationUrls/' . \rawurlencode($sid) . ''; } /** * Fetch the OriginationUrlInstance * * @return OriginationUrlInstance Fetched OriginationUrlInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): OriginationUrlInstance { $payload = $this->version->fetch('GET', $this->uri); return new OriginationUrlInstance( $this->version, $payload, $this->solution['trunkSid'], $this->solution['sid'] ); } /** * Delete the OriginationUrlInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the OriginationUrlInstance * * @param array|Options $options Optional Arguments * @return OriginationUrlInstance Updated OriginationUrlInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): OriginationUrlInstance { $options = new Values($options); $data = Values::of([ 'Weight' => $options['weight'], 'Priority' => $options['priority'], 'Enabled' => Serialize::booleanToString($options['enabled']), 'FriendlyName' => $options['friendlyName'], 'SipUrl' => $options['sipUrl'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new OriginationUrlInstance( $this->version, $payload, $this->solution['trunkSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trunking.V1.OriginationUrlContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trunking/V1/Trunk/PhoneNumberList.php000064400000012767150515725670016532 0ustar00solution = ['trunkSid' => $trunkSid, ]; $this->uri = '/Trunks/' . \rawurlencode($trunkSid) . '/PhoneNumbers'; } /** * Create the PhoneNumberInstance * * @param string $phoneNumberSid The SID of the Incoming Phone Number that you * want to associate with the trunk * @return PhoneNumberInstance Created PhoneNumberInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $phoneNumberSid): PhoneNumberInstance { $data = Values::of(['PhoneNumberSid' => $phoneNumberSid, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new PhoneNumberInstance($this->version, $payload, $this->solution['trunkSid']); } /** * Streams PhoneNumberInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads PhoneNumberInstance 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 PhoneNumberInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of PhoneNumberInstance 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 PhoneNumberPage Page of PhoneNumberInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): PhoneNumberPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new PhoneNumberPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of PhoneNumberInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return PhoneNumberPage Page of PhoneNumberInstance */ public function getPage(string $targetUrl): PhoneNumberPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new PhoneNumberPage($this->version, $response, $this->solution); } /** * Constructs a PhoneNumberContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): PhoneNumberContext { return new PhoneNumberContext($this->version, $this->solution['trunkSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trunking.V1.PhoneNumberList]'; } }src/Twilio/Rest/Trunking/V1/TrunkOptions.php000064400000040551150515725670015020 0ustar00options['friendlyName'] = $friendlyName; $this->options['domainName'] = $domainName; $this->options['disasterRecoveryUrl'] = $disasterRecoveryUrl; $this->options['disasterRecoveryMethod'] = $disasterRecoveryMethod; $this->options['transferMode'] = $transferMode; $this->options['secure'] = $secure; $this->options['cnamLookupEnabled'] = $cnamLookupEnabled; $this->options['transferCallerId'] = $transferCallerId; } /** * A descriptive string that you create to describe the resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and `-` and must end with `pstn.twilio.com`. See [Termination Settings](https://www.twilio.com/docs/sip-trunking#termination) for more information. * * @param string $domainName The unique address you reserve on Twilio to which * you route your SIP traffic * @return $this Fluent Builder */ public function setDomainName(string $domainName): self { $this->options['domainName'] = $domainName; return $this; } /** * The URL we should call using the `disaster_recovery_method` if an error occurs while sending SIP traffic towards the configured Origination URL. We retrieve TwiML from the URL and execute the instructions like any other normal TwiML call. See [Disaster Recovery](https://www.twilio.com/docs/sip-trunking#disaster-recovery) for more information. * * @param string $disasterRecoveryUrl The HTTP URL that we should call if an * error occurs while sending SIP traffic * towards your configured Origination URL * @return $this Fluent Builder */ public function setDisasterRecoveryUrl(string $disasterRecoveryUrl): self { $this->options['disasterRecoveryUrl'] = $disasterRecoveryUrl; return $this; } /** * The HTTP method we should use to call the `disaster_recovery_url`. Can be: `GET` or `POST`. * * @param string $disasterRecoveryMethod The HTTP method we should use to call * the disaster_recovery_url * @return $this Fluent Builder */ public function setDisasterRecoveryMethod(string $disasterRecoveryMethod): self { $this->options['disasterRecoveryMethod'] = $disasterRecoveryMethod; return $this; } /** * The call transfer settings for the trunk. Can be: `enable-all`, `sip-only` and `disable-all`. See [Transfer](https://www.twilio.com/docs/sip-trunking/call-transfer) for more information. * * @param string $transferMode The call transfer settings for the trunk * @return $this Fluent Builder */ public function setTransferMode(string $transferMode): self { $this->options['transferMode'] = $transferMode; return $this; } /** * Whether Secure Trunking is enabled for the trunk. If enabled, all calls going through the trunk will be secure using SRTP for media and TLS for signaling. If disabled, then RTP will be used for media. See [Secure Trunking](https://www.twilio.com/docs/sip-trunking#securetrunking) for more information. * * @param bool $secure Whether Secure Trunking is enabled for the trunk * @return $this Fluent Builder */ public function setSecure(bool $secure): self { $this->options['secure'] = $secure; return $this; } /** * Whether Caller ID Name (CNAM) lookup should be enabled for the trunk. If enabled, all inbound calls to the SIP Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information. * * @param bool $cnamLookupEnabled Whether Caller ID Name (CNAM) lookup should * be enabled for the trunk * @return $this Fluent Builder */ public function setCnamLookupEnabled(bool $cnamLookupEnabled): self { $this->options['cnamLookupEnabled'] = $cnamLookupEnabled; return $this; } /** * Caller Id for transfer target. Can be: `from-transferee` (default) or `from-transferor`. * * @param string $transferCallerId Caller Id for transfer target * @return $this Fluent Builder */ public function setTransferCallerId(string $transferCallerId): self { $this->options['transferCallerId'] = $transferCallerId; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Trunking.V1.CreateTrunkOptions ' . $options . ']'; } } class UpdateTrunkOptions extends Options { /** * @param string $friendlyName A string to describe the resource * @param string $domainName The unique address you reserve on Twilio to which * you route your SIP traffic * @param string $disasterRecoveryUrl The HTTP URL that we should call if an * error occurs while sending SIP traffic * towards your configured Origination URL * @param string $disasterRecoveryMethod The HTTP method we should use to call * the disaster_recovery_url * @param string $transferMode The call transfer settings for the trunk * @param bool $secure Whether Secure Trunking is enabled for the trunk * @param bool $cnamLookupEnabled Whether Caller ID Name (CNAM) lookup should * be enabled for the trunk * @param string $transferCallerId Caller Id for transfer target */ public function __construct(string $friendlyName = Values::NONE, string $domainName = Values::NONE, string $disasterRecoveryUrl = Values::NONE, string $disasterRecoveryMethod = Values::NONE, string $transferMode = Values::NONE, bool $secure = Values::NONE, bool $cnamLookupEnabled = Values::NONE, string $transferCallerId = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['domainName'] = $domainName; $this->options['disasterRecoveryUrl'] = $disasterRecoveryUrl; $this->options['disasterRecoveryMethod'] = $disasterRecoveryMethod; $this->options['transferMode'] = $transferMode; $this->options['secure'] = $secure; $this->options['cnamLookupEnabled'] = $cnamLookupEnabled; $this->options['transferCallerId'] = $transferCallerId; } /** * A descriptive string that you create to describe the resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and `-` and must end with `pstn.twilio.com`. See [Termination Settings](https://www.twilio.com/docs/sip-trunking#termination) for more information. * * @param string $domainName The unique address you reserve on Twilio to which * you route your SIP traffic * @return $this Fluent Builder */ public function setDomainName(string $domainName): self { $this->options['domainName'] = $domainName; return $this; } /** * The URL we should call using the `disaster_recovery_method` if an error occurs while sending SIP traffic towards the configured Origination URL. We retrieve TwiML from the URL and execute the instructions like any other normal TwiML call. See [Disaster Recovery](https://www.twilio.com/docs/sip-trunking#disaster-recovery) for more information. * * @param string $disasterRecoveryUrl The HTTP URL that we should call if an * error occurs while sending SIP traffic * towards your configured Origination URL * @return $this Fluent Builder */ public function setDisasterRecoveryUrl(string $disasterRecoveryUrl): self { $this->options['disasterRecoveryUrl'] = $disasterRecoveryUrl; return $this; } /** * The HTTP method we should use to call the `disaster_recovery_url`. Can be: `GET` or `POST`. * * @param string $disasterRecoveryMethod The HTTP method we should use to call * the disaster_recovery_url * @return $this Fluent Builder */ public function setDisasterRecoveryMethod(string $disasterRecoveryMethod): self { $this->options['disasterRecoveryMethod'] = $disasterRecoveryMethod; return $this; } /** * The call transfer settings for the trunk. Can be: `enable-all`, `sip-only` and `disable-all`. See [Transfer](https://www.twilio.com/docs/sip-trunking/call-transfer) for more information. * * @param string $transferMode The call transfer settings for the trunk * @return $this Fluent Builder */ public function setTransferMode(string $transferMode): self { $this->options['transferMode'] = $transferMode; return $this; } /** * Whether Secure Trunking is enabled for the trunk. If enabled, all calls going through the trunk will be secure using SRTP for media and TLS for signaling. If disabled, then RTP will be used for media. See [Secure Trunking](https://www.twilio.com/docs/sip-trunking#securetrunking) for more information. * * @param bool $secure Whether Secure Trunking is enabled for the trunk * @return $this Fluent Builder */ public function setSecure(bool $secure): self { $this->options['secure'] = $secure; return $this; } /** * Whether Caller ID Name (CNAM) lookup should be enabled for the trunk. If enabled, all inbound calls to the SIP Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information. * * @param bool $cnamLookupEnabled Whether Caller ID Name (CNAM) lookup should * be enabled for the trunk * @return $this Fluent Builder */ public function setCnamLookupEnabled(bool $cnamLookupEnabled): self { $this->options['cnamLookupEnabled'] = $cnamLookupEnabled; return $this; } /** * Caller Id for transfer target. Can be: `from-transferee` (default) or `from-transferor`. * * @param string $transferCallerId Caller Id for transfer target * @return $this Fluent Builder */ public function setTransferCallerId(string $transferCallerId): self { $this->options['transferCallerId'] = $transferCallerId; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Trunking.V1.UpdateTrunkOptions ' . $options . ']'; } }src/Twilio/Rest/Trunking/V1/TrunkPage.php000064400000002163150515725670014236 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return TrunkInstance \Twilio\Rest\Trunking\V1\TrunkInstance */ public function buildInstance(array $payload): TrunkInstance { return new TrunkInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trunking.V1.TrunkPage]'; } }src/Twilio/Rest/Trunking/V1/TrunkInstance.php000064400000014245150515725670015132 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'domainName' => Values::array_get($payload, 'domain_name'), 'disasterRecoveryMethod' => Values::array_get($payload, 'disaster_recovery_method'), 'disasterRecoveryUrl' => Values::array_get($payload, 'disaster_recovery_url'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'secure' => Values::array_get($payload, 'secure'), 'recording' => Values::array_get($payload, 'recording'), 'transferMode' => Values::array_get($payload, 'transfer_mode'), 'transferCallerId' => Values::array_get($payload, 'transfer_caller_id'), 'cnamLookupEnabled' => Values::array_get($payload, 'cnam_lookup_enabled'), 'authType' => Values::array_get($payload, 'auth_type'), 'authTypeSet' => Values::array_get($payload, 'auth_type_set'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'sid' => Values::array_get($payload, 'sid'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 TrunkContext Context for this TrunkInstance */ protected function proxy(): TrunkContext { if (!$this->context) { $this->context = new TrunkContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the TrunkInstance * * @return TrunkInstance Fetched TrunkInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TrunkInstance { return $this->proxy()->fetch(); } /** * Delete the TrunkInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the TrunkInstance * * @param array|Options $options Optional Arguments * @return TrunkInstance Updated TrunkInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): TrunkInstance { return $this->proxy()->update($options); } /** * Access the originationUrls */ protected function getOriginationUrls(): OriginationUrlList { return $this->proxy()->originationUrls; } /** * Access the credentialsLists */ protected function getCredentialsLists(): CredentialListList { return $this->proxy()->credentialsLists; } /** * Access the ipAccessControlLists */ protected function getIpAccessControlLists(): IpAccessControlListList { return $this->proxy()->ipAccessControlLists; } /** * Access the phoneNumbers */ protected function getPhoneNumbers(): PhoneNumberList { return $this->proxy()->phoneNumbers; } /** * Access the recordings */ protected function getRecordings(): RecordingList { return $this->proxy()->recordings; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trunking.V1.TrunkInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trunking/V1/TrunkContext.php000064400000015074150515725670015013 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Trunks/' . \rawurlencode($sid) . ''; } /** * Fetch the TrunkInstance * * @return TrunkInstance Fetched TrunkInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): TrunkInstance { $payload = $this->version->fetch('GET', $this->uri); return new TrunkInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the TrunkInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the TrunkInstance * * @param array|Options $options Optional Arguments * @return TrunkInstance Updated TrunkInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): TrunkInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'DomainName' => $options['domainName'], 'DisasterRecoveryUrl' => $options['disasterRecoveryUrl'], 'DisasterRecoveryMethod' => $options['disasterRecoveryMethod'], 'TransferMode' => $options['transferMode'], 'Secure' => Serialize::booleanToString($options['secure']), 'CnamLookupEnabled' => Serialize::booleanToString($options['cnamLookupEnabled']), 'TransferCallerId' => $options['transferCallerId'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new TrunkInstance($this->version, $payload, $this->solution['sid']); } /** * Access the originationUrls */ protected function getOriginationUrls(): OriginationUrlList { if (!$this->_originationUrls) { $this->_originationUrls = new OriginationUrlList($this->version, $this->solution['sid']); } return $this->_originationUrls; } /** * Access the credentialsLists */ protected function getCredentialsLists(): CredentialListList { if (!$this->_credentialsLists) { $this->_credentialsLists = new CredentialListList($this->version, $this->solution['sid']); } return $this->_credentialsLists; } /** * Access the ipAccessControlLists */ protected function getIpAccessControlLists(): IpAccessControlListList { if (!$this->_ipAccessControlLists) { $this->_ipAccessControlLists = new IpAccessControlListList($this->version, $this->solution['sid']); } return $this->_ipAccessControlLists; } /** * Access the phoneNumbers */ protected function getPhoneNumbers(): PhoneNumberList { if (!$this->_phoneNumbers) { $this->_phoneNumbers = new PhoneNumberList($this->version, $this->solution['sid']); } return $this->_phoneNumbers; } /** * Access the recordings */ protected function getRecordings(): RecordingList { if (!$this->_recordings) { $this->_recordings = new RecordingList($this->version, $this->solution['sid']); } return $this->_recordings; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Trunking.V1.TrunkContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Trunking/V1/TrunkList.php000064400000013104150515725670014272 0ustar00solution = []; $this->uri = '/Trunks'; } /** * Create the TrunkInstance * * @param array|Options $options Optional Arguments * @return TrunkInstance Created TrunkInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): TrunkInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'DomainName' => $options['domainName'], 'DisasterRecoveryUrl' => $options['disasterRecoveryUrl'], 'DisasterRecoveryMethod' => $options['disasterRecoveryMethod'], 'TransferMode' => $options['transferMode'], 'Secure' => Serialize::booleanToString($options['secure']), 'CnamLookupEnabled' => Serialize::booleanToString($options['cnamLookupEnabled']), 'TransferCallerId' => $options['transferCallerId'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new TrunkInstance($this->version, $payload); } /** * Streams TrunkInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads TrunkInstance 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 TrunkInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of TrunkInstance 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 TrunkPage Page of TrunkInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): TrunkPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new TrunkPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of TrunkInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return TrunkPage Page of TrunkInstance */ public function getPage(string $targetUrl): TrunkPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new TrunkPage($this->version, $response, $this->solution); } /** * Constructs a TrunkContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): TrunkContext { return new TrunkContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trunking.V1.TrunkList]'; } }src/Twilio/Rest/Trunking/V1.php000064400000004222150515725670012334 0ustar00version = 'v1'; } protected function getTrunks(): TrunkList { if (!$this->_trunks) { $this->_trunks = new TrunkList($this); } return $this->_trunks; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Trunking.V1]'; } }src/Twilio/Rest/Accounts/V1/AuthTokenPromotionInstance.php000064400000006022150515725670017610 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'authToken' => Values::array_get($payload, 'auth_token'), '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 = []; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return AuthTokenPromotionContext Context for this AuthTokenPromotionInstance */ protected function proxy(): AuthTokenPromotionContext { if (!$this->context) { $this->context = new AuthTokenPromotionContext($this->version); } return $this->context; } /** * Update the AuthTokenPromotionInstance * * @return AuthTokenPromotionInstance Updated AuthTokenPromotionInstance * @throws TwilioException When an HTTP error occurs. */ public function update(): AuthTokenPromotionInstance { return $this->proxy()->update(); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Accounts.V1.AuthTokenPromotionInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Accounts/V1/AuthTokenPromotionList.php000064400000001701150515725670016756 0ustar00solution = []; } /** * Constructs a AuthTokenPromotionContext */ public function getContext(): AuthTokenPromotionContext { return new AuthTokenPromotionContext($this->version); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Accounts.V1.AuthTokenPromotionList]'; } }src/Twilio/Rest/Accounts/V1/CredentialList.php000064400000005347150515725670015231 0ustar00solution = []; } /** * Access the publicKey */ protected function getPublicKey(): PublicKeyList { if (!$this->_publicKey) { $this->_publicKey = new PublicKeyList($this->version); } return $this->_publicKey; } /** * Access the aws */ protected function getAws(): AwsList { 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 TwilioException For unknown subresources */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Accounts.V1.CredentialList]'; } }src/Twilio/Rest/Accounts/V1/Credential/PublicKeyOptions.php000064400000007072150515725670017635 0ustar00options['friendlyName'] = $friendlyName; $this->options['accountSid'] = $accountSid; } /** * A descriptive string that you create to describe the resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The SID of the Subaccount that this Credential should be associated with. Must 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(string $accountSid): self { $this->options['accountSid'] = $accountSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Accounts.V1.CreatePublicKeyOptions ' . $options . ']'; } } class UpdatePublicKeyOptions extends Options { /** * @param string $friendlyName A string to describe the resource */ public function __construct(string $friendlyName = Values::NONE) { $this->options['friendlyName'] = $friendlyName; } /** * A descriptive string that you create to describe the resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Accounts.V1.UpdatePublicKeyOptions ' . $options . ']'; } }src/Twilio/Rest/Accounts/V1/Credential/AwsList.php000064400000012564150515725670015762 0ustar00solution = []; $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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $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(int $limit = null, $pageSize = null): array { 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 AwsPage Page of AwsInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): AwsPage { $params = Values::of(['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 AwsPage Page of AwsInstance */ public function getPage(string $targetUrl): AwsPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new AwsPage($this->version, $response, $this->solution); } /** * Create the AwsInstance * * @param string $credentials A string that contains the AWS access credentials * in the format * : * @param array|Options $options Optional Arguments * @return AwsInstance Created AwsInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $credentials, array $options = []): AwsInstance { $options = new Values($options); $data = Values::of([ 'Credentials' => $credentials, 'FriendlyName' => $options['friendlyName'], 'AccountSid' => $options['accountSid'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new AwsInstance($this->version, $payload); } /** * Constructs a AwsContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): AwsContext { return new AwsContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Accounts.V1.AwsList]'; } }src/Twilio/Rest/Accounts/V1/Credential/AwsContext.php000064400000004443150515725670016470 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Credentials/AWS/' . \rawurlencode($sid) . ''; } /** * Fetch the AwsInstance * * @return AwsInstance Fetched AwsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AwsInstance { $payload = $this->version->fetch('GET', $this->uri); return new AwsInstance($this->version, $payload, $this->solution['sid']); } /** * Update the AwsInstance * * @param array|Options $options Optional Arguments * @return AwsInstance Updated AwsInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): AwsInstance { $options = new Values($options); $data = Values::of(['FriendlyName' => $options['friendlyName'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new AwsInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the AwsInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Accounts.V1.AwsContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Accounts/V1/Credential/PublicKeyContext.php000064400000004576150515725670017634 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Credentials/PublicKeys/' . \rawurlencode($sid) . ''; } /** * Fetch the PublicKeyInstance * * @return PublicKeyInstance Fetched PublicKeyInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): PublicKeyInstance { $payload = $this->version->fetch('GET', $this->uri); return new PublicKeyInstance($this->version, $payload, $this->solution['sid']); } /** * Update the PublicKeyInstance * * @param array|Options $options Optional Arguments * @return PublicKeyInstance Updated PublicKeyInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): PublicKeyInstance { $options = new Values($options); $data = Values::of(['FriendlyName' => $options['friendlyName'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new PublicKeyInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the PublicKeyInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Accounts.V1.PublicKeyContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Accounts/V1/Credential/PublicKeyInstance.php000064400000007462150515725670017751 0ustar00properties = [ '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 = ['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 PublicKeyContext Context for this PublicKeyInstance */ protected function proxy(): PublicKeyContext { if (!$this->context) { $this->context = new PublicKeyContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the PublicKeyInstance * * @return PublicKeyInstance Fetched PublicKeyInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): PublicKeyInstance { return $this->proxy()->fetch(); } /** * Update the PublicKeyInstance * * @param array|Options $options Optional Arguments * @return PublicKeyInstance Updated PublicKeyInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): PublicKeyInstance { return $this->proxy()->update($options); } /** * Delete the PublicKeyInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Accounts.V1.PublicKeyInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Accounts/V1/Credential/PublicKeyList.php000064400000012602150515725670017110 0ustar00solution = []; $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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $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(int $limit = null, $pageSize = null): array { 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 PublicKeyPage Page of PublicKeyInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): PublicKeyPage { $params = Values::of(['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 PublicKeyPage Page of PublicKeyInstance */ public function getPage(string $targetUrl): PublicKeyPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new PublicKeyPage($this->version, $response, $this->solution); } /** * Create the PublicKeyInstance * * @param string $publicKey A URL encoded representation of the public key * @param array|Options $options Optional Arguments * @return PublicKeyInstance Created PublicKeyInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $publicKey, array $options = []): PublicKeyInstance { $options = new Values($options); $data = Values::of([ 'PublicKey' => $publicKey, 'FriendlyName' => $options['friendlyName'], 'AccountSid' => $options['accountSid'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new PublicKeyInstance($this->version, $payload); } /** * Constructs a PublicKeyContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): PublicKeyContext { return new PublicKeyContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Accounts.V1.PublicKeyList]'; } }src/Twilio/Rest/Accounts/V1/Credential/AwsPage.php000064400000002175150515725670015720 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return AwsInstance \Twilio\Rest\Accounts\V1\Credential\AwsInstance */ public function buildInstance(array $payload): AwsInstance { return new AwsInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Accounts.V1.AwsPage]'; } }src/Twilio/Rest/Accounts/V1/Credential/AwsOptions.php000064400000006771150515725670016505 0ustar00options['friendlyName'] = $friendlyName; $this->options['accountSid'] = $accountSid; } /** * A descriptive string that you create to describe the resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The SID of the Subaccount that this Credential should be associated with. Must 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(string $accountSid): self { $this->options['accountSid'] = $accountSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Accounts.V1.CreateAwsOptions ' . $options . ']'; } } class UpdateAwsOptions extends Options { /** * @param string $friendlyName A string to describe the resource */ public function __construct(string $friendlyName = Values::NONE) { $this->options['friendlyName'] = $friendlyName; } /** * A descriptive string that you create to describe the resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Accounts.V1.UpdateAwsOptions ' . $options . ']'; } }src/Twilio/Rest/Accounts/V1/Credential/AwsInstance.php000064400000007322150515725670016607 0ustar00properties = [ '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 = ['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 AwsContext Context for this AwsInstance */ protected function proxy(): AwsContext { if (!$this->context) { $this->context = new AwsContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the AwsInstance * * @return AwsInstance Fetched AwsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AwsInstance { return $this->proxy()->fetch(); } /** * Update the AwsInstance * * @param array|Options $options Optional Arguments * @return AwsInstance Updated AwsInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): AwsInstance { return $this->proxy()->update($options); } /** * Delete the AwsInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Accounts.V1.AwsInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Accounts/V1/Credential/PublicKeyPage.php000064400000002241150515725670017047 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return PublicKeyInstance \Twilio\Rest\Accounts\V1\Credential\PublicKeyInstance */ public function buildInstance(array $payload): PublicKeyInstance { return new PublicKeyInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Accounts.V1.PublicKeyPage]'; } }src/Twilio/Rest/Accounts/V1/SecondaryAuthTokenPage.php000064400000002301150515725670016655 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SecondaryAuthTokenInstance \Twilio\Rest\Accounts\V1\SecondaryAuthTokenInstance */ public function buildInstance(array $payload): SecondaryAuthTokenInstance { return new SecondaryAuthTokenInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Accounts.V1.SecondaryAuthTokenPage]'; } }src/Twilio/Rest/Accounts/V1/AuthTokenPromotionContext.php000064400000002654150515725670017477 0ustar00solution = []; $this->uri = '/AuthTokens/Promote'; } /** * Update the AuthTokenPromotionInstance * * @return AuthTokenPromotionInstance Updated AuthTokenPromotionInstance * @throws TwilioException When an HTTP error occurs. */ public function update(): AuthTokenPromotionInstance { $payload = $this->version->update('POST', $this->uri); return new AuthTokenPromotionInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Accounts.V1.AuthTokenPromotionContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Accounts/V1/SecondaryAuthTokenInstance.php000064400000006476150515725670017566 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'secondaryAuthToken' => Values::array_get($payload, 'secondary_auth_token'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = []; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return SecondaryAuthTokenContext Context for this SecondaryAuthTokenInstance */ protected function proxy(): SecondaryAuthTokenContext { if (!$this->context) { $this->context = new SecondaryAuthTokenContext($this->version); } return $this->context; } /** * Create the SecondaryAuthTokenInstance * * @return SecondaryAuthTokenInstance Created SecondaryAuthTokenInstance * @throws TwilioException When an HTTP error occurs. */ public function create(): SecondaryAuthTokenInstance { return $this->proxy()->create(); } /** * Delete the SecondaryAuthTokenInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Accounts.V1.SecondaryAuthTokenInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Accounts/V1/SecondaryAuthTokenList.php000064400000001701150515725670016717 0ustar00solution = []; } /** * Constructs a SecondaryAuthTokenContext */ public function getContext(): SecondaryAuthTokenContext { return new SecondaryAuthTokenContext($this->version); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Accounts.V1.SecondaryAuthTokenList]'; } }src/Twilio/Rest/Accounts/V1/AuthTokenPromotionPage.php000064400000002301150515725670016714 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return AuthTokenPromotionInstance \Twilio\Rest\Accounts\V1\AuthTokenPromotionInstance */ public function buildInstance(array $payload): AuthTokenPromotionInstance { return new AuthTokenPromotionInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Accounts.V1.AuthTokenPromotionPage]'; } }src/Twilio/Rest/Accounts/V1/CredentialPage.php000064400000002221150515725670015156 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CredentialInstance \Twilio\Rest\Accounts\V1\CredentialInstance */ public function buildInstance(array $payload): CredentialInstance { return new CredentialInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Accounts.V1.CredentialPage]'; } }src/Twilio/Rest/Accounts/V1/SecondaryAuthTokenContext.php000064400000003322150515725670017431 0ustar00solution = []; $this->uri = '/AuthTokens/Secondary'; } /** * Create the SecondaryAuthTokenInstance * * @return SecondaryAuthTokenInstance Created SecondaryAuthTokenInstance * @throws TwilioException When an HTTP error occurs. */ public function create(): SecondaryAuthTokenInstance { $payload = $this->version->create('POST', $this->uri); return new SecondaryAuthTokenInstance($this->version, $payload); } /** * Delete the SecondaryAuthTokenInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Accounts.V1.SecondaryAuthTokenContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Accounts/V1/CredentialInstance.php000064400000002652150515725670016056 0ustar00solution = []; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Accounts.V1.CredentialInstance]'; } }src/Twilio/Rest/Accounts/V1.php000064400000005627150515725670012324 0ustar00version = 'v1'; } protected function getAuthTokenPromotion(): AuthTokenPromotionList { if (!$this->_authTokenPromotion) { $this->_authTokenPromotion = new AuthTokenPromotionList($this); } return $this->_authTokenPromotion; } protected function getCredentials(): CredentialList { if (!$this->_credentials) { $this->_credentials = new CredentialList($this); } return $this->_credentials; } protected function getSecondaryAuthToken(): SecondaryAuthTokenList { if (!$this->_secondaryAuthToken) { $this->_secondaryAuthToken = new SecondaryAuthTokenList($this); } return $this->_secondaryAuthToken; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Accounts.V1]'; } }src/Twilio/Rest/Sync.php000064400000004714150515725670011167 0ustar00baseUrl = 'https://sync.twilio.com'; } /** * @return V1 Version v1 of sync */ protected function getV1(): V1 { 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 TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } protected function getServices(): \Twilio\Rest\Sync\V1\ServiceList { return $this->v1->services; } /** * @param string $sid The SID of the Service resource to fetch */ protected function contextServices(string $sid): \Twilio\Rest\Sync\V1\ServiceContext { return $this->v1->services($sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Sync]'; } }src/Twilio/Rest/Wireless.php000064400000007150150515725670012045 0ustar00baseUrl = 'https://wireless.twilio.com'; } /** * @return V1 Version v1 of wireless */ protected function getV1(): V1 { 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 TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } protected function getUsageRecords(): \Twilio\Rest\Wireless\V1\UsageRecordList { return $this->v1->usageRecords; } protected function getCommands(): \Twilio\Rest\Wireless\V1\CommandList { return $this->v1->commands; } /** * @param string $sid The SID that identifies the resource to fetch */ protected function contextCommands(string $sid): \Twilio\Rest\Wireless\V1\CommandContext { return $this->v1->commands($sid); } protected function getRatePlans(): \Twilio\Rest\Wireless\V1\RatePlanList { return $this->v1->ratePlans; } /** * @param string $sid The SID that identifies the resource to fetch */ protected function contextRatePlans(string $sid): \Twilio\Rest\Wireless\V1\RatePlanContext { return $this->v1->ratePlans($sid); } protected function getSims(): \Twilio\Rest\Wireless\V1\SimList { return $this->v1->sims; } /** * @param string $sid The SID of the Sim resource to fetch */ protected function contextSims(string $sid): \Twilio\Rest\Wireless\V1\SimContext { return $this->v1->sims($sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Wireless]'; } }src/Twilio/Rest/Video/V1/RecordingSettingsOptions.php000064400000012341150515725670016613 0ustar00options['awsCredentialsSid'] = $awsCredentialsSid; $this->options['encryptionKeySid'] = $encryptionKeySid; $this->options['awsS3Url'] = $awsS3Url; $this->options['awsStorageEnabled'] = $awsStorageEnabled; $this->options['encryptionEnabled'] = $encryptionEnabled; } /** * The SID of the stored Credential resource. * * @param string $awsCredentialsSid The SID of the stored Credential resource * @return $this Fluent Builder */ public function setAwsCredentialsSid(string $awsCredentialsSid): self { $this->options['awsCredentialsSid'] = $awsCredentialsSid; return $this; } /** * The SID of the Public Key resource to use for encryption. * * @param string $encryptionKeySid The SID of the Public Key resource to use * for encryption * @return $this Fluent Builder */ public function setEncryptionKeySid(string $encryptionKeySid): self { $this->options['encryptionKeySid'] = $encryptionKeySid; return $this; } /** * The URL of the AWS S3 bucket where the recordings should be stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/recordings`, where `recordings` is the path in which you want the recordings to be stored. This URL accepts only URI-valid characters, as described in the RFC 3986. * * @param string $awsS3Url The URL of the AWS S3 bucket where the recordings * should be stored * @return $this Fluent Builder */ public function setAwsS3Url(string $awsS3Url): self { $this->options['awsS3Url'] = $awsS3Url; return $this; } /** * Whether all recordings should be written to the `aws_s3_url`. When `false`, all recordings are stored in our cloud. * * @param bool $awsStorageEnabled Whether all recordings should be written to * the aws_s3_url * @return $this Fluent Builder */ public function setAwsStorageEnabled(bool $awsStorageEnabled): self { $this->options['awsStorageEnabled'] = $awsStorageEnabled; return $this; } /** * Whether all recordings should be stored in an encrypted form. The default is `false`. * * @param bool $encryptionEnabled Whether all recordings should be stored in an * encrypted form * @return $this Fluent Builder */ public function setEncryptionEnabled(bool $encryptionEnabled): self { $this->options['encryptionEnabled'] = $encryptionEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Video.V1.CreateRecordingSettingsOptions ' . $options . ']'; } }src/Twilio/Rest/Video/V1/RoomPage.php000064400000002144150515725670013313 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return RoomInstance \Twilio\Rest\Video\V1\RoomInstance */ public function buildInstance(array $payload): RoomInstance { return new RoomInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Video.V1.RoomPage]'; } }src/Twilio/Rest/Video/V1/RecordingSettingsInstance.php000064400000007473150515725670016736 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'awsCredentialsSid' => Values::array_get($payload, 'aws_credentials_sid'), 'awsS3Url' => Values::array_get($payload, 'aws_s3_url'), 'awsStorageEnabled' => Values::array_get($payload, 'aws_storage_enabled'), 'encryptionKeySid' => Values::array_get($payload, 'encryption_key_sid'), 'encryptionEnabled' => Values::array_get($payload, 'encryption_enabled'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = []; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return RecordingSettingsContext Context for this RecordingSettingsInstance */ protected function proxy(): RecordingSettingsContext { if (!$this->context) { $this->context = new RecordingSettingsContext($this->version); } return $this->context; } /** * Fetch the RecordingSettingsInstance * * @return RecordingSettingsInstance Fetched RecordingSettingsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RecordingSettingsInstance { return $this->proxy()->fetch(); } /** * Create the RecordingSettingsInstance * * @param string $friendlyName A string to describe the resource * @param array|Options $options Optional Arguments * @return RecordingSettingsInstance Created RecordingSettingsInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, array $options = []): RecordingSettingsInstance { return $this->proxy()->create($friendlyName, $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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Video.V1.RecordingSettingsInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Video/V1/CompositionHookList.php000064400000015321150515725670015563 0ustar00solution = []; $this->uri = '/CompositionHooks'; } /** * Streams CompositionHookInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads CompositionHookInstance 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 CompositionHookInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of CompositionHookInstance 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 CompositionHookPage Page of CompositionHookInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): CompositionHookPage { $options = new Values($options); $params = Values::of([ 'Enabled' => Serialize::booleanToString($options['enabled']), 'DateCreatedAfter' => Serialize::iso8601DateTime($options['dateCreatedAfter']), 'DateCreatedBefore' => Serialize::iso8601DateTime($options['dateCreatedBefore']), 'FriendlyName' => $options['friendlyName'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new CompositionHookPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of CompositionHookInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return CompositionHookPage Page of CompositionHookInstance */ public function getPage(string $targetUrl): CompositionHookPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new CompositionHookPage($this->version, $response, $this->solution); } /** * Create the CompositionHookInstance * * @param string $friendlyName A unique string to describe the resource * @param array|Options $options Optional Arguments * @return CompositionHookInstance Created CompositionHookInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, array $options = []): CompositionHookInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $friendlyName, 'Enabled' => Serialize::booleanToString($options['enabled']), 'VideoLayout' => Serialize::jsonObject($options['videoLayout']), 'AudioSources' => Serialize::map($options['audioSources'], function($e) { return $e; }), 'AudioSourcesExcluded' => Serialize::map($options['audioSourcesExcluded'], function($e) { return $e; }), 'Resolution' => $options['resolution'], 'Format' => $options['format'], 'StatusCallback' => $options['statusCallback'], 'StatusCallbackMethod' => $options['statusCallbackMethod'], 'Trim' => Serialize::booleanToString($options['trim']), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new CompositionHookInstance($this->version, $payload); } /** * Constructs a CompositionHookContext * * @param string $sid The SID that identifies the resource to fetch */ public function getContext(string $sid): CompositionHookContext { return new CompositionHookContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Video.V1.CompositionHookList]'; } }src/Twilio/Rest/Video/V1/RecordingSettingsContext.php000064400000004774150515725670016617 0ustar00solution = []; $this->uri = '/RecordingSettings/Default'; } /** * Fetch the RecordingSettingsInstance * * @return RecordingSettingsInstance Fetched RecordingSettingsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RecordingSettingsInstance { $payload = $this->version->fetch('GET', $this->uri); return new RecordingSettingsInstance($this->version, $payload); } /** * Create the RecordingSettingsInstance * * @param string $friendlyName A string to describe the resource * @param array|Options $options Optional Arguments * @return RecordingSettingsInstance Created RecordingSettingsInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, array $options = []): RecordingSettingsInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $friendlyName, 'AwsCredentialsSid' => $options['awsCredentialsSid'], 'EncryptionKeySid' => $options['encryptionKeySid'], 'AwsS3Url' => $options['awsS3Url'], 'AwsStorageEnabled' => Serialize::booleanToString($options['awsStorageEnabled']), 'EncryptionEnabled' => Serialize::booleanToString($options['encryptionEnabled']), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new RecordingSettingsInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Video.V1.RecordingSettingsContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Video/V1/RecordingSettingsList.php000064400000001665150515725670016102 0ustar00solution = []; } /** * Constructs a RecordingSettingsContext */ public function getContext(): RecordingSettingsContext { return new RecordingSettingsContext($this->version); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Video.V1.RecordingSettingsList]'; } }src/Twilio/Rest/Video/V1/CompositionHookContext.php000064400000006325150515725670016300 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/CompositionHooks/' . \rawurlencode($sid) . ''; } /** * Fetch the CompositionHookInstance * * @return CompositionHookInstance Fetched CompositionHookInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CompositionHookInstance { $payload = $this->version->fetch('GET', $this->uri); return new CompositionHookInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the CompositionHookInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the CompositionHookInstance * * @param string $friendlyName A unique string to describe the resource * @param array|Options $options Optional Arguments * @return CompositionHookInstance Updated CompositionHookInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $friendlyName, array $options = []): CompositionHookInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $friendlyName, 'Enabled' => Serialize::booleanToString($options['enabled']), 'VideoLayout' => Serialize::jsonObject($options['videoLayout']), 'AudioSources' => Serialize::map($options['audioSources'], function($e) { return $e; }), 'AudioSourcesExcluded' => Serialize::map($options['audioSourcesExcluded'], function($e) { return $e; }), 'Trim' => Serialize::booleanToString($options['trim']), 'Format' => $options['format'], 'Resolution' => $options['resolution'], 'StatusCallback' => $options['statusCallback'], 'StatusCallbackMethod' => $options['statusCallbackMethod'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new CompositionHookInstance($this->version, $payload, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Video.V1.CompositionHookContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Video/V1/CompositionSettingsOptions.php000064400000012415150515725670017204 0ustar00options['awsCredentialsSid'] = $awsCredentialsSid; $this->options['encryptionKeySid'] = $encryptionKeySid; $this->options['awsS3Url'] = $awsS3Url; $this->options['awsStorageEnabled'] = $awsStorageEnabled; $this->options['encryptionEnabled'] = $encryptionEnabled; } /** * The SID of the stored Credential resource. * * @param string $awsCredentialsSid The SID of the stored Credential resource * @return $this Fluent Builder */ public function setAwsCredentialsSid(string $awsCredentialsSid): self { $this->options['awsCredentialsSid'] = $awsCredentialsSid; return $this; } /** * The SID of the Public Key resource to use for encryption. * * @param string $encryptionKeySid The SID of the Public Key resource to use * for encryption * @return $this Fluent Builder */ public function setEncryptionKeySid(string $encryptionKeySid): self { $this->options['encryptionKeySid'] = $encryptionKeySid; return $this; } /** * The URL of the AWS S3 bucket where the compositions should be stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/compositions`, where `compositions` is the path in which you want the compositions to be stored. This URL accepts only URI-valid characters, as described in the RFC 3986. * * @param string $awsS3Url The URL of the AWS S3 bucket where the compositions * should be stored * @return $this Fluent Builder */ public function setAwsS3Url(string $awsS3Url): self { $this->options['awsS3Url'] = $awsS3Url; return $this; } /** * Whether all compositions should be written to the `aws_s3_url`. When `false`, all compositions are stored in our cloud. * * @param bool $awsStorageEnabled Whether all compositions should be written to * the aws_s3_url * @return $this Fluent Builder */ public function setAwsStorageEnabled(bool $awsStorageEnabled): self { $this->options['awsStorageEnabled'] = $awsStorageEnabled; return $this; } /** * Whether all compositions should be stored in an encrypted form. The default is `false`. * * @param bool $encryptionEnabled Whether all compositions should be stored in * an encrypted form * @return $this Fluent Builder */ public function setEncryptionEnabled(bool $encryptionEnabled): self { $this->options['encryptionEnabled'] = $encryptionEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Video.V1.CreateCompositionSettingsOptions ' . $options . ']'; } }src/Twilio/Rest/Video/V1/RecordingOptions.php000064400000013745150515725670015103 0ustar00options['status'] = $status; $this->options['sourceSid'] = $sourceSid; $this->options['groupingSid'] = $groupingSid; $this->options['dateCreatedAfter'] = $dateCreatedAfter; $this->options['dateCreatedBefore'] = $dateCreatedBefore; $this->options['mediaType'] = $mediaType; } /** * Read only the recordings that have this status. Can be: `processing`, `completed`, or `deleted`. * * @param string $status Read only the recordings that have this status * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * Read only the recordings that have this `source_sid`. * * @param string $sourceSid Read only the recordings that have this source_sid * @return $this Fluent Builder */ public function setSourceSid(string $sourceSid): self { $this->options['sourceSid'] = $sourceSid; return $this; } /** * Read only recordings with this `grouping_sid`, which may include a `participant_sid` and/or a `room_sid`. * * @param string[] $groupingSid Read only recordings that have this grouping_sid * @return $this Fluent Builder */ public function setGroupingSid(array $groupingSid): self { $this->options['groupingSid'] = $groupingSid; return $this; } /** * Read only recordings that started on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time with time zone. * * @param \DateTime $dateCreatedAfter Read only recordings that started on or * after this [ISO * 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time with time zone * @return $this Fluent Builder */ public function setDateCreatedAfter(\DateTime $dateCreatedAfter): self { $this->options['dateCreatedAfter'] = $dateCreatedAfter; return $this; } /** * Read only recordings that started before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time with time zone, given as `YYYY-MM-DDThh:mm:ss+|-hh:mm` or `YYYY-MM-DDThh:mm:ssZ`. * * @param \DateTime $dateCreatedBefore Read only recordings that started before * this [ISO * 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time with time zone * @return $this Fluent Builder */ public function setDateCreatedBefore(\DateTime $dateCreatedBefore): self { $this->options['dateCreatedBefore'] = $dateCreatedBefore; return $this; } /** * Read only recordings that have this media type. Can be either `audio` or `video`. * * @param string $mediaType Read only recordings that have this media type * @return $this Fluent Builder */ public function setMediaType(string $mediaType): self { $this->options['mediaType'] = $mediaType; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Video.V1.ReadRecordingOptions ' . $options . ']'; } }src/Twilio/Rest/Video/V1/Room/RoomRecordingList.php000064400000012752150515725670016131 0ustar00solution = ['roomSid' => $roomSid, ]; $this->uri = '/Rooms/' . \rawurlencode($roomSid) . '/Recordings'; } /** * Streams RoomRecordingInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads RoomRecordingInstance 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 RoomRecordingInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of RoomRecordingInstance 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 RoomRecordingPage Page of RoomRecordingInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): RoomRecordingPage { $options = new Values($options); $params = Values::of([ 'Status' => $options['status'], 'SourceSid' => $options['sourceSid'], 'DateCreatedAfter' => Serialize::iso8601DateTime($options['dateCreatedAfter']), 'DateCreatedBefore' => Serialize::iso8601DateTime($options['dateCreatedBefore']), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new RoomRecordingPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of RoomRecordingInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return RoomRecordingPage Page of RoomRecordingInstance */ public function getPage(string $targetUrl): RoomRecordingPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new RoomRecordingPage($this->version, $response, $this->solution); } /** * Constructs a RoomRecordingContext * * @param string $sid The SID that identifies the resource to fetch */ public function getContext(string $sid): RoomRecordingContext { return new RoomRecordingContext($this->version, $this->solution['roomSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Video.V1.RoomRecordingList]'; } }src/Twilio/Rest/Video/V1/Room/RoomRecordingContext.php000064400000004071150515725670016635 0ustar00solution = ['roomSid' => $roomSid, 'sid' => $sid, ]; $this->uri = '/Rooms/' . \rawurlencode($roomSid) . '/Recordings/' . \rawurlencode($sid) . ''; } /** * Fetch the RoomRecordingInstance * * @return RoomRecordingInstance Fetched RoomRecordingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RoomRecordingInstance { $payload = $this->version->fetch('GET', $this->uri); return new RoomRecordingInstance( $this->version, $payload, $this->solution['roomSid'], $this->solution['sid'] ); } /** * Delete the RoomRecordingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Video.V1.RoomRecordingContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Video/V1/Room/RoomRecordingInstance.php000064400000011137150515725670016756 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'status' => Values::array_get($payload, 'status'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'sid' => Values::array_get($payload, 'sid'), 'sourceSid' => Values::array_get($payload, 'source_sid'), 'size' => Values::array_get($payload, 'size'), 'url' => Values::array_get($payload, 'url'), 'type' => Values::array_get($payload, 'type'), 'duration' => Values::array_get($payload, 'duration'), 'containerFormat' => Values::array_get($payload, 'container_format'), 'codec' => Values::array_get($payload, 'codec'), 'groupingSids' => Values::array_get($payload, 'grouping_sids'), 'trackName' => Values::array_get($payload, 'track_name'), 'offset' => Values::array_get($payload, 'offset'), 'roomSid' => Values::array_get($payload, 'room_sid'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['roomSid' => $roomSid, '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 RoomRecordingContext Context for this RoomRecordingInstance */ protected function proxy(): RoomRecordingContext { if (!$this->context) { $this->context = new RoomRecordingContext( $this->version, $this->solution['roomSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the RoomRecordingInstance * * @return RoomRecordingInstance Fetched RoomRecordingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RoomRecordingInstance { return $this->proxy()->fetch(); } /** * Delete the RoomRecordingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Video.V1.RoomRecordingInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Video/V1/Room/RecordingRulesList.php000064400000004057150515725670016306 0ustar00solution = ['roomSid' => $roomSid, ]; $this->uri = '/Rooms/' . \rawurlencode($roomSid) . '/RecordingRules'; } /** * Fetch the RecordingRulesInstance * * @return RecordingRulesInstance Fetched RecordingRulesInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RecordingRulesInstance { $payload = $this->version->fetch('GET', $this->uri); return new RecordingRulesInstance($this->version, $payload, $this->solution['roomSid']); } /** * Update the RecordingRulesInstance * * @param array|Options $options Optional Arguments * @return RecordingRulesInstance Updated RecordingRulesInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): RecordingRulesInstance { $options = new Values($options); $data = Values::of(['Rules' => Serialize::jsonObject($options['rules']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new RecordingRulesInstance($this->version, $payload, $this->solution['roomSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Video.V1.RecordingRulesList]'; } }src/Twilio/Rest/Video/V1/Room/RecordingRulesPage.php000064400000002306150515725670016242 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return RecordingRulesInstance \Twilio\Rest\Video\V1\Room\RecordingRulesInstance */ public function buildInstance(array $payload): RecordingRulesInstance { return new RecordingRulesInstance($this->version, $payload, $this->solution['roomSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Video.V1.RecordingRulesPage]'; } }src/Twilio/Rest/Video/V1/Room/ParticipantContext.php000064400000012615150515725670016345 0ustar00solution = ['roomSid' => $roomSid, 'sid' => $sid, ]; $this->uri = '/Rooms/' . \rawurlencode($roomSid) . '/Participants/' . \rawurlencode($sid) . ''; } /** * Fetch the ParticipantInstance * * @return ParticipantInstance Fetched ParticipantInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ParticipantInstance { $payload = $this->version->fetch('GET', $this->uri); return new ParticipantInstance( $this->version, $payload, $this->solution['roomSid'], $this->solution['sid'] ); } /** * Update the ParticipantInstance * * @param array|Options $options Optional Arguments * @return ParticipantInstance Updated ParticipantInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ParticipantInstance { $options = new Values($options); $data = Values::of(['Status' => $options['status'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ParticipantInstance( $this->version, $payload, $this->solution['roomSid'], $this->solution['sid'] ); } /** * Access the publishedTracks */ protected function getPublishedTracks(): PublishedTrackList { if (!$this->_publishedTracks) { $this->_publishedTracks = new PublishedTrackList( $this->version, $this->solution['roomSid'], $this->solution['sid'] ); } return $this->_publishedTracks; } /** * Access the subscribedTracks */ protected function getSubscribedTracks(): SubscribedTrackList { if (!$this->_subscribedTracks) { $this->_subscribedTracks = new SubscribedTrackList( $this->version, $this->solution['roomSid'], $this->solution['sid'] ); } return $this->_subscribedTracks; } /** * Access the subscribeRules */ protected function getSubscribeRules(): SubscribeRulesList { if (!$this->_subscribeRules) { $this->_subscribeRules = new SubscribeRulesList( $this->version, $this->solution['roomSid'], $this->solution['sid'] ); } return $this->_subscribeRules; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Video.V1.ParticipantContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Video/V1/Room/ParticipantPage.php000064400000002264150515725670015574 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ParticipantInstance \Twilio\Rest\Video\V1\Room\ParticipantInstance */ public function buildInstance(array $payload): ParticipantInstance { return new ParticipantInstance($this->version, $payload, $this->solution['roomSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Video.V1.ParticipantPage]'; } }src/Twilio/Rest/Video/V1/Room/RoomRecordingOptions.php000064400000010311150515725670016636 0ustar00options['status'] = $status; $this->options['sourceSid'] = $sourceSid; $this->options['dateCreatedAfter'] = $dateCreatedAfter; $this->options['dateCreatedBefore'] = $dateCreatedBefore; } /** * Read only the recordings with this status. Can be: `processing`, `completed`, or `deleted`. * * @param string $status Read only the recordings with this status * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * Read only the recordings that have this `source_sid`. * * @param string $sourceSid Read only the recordings that have this source_sid * @return $this Fluent Builder */ public function setSourceSid(string $sourceSid): self { $this->options['sourceSid'] = $sourceSid; return $this; } /** * Read only recordings that started on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime with time zone. * * @param \DateTime $dateCreatedAfter Read only Recordings that started on or * after this ISO 8601 datetime with time * zone * @return $this Fluent Builder */ public function setDateCreatedAfter(\DateTime $dateCreatedAfter): self { $this->options['dateCreatedAfter'] = $dateCreatedAfter; return $this; } /** * Read only Recordings that started before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime with time zone. * * @param \DateTime $dateCreatedBefore Read only Recordings that started before * this ISO 8601 date-time with time zone * @return $this Fluent Builder */ public function setDateCreatedBefore(\DateTime $dateCreatedBefore): self { $this->options['dateCreatedBefore'] = $dateCreatedBefore; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Video.V1.ReadRoomRecordingOptions ' . $options . ']'; } }src/Twilio/Rest/Video/V1/Room/ParticipantList.php000064400000012612150515725670015631 0ustar00solution = ['roomSid' => $roomSid, ]; $this->uri = '/Rooms/' . \rawurlencode($roomSid) . '/Participants'; } /** * Streams ParticipantInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ParticipantInstance 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 ParticipantInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of ParticipantInstance 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 ParticipantPage Page of ParticipantInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ParticipantPage { $options = new Values($options); $params = Values::of([ 'Status' => $options['status'], 'Identity' => $options['identity'], 'DateCreatedAfter' => Serialize::iso8601DateTime($options['dateCreatedAfter']), 'DateCreatedBefore' => Serialize::iso8601DateTime($options['dateCreatedBefore']), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ParticipantPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ParticipantInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ParticipantPage Page of ParticipantInstance */ public function getPage(string $targetUrl): ParticipantPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ParticipantPage($this->version, $response, $this->solution); } /** * Constructs a ParticipantContext * * @param string $sid The SID that identifies the resource to fetch */ public function getContext(string $sid): ParticipantContext { return new ParticipantContext($this->version, $this->solution['roomSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Video.V1.ParticipantList]'; } }src/Twilio/Rest/Video/V1/Room/Participant/PublishedTrackContext.php000064400000004157150515725670021253 0ustar00solution = ['roomSid' => $roomSid, 'participantSid' => $participantSid, 'sid' => $sid, ]; $this->uri = '/Rooms/' . \rawurlencode($roomSid) . '/Participants/' . \rawurlencode($participantSid) . '/PublishedTracks/' . \rawurlencode($sid) . ''; } /** * Fetch the PublishedTrackInstance * * @return PublishedTrackInstance Fetched PublishedTrackInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): PublishedTrackInstance { $payload = $this->version->fetch('GET', $this->uri); return new PublishedTrackInstance( $this->version, $payload, $this->solution['roomSid'], $this->solution['participantSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Video.V1.PublishedTrackContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Video/V1/Room/Participant/SubscribedTrackPage.php000064400000002501150515725670020640 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SubscribedTrackInstance \Twilio\Rest\Video\V1\Room\Participant\SubscribedTrackInstance */ public function buildInstance(array $payload): SubscribedTrackInstance { return new SubscribedTrackInstance( $this->version, $payload, $this->solution['roomSid'], $this->solution['participantSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Video.V1.SubscribedTrackPage]'; } }src/Twilio/Rest/Video/V1/Room/Participant/SubscribeRulesInstance.php000064400000004640150515725670021420 0ustar00properties = [ 'participantSid' => Values::array_get($payload, 'participant_sid'), 'roomSid' => Values::array_get($payload, 'room_sid'), 'rules' => Values::array_get($payload, 'rules'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), ]; $this->solution = ['roomSid' => $roomSid, 'participantSid' => $participantSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Video.V1.SubscribeRulesInstance]'; } }src/Twilio/Rest/Video/V1/Room/Participant/SubscribedTrackList.php000064400000012263150515725670020705 0ustar00solution = ['roomSid' => $roomSid, 'participantSid' => $participantSid, ]; $this->uri = '/Rooms/' . \rawurlencode($roomSid) . '/Participants/' . \rawurlencode($participantSid) . '/SubscribedTracks'; } /** * Streams SubscribedTrackInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads SubscribedTrackInstance 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 SubscribedTrackInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of SubscribedTrackInstance 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 SubscribedTrackPage Page of SubscribedTrackInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SubscribedTrackPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new SubscribedTrackPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of SubscribedTrackInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return SubscribedTrackPage Page of SubscribedTrackInstance */ public function getPage(string $targetUrl): SubscribedTrackPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new SubscribedTrackPage($this->version, $response, $this->solution); } /** * Constructs a SubscribedTrackContext * * @param string $sid The SID that identifies the resource to fetch */ public function getContext(string $sid): SubscribedTrackContext { return new SubscribedTrackContext( $this->version, $this->solution['roomSid'], $this->solution['participantSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Video.V1.SubscribedTrackList]'; } }src/Twilio/Rest/Video/V1/Room/Participant/SubscribedTrackInstance.php000064400000010124150515725670021530 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'participantSid' => Values::array_get($payload, 'participant_sid'), 'publisherSid' => Values::array_get($payload, 'publisher_sid'), 'roomSid' => Values::array_get($payload, 'room_sid'), 'name' => Values::array_get($payload, 'name'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'enabled' => Values::array_get($payload, 'enabled'), 'kind' => Values::array_get($payload, 'kind'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'roomSid' => $roomSid, 'participantSid' => $participantSid, '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 SubscribedTrackContext Context for this SubscribedTrackInstance */ protected function proxy(): SubscribedTrackContext { if (!$this->context) { $this->context = new SubscribedTrackContext( $this->version, $this->solution['roomSid'], $this->solution['participantSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the SubscribedTrackInstance * * @return SubscribedTrackInstance Fetched SubscribedTrackInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SubscribedTrackInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Video.V1.SubscribedTrackInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Video/V1/Room/Participant/PublishedTrackList.php000064400000012313150515725670020533 0ustar00solution = ['roomSid' => $roomSid, 'participantSid' => $participantSid, ]; $this->uri = '/Rooms/' . \rawurlencode($roomSid) . '/Participants/' . \rawurlencode($participantSid) . '/PublishedTracks'; } /** * Streams PublishedTrackInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads PublishedTrackInstance 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 PublishedTrackInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of PublishedTrackInstance 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 PublishedTrackPage Page of PublishedTrackInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): PublishedTrackPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new PublishedTrackPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of PublishedTrackInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return PublishedTrackPage Page of PublishedTrackInstance */ public function getPage(string $targetUrl): PublishedTrackPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new PublishedTrackPage($this->version, $response, $this->solution); } /** * Constructs a PublishedTrackContext * * @param string $sid The SID that identifies the resource to fetch */ public function getContext(string $sid): PublishedTrackContext { return new PublishedTrackContext( $this->version, $this->solution['roomSid'], $this->solution['participantSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Video.V1.PublishedTrackList]'; } }src/Twilio/Rest/Video/V1/Room/Participant/PublishedTrackInstance.php000064400000010007150515725670021362 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'participantSid' => Values::array_get($payload, 'participant_sid'), 'roomSid' => Values::array_get($payload, 'room_sid'), 'name' => Values::array_get($payload, 'name'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'enabled' => Values::array_get($payload, 'enabled'), 'kind' => Values::array_get($payload, 'kind'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'roomSid' => $roomSid, 'participantSid' => $participantSid, '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 PublishedTrackContext Context for this PublishedTrackInstance */ protected function proxy(): PublishedTrackContext { if (!$this->context) { $this->context = new PublishedTrackContext( $this->version, $this->solution['roomSid'], $this->solution['participantSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the PublishedTrackInstance * * @return PublishedTrackInstance Fetched PublishedTrackInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): PublishedTrackInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Video.V1.PublishedTrackInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Video/V1/Room/Participant/SubscribeRulesPage.php000064400000002473150515725670020532 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SubscribeRulesInstance \Twilio\Rest\Video\V1\Room\Participant\SubscribeRulesInstance */ public function buildInstance(array $payload): SubscribeRulesInstance { return new SubscribeRulesInstance( $this->version, $payload, $this->solution['roomSid'], $this->solution['participantSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Video.V1.SubscribeRulesPage]'; } }src/Twilio/Rest/Video/V1/Room/Participant/PublishedTrackPage.php000064400000002473150515725670020502 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return PublishedTrackInstance \Twilio\Rest\Video\V1\Room\Participant\PublishedTrackInstance */ public function buildInstance(array $payload): PublishedTrackInstance { return new PublishedTrackInstance( $this->version, $payload, $this->solution['roomSid'], $this->solution['participantSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Video.V1.PublishedTrackPage]'; } }src/Twilio/Rest/Video/V1/Room/Participant/SubscribeRulesOptions.php000064400000003041150515725670021301 0ustar00options['rules'] = $rules; } /** * A JSON-encoded array of subscribe rules. See the [Specifying Subscribe Rules](https://www.twilio.com/docs/video/api/track-subscriptions#specifying-sr) section for further information. * * @param array $rules A JSON-encoded array of subscribe rules * @return $this Fluent Builder */ public function setRules(array $rules): self { $this->options['rules'] = $rules; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Video.V1.UpdateSubscribeRulesOptions ' . $options . ']'; } }src/Twilio/Rest/Video/V1/Room/Participant/SubscribeRulesList.php000064400000004754150515725670020575 0ustar00solution = ['roomSid' => $roomSid, 'participantSid' => $participantSid, ]; $this->uri = '/Rooms/' . \rawurlencode($roomSid) . '/Participants/' . \rawurlencode($participantSid) . '/SubscribeRules'; } /** * Fetch the SubscribeRulesInstance * * @return SubscribeRulesInstance Fetched SubscribeRulesInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SubscribeRulesInstance { $payload = $this->version->fetch('GET', $this->uri); return new SubscribeRulesInstance( $this->version, $payload, $this->solution['roomSid'], $this->solution['participantSid'] ); } /** * Update the SubscribeRulesInstance * * @param array|Options $options Optional Arguments * @return SubscribeRulesInstance Updated SubscribeRulesInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SubscribeRulesInstance { $options = new Values($options); $data = Values::of(['Rules' => Serialize::jsonObject($options['rules']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new SubscribeRulesInstance( $this->version, $payload, $this->solution['roomSid'], $this->solution['participantSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Video.V1.SubscribeRulesList]'; } }src/Twilio/Rest/Video/V1/Room/Participant/SubscribedTrackContext.php000064400000004164150515725670021417 0ustar00solution = ['roomSid' => $roomSid, 'participantSid' => $participantSid, 'sid' => $sid, ]; $this->uri = '/Rooms/' . \rawurlencode($roomSid) . '/Participants/' . \rawurlencode($participantSid) . '/SubscribedTracks/' . \rawurlencode($sid) . ''; } /** * Fetch the SubscribedTrackInstance * * @return SubscribedTrackInstance Fetched SubscribedTrackInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SubscribedTrackInstance { $payload = $this->version->fetch('GET', $this->uri); return new SubscribedTrackInstance( $this->version, $payload, $this->solution['roomSid'], $this->solution['participantSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Video.V1.SubscribedTrackContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Video/V1/Room/ParticipantOptions.php000064400000013064150515725670016353 0ustar00options['status'] = $status; $this->options['identity'] = $identity; $this->options['dateCreatedAfter'] = $dateCreatedAfter; $this->options['dateCreatedBefore'] = $dateCreatedBefore; } /** * Read only the participants with this status. Can be: `connected` or `disconnected`. For `in-progress` Rooms the default Status is `connected`, for `completed` Rooms only `disconnected` Participants are returned. * * @param string $status Read only the participants with this status * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * Read only the Participants with this [User](https://www.twilio.com/docs/chat/rest/user-resource) `identity` value. * * @param string $identity Read only the Participants with this user identity * value * @return $this Fluent Builder */ public function setIdentity(string $identity): self { $this->options['identity'] = $identity; return $this; } /** * Read only Participants that started after this date in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. * * @param \DateTime $dateCreatedAfter Read only Participants that started after * this date in UTC ISO 8601 format * @return $this Fluent Builder */ public function setDateCreatedAfter(\DateTime $dateCreatedAfter): self { $this->options['dateCreatedAfter'] = $dateCreatedAfter; return $this; } /** * Read only Participants that started before this date in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. * * @param \DateTime $dateCreatedBefore Read only Participants that started * before this date in ISO 8601 format * @return $this Fluent Builder */ public function setDateCreatedBefore(\DateTime $dateCreatedBefore): self { $this->options['dateCreatedBefore'] = $dateCreatedBefore; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Video.V1.ReadParticipantOptions ' . $options . ']'; } } class UpdateParticipantOptions extends Options { /** * @param string $status The new status of the resource */ public function __construct(string $status = Values::NONE) { $this->options['status'] = $status; } /** * The new status of the resource. Can be: `connected` or `disconnected`. For `in-progress` Rooms the default Status is `connected`, for `completed` Rooms only `disconnected` Participants are returned. * * @param string $status The new status of the resource * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Video.V1.UpdateParticipantOptions ' . $options . ']'; } }src/Twilio/Rest/Video/V1/Room/RecordingRulesInstance.php000064400000004135150515725670017134 0ustar00properties = [ 'roomSid' => Values::array_get($payload, 'room_sid'), 'rules' => Values::array_get($payload, 'rules'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), ]; $this->solution = ['roomSid' => $roomSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Video.V1.RecordingRulesInstance]'; } }src/Twilio/Rest/Video/V1/Room/RecordingRulesOptions.php000064400000002606150515725670017024 0ustar00options['rules'] = $rules; } /** * A JSON-encoded array of recording rules. * * @param array $rules A JSON-encoded array of recording rules * @return $this Fluent Builder */ public function setRules(array $rules): self { $this->options['rules'] = $rules; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Video.V1.UpdateRecordingRulesOptions ' . $options . ']'; } }src/Twilio/Rest/Video/V1/Room/ParticipantInstance.php000064400000012171150515725670016462 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'roomSid' => Values::array_get($payload, 'room_sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'status' => Values::array_get($payload, 'status'), 'identity' => Values::array_get($payload, 'identity'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'startTime' => Deserialize::dateTime(Values::array_get($payload, 'start_time')), 'endTime' => Deserialize::dateTime(Values::array_get($payload, 'end_time')), 'duration' => Values::array_get($payload, 'duration'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['roomSid' => $roomSid, '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 ParticipantContext Context for this ParticipantInstance */ protected function proxy(): ParticipantContext { if (!$this->context) { $this->context = new ParticipantContext( $this->version, $this->solution['roomSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the ParticipantInstance * * @return ParticipantInstance Fetched ParticipantInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ParticipantInstance { return $this->proxy()->fetch(); } /** * Update the ParticipantInstance * * @param array|Options $options Optional Arguments * @return ParticipantInstance Updated ParticipantInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ParticipantInstance { return $this->proxy()->update($options); } /** * Access the publishedTracks */ protected function getPublishedTracks(): PublishedTrackList { return $this->proxy()->publishedTracks; } /** * Access the subscribedTracks */ protected function getSubscribedTracks(): SubscribedTrackList { return $this->proxy()->subscribedTracks; } /** * Access the subscribeRules */ protected function getSubscribeRules(): SubscribeRulesList { return $this->proxy()->subscribeRules; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Video.V1.ParticipantInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Video/V1/Room/RoomRecordingPage.php000064400000002300150515725670016056 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return RoomRecordingInstance \Twilio\Rest\Video\V1\Room\RoomRecordingInstance */ public function buildInstance(array $payload): RoomRecordingInstance { return new RoomRecordingInstance($this->version, $payload, $this->solution['roomSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Video.V1.RoomRecordingPage]'; } }src/Twilio/Rest/Video/V1/CompositionSettingsList.php000064400000001701150515725670016460 0ustar00solution = []; } /** * Constructs a CompositionSettingsContext */ public function getContext(): CompositionSettingsContext { return new CompositionSettingsContext($this->version); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Video.V1.CompositionSettingsList]'; } }src/Twilio/Rest/Video/V1/RoomInstance.php000064400000014044150515725670014205 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'status' => Values::array_get($payload, 'status'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'accountSid' => Values::array_get($payload, 'account_sid'), 'enableTurn' => Values::array_get($payload, 'enable_turn'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'statusCallback' => Values::array_get($payload, 'status_callback'), 'statusCallbackMethod' => Values::array_get($payload, 'status_callback_method'), 'endTime' => Deserialize::dateTime(Values::array_get($payload, 'end_time')), 'duration' => Values::array_get($payload, 'duration'), 'type' => Values::array_get($payload, 'type'), 'maxParticipants' => Values::array_get($payload, 'max_participants'), 'maxParticipantDuration' => Values::array_get($payload, 'max_participant_duration'), 'maxConcurrentPublishedTracks' => Values::array_get($payload, 'max_concurrent_published_tracks'), 'recordParticipantsOnConnect' => Values::array_get($payload, 'record_participants_on_connect'), 'videoCodecs' => Values::array_get($payload, 'video_codecs'), 'mediaRegion' => Values::array_get($payload, 'media_region'), 'audioOnly' => Values::array_get($payload, 'audio_only'), 'emptyRoomTimeout' => Values::array_get($payload, 'empty_room_timeout'), 'unusedRoomTimeout' => Values::array_get($payload, 'unused_room_timeout'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 RoomContext Context for this RoomInstance */ protected function proxy(): RoomContext { if (!$this->context) { $this->context = new RoomContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the RoomInstance * * @return RoomInstance Fetched RoomInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RoomInstance { return $this->proxy()->fetch(); } /** * Update the RoomInstance * * @param string $status The new status of the resource * @return RoomInstance Updated RoomInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $status): RoomInstance { return $this->proxy()->update($status); } /** * Access the recordings */ protected function getRecordings(): RoomRecordingList { return $this->proxy()->recordings; } /** * Access the participants */ protected function getParticipants(): ParticipantList { return $this->proxy()->participants; } /** * Access the recordingRules */ protected function getRecordingRules(): RecordingRulesList { return $this->proxy()->recordingRules; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Video.V1.RoomInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Video/V1/RoomOptions.php000064400000041421150515725670014073 0ustar00options['enableTurn'] = $enableTurn; $this->options['type'] = $type; $this->options['uniqueName'] = $uniqueName; $this->options['statusCallback'] = $statusCallback; $this->options['statusCallbackMethod'] = $statusCallbackMethod; $this->options['maxParticipants'] = $maxParticipants; $this->options['recordParticipantsOnConnect'] = $recordParticipantsOnConnect; $this->options['videoCodecs'] = $videoCodecs; $this->options['mediaRegion'] = $mediaRegion; $this->options['recordingRules'] = $recordingRules; $this->options['audioOnly'] = $audioOnly; $this->options['maxParticipantDuration'] = $maxParticipantDuration; $this->options['emptyRoomTimeout'] = $emptyRoomTimeout; $this->options['unusedRoomTimeout'] = $unusedRoomTimeout; } /** * Deprecated, now always considered to be true. * * @param bool $enableTurn Enable Twilio's Network Traversal TURN service * @return $this Fluent Builder */ public function setEnableTurn(bool $enableTurn): self { $this->options['enableTurn'] = $enableTurn; return $this; } /** * The type of room. Can be: `go`, `peer-to-peer`, `group-small`, or `group`. The default value is `group`. * * @param string $type The type of room * @return $this Fluent Builder */ public function setType(string $type): self { $this->options['type'] = $type; return $this; } /** * An application-defined string that uniquely identifies the resource. It can be used as a `room_sid` in place of the resource's `sid` in the URL to address the resource. This value is unique for `in-progress` rooms. SDK clients can use this name to connect to the room. REST API clients can use this name in place of the Room SID to interact with the room as long as the room is `in-progress`. * * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * The URL we should call using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. * * @param string $statusCallback The URL to send status information to your * application * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * The HTTP method we should use to call `status_callback`. Can be `POST` or `GET`. * * @param string $statusCallbackMethod The HTTP method we should use to call * status_callback * @return $this Fluent Builder */ public function setStatusCallbackMethod(string $statusCallbackMethod): self { $this->options['statusCallbackMethod'] = $statusCallbackMethod; return $this; } /** * The maximum number of concurrent Participants allowed in the room. Peer-to-peer rooms can have up to 10 Participants. Small Group rooms can have up to 4 Participants. Group rooms can have up to 50 Participants. * * @param int $maxParticipants The maximum number of concurrent Participants * allowed in the room * @return $this Fluent Builder */ public function setMaxParticipants(int $maxParticipants): self { $this->options['maxParticipants'] = $maxParticipants; return $this; } /** * Whether to start recording when Participants connect. ***This feature is not available in `peer-to-peer` rooms.*** * * @param bool $recordParticipantsOnConnect Whether to start recording when * Participants connect * @return $this Fluent Builder */ public function setRecordParticipantsOnConnect(bool $recordParticipantsOnConnect): self { $this->options['recordParticipantsOnConnect'] = $recordParticipantsOnConnect; return $this; } /** * An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. ***This feature is not available in `peer-to-peer` rooms*** * * @param string[] $videoCodecs An array of the video codecs that are supported * when publishing a track in the room * @return $this Fluent Builder */ public function setVideoCodecs(array $videoCodecs): self { $this->options['videoCodecs'] = $videoCodecs; return $this; } /** * The region for the media server in Group Rooms. Can be: one of the [available Media Regions](https://www.twilio.com/docs/video/ip-address-whitelisting#group-rooms-media-servers). ***This feature is not available in `peer-to-peer` rooms.*** * * @param string $mediaRegion The region for the media server in Group Rooms * @return $this Fluent Builder */ public function setMediaRegion(string $mediaRegion): self { $this->options['mediaRegion'] = $mediaRegion; return $this; } /** * A collection of Recording Rules that describe how to include or exclude matching tracks for recording * * @param array $recordingRules A collection of Recording Rules * @return $this Fluent Builder */ public function setRecordingRules(array $recordingRules): self { $this->options['recordingRules'] = $recordingRules; return $this; } /** * When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. Group rooms only. * * @param bool $audioOnly Indicates whether the room will only contain audio * track participants for group rooms. * @return $this Fluent Builder */ public function setAudioOnly(bool $audioOnly): self { $this->options['audioOnly'] = $audioOnly; return $this; } /** * The maximum number of seconds a Participant can be connected to the room. The maximum possible value is 86400 seconds (24 hours). The default is 14400 seconds (4 hours). * * @param int $maxParticipantDuration The maximum number of seconds a * Participant can be connected to the room * @return $this Fluent Builder */ public function setMaxParticipantDuration(int $maxParticipantDuration): self { $this->options['maxParticipantDuration'] = $maxParticipantDuration; return $this; } /** * Configures how long (in minutes) a room will remain active after last participant leaves. Valid values range from 1 to 60 minutes (no fractions). * * @param int $emptyRoomTimeout Configures the time a room will remain active * after last participant leaves. * @return $this Fluent Builder */ public function setEmptyRoomTimeout(int $emptyRoomTimeout): self { $this->options['emptyRoomTimeout'] = $emptyRoomTimeout; return $this; } /** * Configures how long (in minutes) a room will remain active if no one joins. Valid values range from 1 to 60 minutes (no fractions). * * @param int $unusedRoomTimeout Configures the time a room will remain active * when no one joins. * @return $this Fluent Builder */ public function setUnusedRoomTimeout(int $unusedRoomTimeout): self { $this->options['unusedRoomTimeout'] = $unusedRoomTimeout; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Video.V1.CreateRoomOptions ' . $options . ']'; } } class ReadRoomOptions extends Options { /** * @param string $status Read only the rooms with this status * @param string $uniqueName Read only rooms with this unique_name * @param \DateTime $dateCreatedAfter Read only rooms that started on or after * this date, given as YYYY-MM-DD * @param \DateTime $dateCreatedBefore Read only rooms that started before this * date, given as YYYY-MM-DD */ public function __construct(string $status = Values::NONE, string $uniqueName = Values::NONE, \DateTime $dateCreatedAfter = Values::NONE, \DateTime $dateCreatedBefore = Values::NONE) { $this->options['status'] = $status; $this->options['uniqueName'] = $uniqueName; $this->options['dateCreatedAfter'] = $dateCreatedAfter; $this->options['dateCreatedBefore'] = $dateCreatedBefore; } /** * Read only the rooms with this status. Can be: `in-progress` (default) or `completed` * * @param string $status Read only the rooms with this status * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * Read only rooms with the this `unique_name`. * * @param string $uniqueName Read only rooms with this unique_name * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * Read only rooms that started on or after this date, given as `YYYY-MM-DD`. * * @param \DateTime $dateCreatedAfter Read only rooms that started on or after * this date, given as YYYY-MM-DD * @return $this Fluent Builder */ public function setDateCreatedAfter(\DateTime $dateCreatedAfter): self { $this->options['dateCreatedAfter'] = $dateCreatedAfter; return $this; } /** * Read only rooms that started before this date, given as `YYYY-MM-DD`. * * @param \DateTime $dateCreatedBefore Read only rooms that started before this * date, given as YYYY-MM-DD * @return $this Fluent Builder */ public function setDateCreatedBefore(\DateTime $dateCreatedBefore): self { $this->options['dateCreatedBefore'] = $dateCreatedBefore; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Video.V1.ReadRoomOptions ' . $options . ']'; } }src/Twilio/Rest/Video/V1/CompositionOptions.php000064400000033723150515725670015470 0ustar00options['status'] = $status; $this->options['dateCreatedAfter'] = $dateCreatedAfter; $this->options['dateCreatedBefore'] = $dateCreatedBefore; $this->options['roomSid'] = $roomSid; } /** * Read only Composition resources with this status. Can be: `enqueued`, `processing`, `completed`, `deleted`, or `failed`. * * @param string $status Read only Composition resources with this status * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * Read only Composition resources created on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time with time zone. * * @param \DateTime $dateCreatedAfter Read only Composition resources created * on or after this [ISO * 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time with time zone * @return $this Fluent Builder */ public function setDateCreatedAfter(\DateTime $dateCreatedAfter): self { $this->options['dateCreatedAfter'] = $dateCreatedAfter; return $this; } /** * Read only Composition resources created before this ISO 8601 date-time with time zone. * * @param \DateTime $dateCreatedBefore Read only Composition resources created * before this ISO 8601 date-time with time * zone * @return $this Fluent Builder */ public function setDateCreatedBefore(\DateTime $dateCreatedBefore): self { $this->options['dateCreatedBefore'] = $dateCreatedBefore; return $this; } /** * Read only Composition resources with this Room SID. * * @param string $roomSid Read only Composition resources with this Room SID * @return $this Fluent Builder */ public function setRoomSid(string $roomSid): self { $this->options['roomSid'] = $roomSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Video.V1.ReadCompositionOptions ' . $options . ']'; } } class CreateCompositionOptions extends Options { /** * @param array $videoLayout An object that describes the video layout of the * composition * @param string[] $audioSources An array of track names from the same group * room to merge * @param string[] $audioSourcesExcluded An array of track names to exclude * @param string $resolution A string that describes the columns (width) and * rows (height) of the generated composed video in * pixels * @param string $format The container format of the composition's media files * @param string $statusCallback The URL we should call to send status * information to your application * @param string $statusCallbackMethod The HTTP method we should use to call * status_callback * @param bool $trim Whether to clip the intervals where there is no active * media in the composition */ public function __construct(array $videoLayout = Values::ARRAY_NONE, array $audioSources = Values::ARRAY_NONE, array $audioSourcesExcluded = Values::ARRAY_NONE, string $resolution = Values::NONE, string $format = Values::NONE, string $statusCallback = Values::NONE, string $statusCallbackMethod = Values::NONE, bool $trim = Values::NONE) { $this->options['videoLayout'] = $videoLayout; $this->options['audioSources'] = $audioSources; $this->options['audioSourcesExcluded'] = $audioSourcesExcluded; $this->options['resolution'] = $resolution; $this->options['format'] = $format; $this->options['statusCallback'] = $statusCallback; $this->options['statusCallbackMethod'] = $statusCallbackMethod; $this->options['trim'] = $trim; } /** * An object that describes the video layout of the composition in terms of regions. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request * * @param array $videoLayout An object that describes the video layout of the * composition * @return $this Fluent Builder */ public function setVideoLayout(array $videoLayout): self { $this->options['videoLayout'] = $videoLayout; return $this; } /** * An array of track names from the same group room to merge into the new composition. Can include zero or more track names. The new composition includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which will match zero or more characters in a track name. For example, `student*` includes `student` as well as `studentTeam`. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request * * @param string[] $audioSources An array of track names from the same group * room to merge * @return $this Fluent Builder */ public function setAudioSources(array $audioSources): self { $this->options['audioSources'] = $audioSources; return $this; } /** * An array of track names to exclude. The new composition includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which will match zero or more characters in a track name. For example, `student*` excludes `student` as well as `studentTeam`. This parameter can also be empty. * * @param string[] $audioSourcesExcluded An array of track names to exclude * @return $this Fluent Builder */ public function setAudioSourcesExcluded(array $audioSourcesExcluded): self { $this->options['audioSourcesExcluded'] = $audioSourcesExcluded; return $this; } /** * A string that describes the columns (width) and rows (height) of the generated composed video in pixels. Defaults to `640x480`. The string's format is `{width}x{height}` where: * 16 <= `{width}` <= 1280 * 16 <= `{height}` <= 1280 * `{width}` * `{height}` <= 921,600 Typical values are: * HD = `1280x720` * PAL = `1024x576` * VGA = `640x480` * CIF = `320x240` Note that the `resolution` imposes an aspect ratio to the resulting composition. When the original video tracks are constrained by the aspect ratio, they are scaled to fit. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. * * @param string $resolution A string that describes the columns (width) and * rows (height) of the generated composed video in * pixels * @return $this Fluent Builder */ public function setResolution(string $resolution): self { $this->options['resolution'] = $resolution; return $this; } /** * The container format of the composition's media files. Can be: `mp4` or `webm` and the default is `webm`. If you specify `mp4` or `webm`, you must also specify one or more `audio_sources` and/or a `video_layout` element that contains a valid `video_sources` list, otherwise an error occurs. * * @param string $format The container format of the composition's media files * @return $this Fluent Builder */ public function setFormat(string $format): self { $this->options['format'] = $format; return $this; } /** * The URL we should call using the `status_callback_method` to send status information to your application on every composition event. If not provided, status callback events will not be dispatched. * * @param string $statusCallback The URL we should call to send status * information to your application * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * The HTTP method we should use to call `status_callback`. Can be: `POST` or `GET` and the default is `POST`. * * @param string $statusCallbackMethod The HTTP method we should use to call * status_callback * @return $this Fluent Builder */ public function setStatusCallbackMethod(string $statusCallbackMethod): self { $this->options['statusCallbackMethod'] = $statusCallbackMethod; return $this; } /** * Whether to clip the intervals where there is no active media in the composition. The default is `true`. Compositions with `trim` enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. * * @param bool $trim Whether to clip the intervals where there is no active * media in the composition * @return $this Fluent Builder */ public function setTrim(bool $trim): self { $this->options['trim'] = $trim; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Video.V1.CreateCompositionOptions ' . $options . ']'; } }src/Twilio/Rest/Video/V1/RoomContext.php000064400000010707150515725670014067 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Rooms/' . \rawurlencode($sid) . ''; } /** * Fetch the RoomInstance * * @return RoomInstance Fetched RoomInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RoomInstance { $payload = $this->version->fetch('GET', $this->uri); return new RoomInstance($this->version, $payload, $this->solution['sid']); } /** * Update the RoomInstance * * @param string $status The new status of the resource * @return RoomInstance Updated RoomInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $status): RoomInstance { $data = Values::of(['Status' => $status, ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new RoomInstance($this->version, $payload, $this->solution['sid']); } /** * Access the recordings */ protected function getRecordings(): RoomRecordingList { if (!$this->_recordings) { $this->_recordings = new RoomRecordingList($this->version, $this->solution['sid']); } return $this->_recordings; } /** * Access the participants */ protected function getParticipants(): ParticipantList { if (!$this->_participants) { $this->_participants = new ParticipantList($this->version, $this->solution['sid']); } return $this->_participants; } /** * Access the recordingRules */ protected function getRecordingRules(): RecordingRulesList { if (!$this->_recordingRules) { $this->_recordingRules = new RecordingRulesList($this->version, $this->solution['sid']); } return $this->_recordingRules; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Video.V1.RoomContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Video/V1/RecordingList.php000064400000012512150515725670014352 0ustar00solution = []; $this->uri = '/Recordings'; } /** * Streams RecordingInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads RecordingInstance 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 RecordingInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of RecordingInstance 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 RecordingPage Page of RecordingInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): RecordingPage { $options = new Values($options); $params = Values::of([ 'Status' => $options['status'], 'SourceSid' => $options['sourceSid'], 'GroupingSid' => Serialize::map($options['groupingSid'], function($e) { return $e; }), 'DateCreatedAfter' => Serialize::iso8601DateTime($options['dateCreatedAfter']), 'DateCreatedBefore' => Serialize::iso8601DateTime($options['dateCreatedBefore']), 'MediaType' => $options['mediaType'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new RecordingPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of RecordingInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return RecordingPage Page of RecordingInstance */ public function getPage(string $targetUrl): RecordingPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new RecordingPage($this->version, $response, $this->solution); } /** * Constructs a RecordingContext * * @param string $sid The SID that identifies the resource to fetch */ public function getContext(string $sid): RecordingContext { return new RecordingContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Video.V1.RecordingList]'; } }src/Twilio/Rest/Video/V1/CompositionPage.php000064400000002216150515725670014702 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CompositionInstance \Twilio\Rest\Video\V1\CompositionInstance */ public function buildInstance(array $payload): CompositionInstance { return new CompositionInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Video.V1.CompositionPage]'; } }src/Twilio/Rest/Video/V1/CompositionList.php000064400000015056150515725670014747 0ustar00solution = []; $this->uri = '/Compositions'; } /** * Streams CompositionInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads CompositionInstance 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 CompositionInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of CompositionInstance 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 CompositionPage Page of CompositionInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): CompositionPage { $options = new Values($options); $params = Values::of([ 'Status' => $options['status'], 'DateCreatedAfter' => Serialize::iso8601DateTime($options['dateCreatedAfter']), 'DateCreatedBefore' => Serialize::iso8601DateTime($options['dateCreatedBefore']), 'RoomSid' => $options['roomSid'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new CompositionPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of CompositionInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return CompositionPage Page of CompositionInstance */ public function getPage(string $targetUrl): CompositionPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new CompositionPage($this->version, $response, $this->solution); } /** * Create the CompositionInstance * * @param string $roomSid The SID of the Group Room with the media tracks to be * used as composition sources * @param array|Options $options Optional Arguments * @return CompositionInstance Created CompositionInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $roomSid, array $options = []): CompositionInstance { $options = new Values($options); $data = Values::of([ 'RoomSid' => $roomSid, 'VideoLayout' => Serialize::jsonObject($options['videoLayout']), 'AudioSources' => Serialize::map($options['audioSources'], function($e) { return $e; }), 'AudioSourcesExcluded' => Serialize::map($options['audioSourcesExcluded'], function($e) { return $e; }), 'Resolution' => $options['resolution'], 'Format' => $options['format'], 'StatusCallback' => $options['statusCallback'], 'StatusCallbackMethod' => $options['statusCallbackMethod'], 'Trim' => Serialize::booleanToString($options['trim']), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new CompositionInstance($this->version, $payload); } /** * Constructs a CompositionContext * * @param string $sid The SID that identifies the resource to fetch */ public function getContext(string $sid): CompositionContext { return new CompositionContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Video.V1.CompositionList]'; } }src/Twilio/Rest/Video/V1/CompositionSettingsContext.php000064400000005127150515725670017177 0ustar00solution = []; $this->uri = '/CompositionSettings/Default'; } /** * Fetch the CompositionSettingsInstance * * @return CompositionSettingsInstance Fetched CompositionSettingsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CompositionSettingsInstance { $payload = $this->version->fetch('GET', $this->uri); return new CompositionSettingsInstance($this->version, $payload); } /** * Create the CompositionSettingsInstance * * @param string $friendlyName A descriptive string that you create to describe * the resource * @param array|Options $options Optional Arguments * @return CompositionSettingsInstance Created CompositionSettingsInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, array $options = []): CompositionSettingsInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $friendlyName, 'AwsCredentialsSid' => $options['awsCredentialsSid'], 'EncryptionKeySid' => $options['encryptionKeySid'], 'AwsS3Url' => $options['awsS3Url'], 'AwsStorageEnabled' => Serialize::booleanToString($options['awsStorageEnabled']), 'EncryptionEnabled' => Serialize::booleanToString($options['encryptionEnabled']), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new CompositionSettingsInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Video.V1.CompositionSettingsContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Video/V1/RecordingContext.php000064400000003376150515725670015073 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Recordings/' . \rawurlencode($sid) . ''; } /** * Fetch the RecordingInstance * * @return RecordingInstance Fetched RecordingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RecordingInstance { $payload = $this->version->fetch('GET', $this->uri); return new RecordingInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the RecordingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Video.V1.RecordingContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Video/V1/RoomList.php000064400000015134150515725670013355 0ustar00solution = []; $this->uri = '/Rooms'; } /** * Create the RoomInstance * * @param array|Options $options Optional Arguments * @return RoomInstance Created RoomInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): RoomInstance { $options = new Values($options); $data = Values::of([ 'EnableTurn' => Serialize::booleanToString($options['enableTurn']), 'Type' => $options['type'], 'UniqueName' => $options['uniqueName'], 'StatusCallback' => $options['statusCallback'], 'StatusCallbackMethod' => $options['statusCallbackMethod'], 'MaxParticipants' => $options['maxParticipants'], 'RecordParticipantsOnConnect' => Serialize::booleanToString($options['recordParticipantsOnConnect']), 'VideoCodecs' => Serialize::map($options['videoCodecs'], function($e) { return $e; }), 'MediaRegion' => $options['mediaRegion'], 'RecordingRules' => Serialize::jsonObject($options['recordingRules']), 'AudioOnly' => Serialize::booleanToString($options['audioOnly']), 'MaxParticipantDuration' => $options['maxParticipantDuration'], 'EmptyRoomTimeout' => $options['emptyRoomTimeout'], 'UnusedRoomTimeout' => $options['unusedRoomTimeout'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new RoomInstance($this->version, $payload); } /** * Streams RoomInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads RoomInstance 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 RoomInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of RoomInstance 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 RoomPage Page of RoomInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): RoomPage { $options = new Values($options); $params = Values::of([ 'Status' => $options['status'], 'UniqueName' => $options['uniqueName'], 'DateCreatedAfter' => Serialize::iso8601DateTime($options['dateCreatedAfter']), 'DateCreatedBefore' => Serialize::iso8601DateTime($options['dateCreatedBefore']), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new RoomPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of RoomInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return RoomPage Page of RoomInstance */ public function getPage(string $targetUrl): RoomPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new RoomPage($this->version, $response, $this->solution); } /** * Constructs a RoomContext * * @param string $sid The SID that identifies the resource to fetch */ public function getContext(string $sid): RoomContext { return new RoomContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Video.V1.RoomList]'; } }src/Twilio/Rest/Video/V1/CompositionInstance.php000064400000011163150515725670015573 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'status' => Values::array_get($payload, 'status'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateCompleted' => Deserialize::dateTime(Values::array_get($payload, 'date_completed')), 'dateDeleted' => Deserialize::dateTime(Values::array_get($payload, 'date_deleted')), 'sid' => Values::array_get($payload, 'sid'), 'roomSid' => Values::array_get($payload, 'room_sid'), 'audioSources' => Values::array_get($payload, 'audio_sources'), 'audioSourcesExcluded' => Values::array_get($payload, 'audio_sources_excluded'), 'videoLayout' => Values::array_get($payload, 'video_layout'), 'resolution' => Values::array_get($payload, 'resolution'), 'trim' => Values::array_get($payload, 'trim'), 'format' => Values::array_get($payload, 'format'), 'bitrate' => Values::array_get($payload, 'bitrate'), 'size' => Values::array_get($payload, 'size'), 'duration' => Values::array_get($payload, 'duration'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 CompositionContext Context for this CompositionInstance */ protected function proxy(): CompositionContext { if (!$this->context) { $this->context = new CompositionContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the CompositionInstance * * @return CompositionInstance Fetched CompositionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CompositionInstance { return $this->proxy()->fetch(); } /** * Delete the CompositionInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Video.V1.CompositionInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Video/V1/CompositionHookPage.php000064400000002246150515725670015526 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CompositionHookInstance \Twilio\Rest\Video\V1\CompositionHookInstance */ public function buildInstance(array $payload): CompositionHookInstance { return new CompositionHookInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Video.V1.CompositionHookPage]'; } }src/Twilio/Rest/Video/V1/CompositionContext.php000064400000003422150515725670015452 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Compositions/' . \rawurlencode($sid) . ''; } /** * Fetch the CompositionInstance * * @return CompositionInstance Fetched CompositionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CompositionInstance { $payload = $this->version->fetch('GET', $this->uri); return new CompositionInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the CompositionInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Video.V1.CompositionContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Video/V1/CompositionSettingsInstance.php000064400000007702150515725670017320 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'awsCredentialsSid' => Values::array_get($payload, 'aws_credentials_sid'), 'awsS3Url' => Values::array_get($payload, 'aws_s3_url'), 'awsStorageEnabled' => Values::array_get($payload, 'aws_storage_enabled'), 'encryptionKeySid' => Values::array_get($payload, 'encryption_key_sid'), 'encryptionEnabled' => Values::array_get($payload, 'encryption_enabled'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = []; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return CompositionSettingsContext Context for this * CompositionSettingsInstance */ protected function proxy(): CompositionSettingsContext { if (!$this->context) { $this->context = new CompositionSettingsContext($this->version); } return $this->context; } /** * Fetch the CompositionSettingsInstance * * @return CompositionSettingsInstance Fetched CompositionSettingsInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CompositionSettingsInstance { return $this->proxy()->fetch(); } /** * Create the CompositionSettingsInstance * * @param string $friendlyName A descriptive string that you create to describe * the resource * @param array|Options $options Optional Arguments * @return CompositionSettingsInstance Created CompositionSettingsInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, array $options = []): CompositionSettingsInstance { return $this->proxy()->create($friendlyName, $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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Video.V1.CompositionSettingsInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Video/V1/RecordingSettingsPage.php000064400000002262150515725670016035 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return RecordingSettingsInstance \Twilio\Rest\Video\V1\RecordingSettingsInstance */ public function buildInstance(array $payload): RecordingSettingsInstance { return new RecordingSettingsInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Video.V1.RecordingSettingsPage]'; } }src/Twilio/Rest/Video/V1/CompositionHookInstance.php000064400000011700150515725670016411 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'enabled' => Values::array_get($payload, 'enabled'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'sid' => Values::array_get($payload, 'sid'), 'audioSources' => Values::array_get($payload, 'audio_sources'), 'audioSourcesExcluded' => Values::array_get($payload, 'audio_sources_excluded'), 'videoLayout' => Values::array_get($payload, 'video_layout'), 'resolution' => Values::array_get($payload, 'resolution'), 'trim' => Values::array_get($payload, 'trim'), 'format' => Values::array_get($payload, 'format'), 'statusCallback' => Values::array_get($payload, 'status_callback'), 'statusCallbackMethod' => Values::array_get($payload, 'status_callback_method'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['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 CompositionHookContext Context for this CompositionHookInstance */ protected function proxy(): CompositionHookContext { if (!$this->context) { $this->context = new CompositionHookContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the CompositionHookInstance * * @return CompositionHookInstance Fetched CompositionHookInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CompositionHookInstance { return $this->proxy()->fetch(); } /** * Delete the CompositionHookInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the CompositionHookInstance * * @param string $friendlyName A unique string to describe the resource * @param array|Options $options Optional Arguments * @return CompositionHookInstance Updated CompositionHookInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $friendlyName, array $options = []): CompositionHookInstance { return $this->proxy()->update($friendlyName, $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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Video.V1.CompositionHookInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Video/V1/RecordingInstance.php000064400000010317150515725670015204 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'status' => Values::array_get($payload, 'status'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'sid' => Values::array_get($payload, 'sid'), 'sourceSid' => Values::array_get($payload, 'source_sid'), 'size' => Values::array_get($payload, 'size'), 'url' => Values::array_get($payload, 'url'), 'type' => Values::array_get($payload, 'type'), 'duration' => Values::array_get($payload, 'duration'), 'containerFormat' => Values::array_get($payload, 'container_format'), 'codec' => Values::array_get($payload, 'codec'), 'groupingSids' => Values::array_get($payload, 'grouping_sids'), 'trackName' => Values::array_get($payload, 'track_name'), 'offset' => Values::array_get($payload, 'offset'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 RecordingContext Context for this RecordingInstance */ protected function proxy(): RecordingContext { if (!$this->context) { $this->context = new RecordingContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the RecordingInstance * * @return RecordingInstance Fetched RecordingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RecordingInstance { return $this->proxy()->fetch(); } /** * Delete the RecordingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Video.V1.RecordingInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Video/V1/CompositionHookOptions.php000064400000063616150515725670016315 0ustar00options['enabled'] = $enabled; $this->options['dateCreatedAfter'] = $dateCreatedAfter; $this->options['dateCreatedBefore'] = $dateCreatedBefore; $this->options['friendlyName'] = $friendlyName; } /** * Read only CompositionHook resources with an `enabled` value that matches this parameter. * * @param bool $enabled Read only CompositionHook resources with an enabled * value that matches this parameter * @return $this Fluent Builder */ public function setEnabled(bool $enabled): self { $this->options['enabled'] = $enabled; return $this; } /** * Read only CompositionHook resources created on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime with time zone. * * @param \DateTime $dateCreatedAfter Read only CompositionHook resources * created on or after this ISO 8601 * datetime with time zone * @return $this Fluent Builder */ public function setDateCreatedAfter(\DateTime $dateCreatedAfter): self { $this->options['dateCreatedAfter'] = $dateCreatedAfter; return $this; } /** * Read only CompositionHook resources created before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) datetime with time zone. * * @param \DateTime $dateCreatedBefore Read only CompositionHook resources * created before this ISO 8601 datetime * with time zone * @return $this Fluent Builder */ public function setDateCreatedBefore(\DateTime $dateCreatedBefore): self { $this->options['dateCreatedBefore'] = $dateCreatedBefore; return $this; } /** * Read only CompositionHook resources with friendly names that match this string. The match is not case sensitive and can include asterisk `*` characters as wildcard match. * * @param string $friendlyName Read only CompositionHook resources with * friendly names that match this string * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Video.V1.ReadCompositionHookOptions ' . $options . ']'; } } class CreateCompositionHookOptions extends Options { /** * @param bool $enabled Whether the composition hook is active * @param array $videoLayout An object that describes the video layout of the * composition hook * @param string[] $audioSources An array of track names from the same group * room to merge * @param string[] $audioSourcesExcluded An array of track names to exclude * @param string $resolution A string that describes the rows (width) and * columns (height) of the generated composed video * in pixels * @param string $format The container format of the media files used by the * compositions created by the composition hook * @param string $statusCallback The URL we should call to send status * information to your application * @param string $statusCallbackMethod The HTTP method we should use to call * status_callback * @param bool $trim Whether to clip the intervals where there is no active * media in the Compositions triggered by the composition hook */ public function __construct(bool $enabled = Values::NONE, array $videoLayout = Values::ARRAY_NONE, array $audioSources = Values::ARRAY_NONE, array $audioSourcesExcluded = Values::ARRAY_NONE, string $resolution = Values::NONE, string $format = Values::NONE, string $statusCallback = Values::NONE, string $statusCallbackMethod = Values::NONE, bool $trim = Values::NONE) { $this->options['enabled'] = $enabled; $this->options['videoLayout'] = $videoLayout; $this->options['audioSources'] = $audioSources; $this->options['audioSourcesExcluded'] = $audioSourcesExcluded; $this->options['resolution'] = $resolution; $this->options['format'] = $format; $this->options['statusCallback'] = $statusCallback; $this->options['statusCallbackMethod'] = $statusCallbackMethod; $this->options['trim'] = $trim; } /** * Whether the composition hook is active. When `true`, the composition hook will be triggered for every completed Group Room in the account. When `false`, the composition hook will never be triggered. * * @param bool $enabled Whether the composition hook is active * @return $this Fluent Builder */ public function setEnabled(bool $enabled): self { $this->options['enabled'] = $enabled; return $this; } /** * An object that describes the video layout of the composition hook in terms of regions. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. * * @param array $videoLayout An object that describes the video layout of the * composition hook * @return $this Fluent Builder */ public function setVideoLayout(array $videoLayout): self { $this->options['videoLayout'] = $videoLayout; return $this; } /** * An array of track names from the same group room to merge into the compositions created by the composition hook. Can include zero or more track names. A composition triggered by the composition hook includes all audio sources specified in `audio_sources` except those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` includes tracks named `student` as well as `studentTeam`. * * @param string[] $audioSources An array of track names from the same group * room to merge * @return $this Fluent Builder */ public function setAudioSources(array $audioSources): self { $this->options['audioSources'] = $audioSources; return $this; } /** * An array of track names to exclude. A composition triggered by the composition hook includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` excludes `student` as well as `studentTeam`. This parameter can also be empty. * * @param string[] $audioSourcesExcluded An array of track names to exclude * @return $this Fluent Builder */ public function setAudioSourcesExcluded(array $audioSourcesExcluded): self { $this->options['audioSourcesExcluded'] = $audioSourcesExcluded; return $this; } /** * A string that describes the columns (width) and rows (height) of the generated composed video in pixels. Defaults to `640x480`. The string's format is `{width}x{height}` where: * 16 <= `{width}` <= 1280 * 16 <= `{height}` <= 1280 * `{width}` * `{height}` <= 921,600 Typical values are: * HD = `1280x720` * PAL = `1024x576` * VGA = `640x480` * CIF = `320x240` Note that the `resolution` imposes an aspect ratio to the resulting composition. When the original video tracks are constrained by the aspect ratio, they are scaled to fit. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. * * @param string $resolution A string that describes the rows (width) and * columns (height) of the generated composed video * in pixels * @return $this Fluent Builder */ public function setResolution(string $resolution): self { $this->options['resolution'] = $resolution; return $this; } /** * The container format of the media files used by the compositions created by the composition hook. Can be: `mp4` or `webm` and the default is `webm`. If `mp4` or `webm`, `audio_sources` must have one or more tracks and/or a `video_layout` element must contain a valid `video_sources` list, otherwise an error occurs. * * @param string $format The container format of the media files used by the * compositions created by the composition hook * @return $this Fluent Builder */ public function setFormat(string $format): self { $this->options['format'] = $format; return $this; } /** * The URL we should call using the `status_callback_method` to send status information to your application on every composition event. If not provided, status callback events will not be dispatched. * * @param string $statusCallback The URL we should call to send status * information to your application * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * The HTTP method we should use to call `status_callback`. Can be: `POST` or `GET` and the default is `POST`. * * @param string $statusCallbackMethod The HTTP method we should use to call * status_callback * @return $this Fluent Builder */ public function setStatusCallbackMethod(string $statusCallbackMethod): self { $this->options['statusCallbackMethod'] = $statusCallbackMethod; return $this; } /** * Whether to clip the intervals where there is no active media in the Compositions triggered by the composition hook. The default is `true`. Compositions with `trim` enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. * * @param bool $trim Whether to clip the intervals where there is no active * media in the Compositions triggered by the composition hook * @return $this Fluent Builder */ public function setTrim(bool $trim): self { $this->options['trim'] = $trim; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Video.V1.CreateCompositionHookOptions ' . $options . ']'; } } class UpdateCompositionHookOptions extends Options { /** * @param bool $enabled Whether the composition hook is active * @param array $videoLayout A JSON object that describes the video layout of * the composition hook * @param string[] $audioSources An array of track names from the same group * room to merge * @param string[] $audioSourcesExcluded An array of track names to exclude * @param bool $trim Whether to clip the intervals where there is no active * media in the Compositions triggered by the composition hook * @param string $format The container format of the media files used by the * compositions created by the composition hook * @param string $resolution A string that describes the columns (width) and * rows (height) of the generated composed video in * pixels * @param string $statusCallback The URL we should call to send status * information to your application * @param string $statusCallbackMethod The HTTP method we should use to call * status_callback */ public function __construct(bool $enabled = Values::NONE, array $videoLayout = Values::ARRAY_NONE, array $audioSources = Values::ARRAY_NONE, array $audioSourcesExcluded = Values::ARRAY_NONE, bool $trim = Values::NONE, string $format = Values::NONE, string $resolution = Values::NONE, string $statusCallback = Values::NONE, string $statusCallbackMethod = Values::NONE) { $this->options['enabled'] = $enabled; $this->options['videoLayout'] = $videoLayout; $this->options['audioSources'] = $audioSources; $this->options['audioSourcesExcluded'] = $audioSourcesExcluded; $this->options['trim'] = $trim; $this->options['format'] = $format; $this->options['resolution'] = $resolution; $this->options['statusCallback'] = $statusCallback; $this->options['statusCallbackMethod'] = $statusCallbackMethod; } /** * Whether the composition hook is active. When `true`, the composition hook will be triggered for every completed Group Room in the account. When `false`, the composition hook never triggers. * * @param bool $enabled Whether the composition hook is active * @return $this Fluent Builder */ public function setEnabled(bool $enabled): self { $this->options['enabled'] = $enabled; return $this; } /** * A JSON object that describes the video layout of the composition hook in terms of regions. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. * * @param array $videoLayout A JSON object that describes the video layout of * the composition hook * @return $this Fluent Builder */ public function setVideoLayout(array $videoLayout): self { $this->options['videoLayout'] = $videoLayout; return $this; } /** * An array of track names from the same group room to merge into the compositions created by the composition hook. Can include zero or more track names. A composition triggered by the composition hook includes all audio sources specified in `audio_sources` except those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` includes tracks named `student` as well as `studentTeam`. * * @param string[] $audioSources An array of track names from the same group * room to merge * @return $this Fluent Builder */ public function setAudioSources(array $audioSources): self { $this->options['audioSources'] = $audioSources; return $this; } /** * An array of track names to exclude. A composition triggered by the composition hook includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` excludes `student` as well as `studentTeam`. This parameter can also be empty. * * @param string[] $audioSourcesExcluded An array of track names to exclude * @return $this Fluent Builder */ public function setAudioSourcesExcluded(array $audioSourcesExcluded): self { $this->options['audioSourcesExcluded'] = $audioSourcesExcluded; return $this; } /** * Whether to clip the intervals where there is no active media in the compositions triggered by the composition hook. The default is `true`. Compositions with `trim` enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. * * @param bool $trim Whether to clip the intervals where there is no active * media in the Compositions triggered by the composition hook * @return $this Fluent Builder */ public function setTrim(bool $trim): self { $this->options['trim'] = $trim; return $this; } /** * The container format of the media files used by the compositions created by the composition hook. Can be: `mp4` or `webm` and the default is `webm`. If `mp4` or `webm`, `audio_sources` must have one or more tracks and/or a `video_layout` element must contain a valid `video_sources` list, otherwise an error occurs. * * @param string $format The container format of the media files used by the * compositions created by the composition hook * @return $this Fluent Builder */ public function setFormat(string $format): self { $this->options['format'] = $format; return $this; } /** * A string that describes the columns (width) and rows (height) of the generated composed video in pixels. Defaults to `640x480`. The string's format is `{width}x{height}` where: * 16 <= `{width}` <= 1280 * 16 <= `{height}` <= 1280 * `{width}` * `{height}` <= 921,600 Typical values are: * HD = `1280x720` * PAL = `1024x576` * VGA = `640x480` * CIF = `320x240` Note that the `resolution` imposes an aspect ratio to the resulting composition. When the original video tracks are constrained by the aspect ratio, they are scaled to fit. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. * * @param string $resolution A string that describes the columns (width) and * rows (height) of the generated composed video in * pixels * @return $this Fluent Builder */ public function setResolution(string $resolution): self { $this->options['resolution'] = $resolution; return $this; } /** * The URL we should call using the `status_callback_method` to send status information to your application on every composition event. If not provided, status callback events will not be dispatched. * * @param string $statusCallback The URL we should call to send status * information to your application * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * The HTTP method we should use to call `status_callback`. Can be: `POST` or `GET` and the default is `POST`. * * @param string $statusCallbackMethod The HTTP method we should use to call * status_callback * @return $this Fluent Builder */ public function setStatusCallbackMethod(string $statusCallbackMethod): self { $this->options['statusCallbackMethod'] = $statusCallbackMethod; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Video.V1.UpdateCompositionHookOptions ' . $options . ']'; } }src/Twilio/Rest/Video/V1/RecordingPage.php000064400000002202150515725670014306 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return RecordingInstance \Twilio\Rest\Video\V1\RecordingInstance */ public function buildInstance(array $payload): RecordingInstance { return new RecordingInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Video.V1.RecordingPage]'; } }src/Twilio/Rest/Video/V1/CompositionSettingsPage.php000064400000002276150515725670016431 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CompositionSettingsInstance \Twilio\Rest\Video\V1\CompositionSettingsInstance */ public function buildInstance(array $payload): CompositionSettingsInstance { return new CompositionSettingsInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Video.V1.CompositionSettingsPage]'; } }src/Twilio/Rest/Video/V1.php000064400000010146150515725670011603 0ustar00version = 'v1'; } protected function getCompositions(): CompositionList { if (!$this->_compositions) { $this->_compositions = new CompositionList($this); } return $this->_compositions; } protected function getCompositionHooks(): CompositionHookList { if (!$this->_compositionHooks) { $this->_compositionHooks = new CompositionHookList($this); } return $this->_compositionHooks; } protected function getCompositionSettings(): CompositionSettingsList { if (!$this->_compositionSettings) { $this->_compositionSettings = new CompositionSettingsList($this); } return $this->_compositionSettings; } protected function getRecordings(): RecordingList { if (!$this->_recordings) { $this->_recordings = new RecordingList($this); } return $this->_recordings; } protected function getRecordingSettings(): RecordingSettingsList { if (!$this->_recordingSettings) { $this->_recordingSettings = new RecordingSettingsList($this); } return $this->_recordingSettings; } protected function getRooms(): RoomList { if (!$this->_rooms) { $this->_rooms = new RoomList($this); } return $this->_rooms; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Video.V1]'; } }src/Twilio/Rest/Wireless/V1/UsageRecordInstance.php000064400000003565150515725670016231 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'period' => Values::array_get($payload, 'period'), 'commands' => Values::array_get($payload, 'commands'), 'data' => Values::array_get($payload, 'data'), ]; $this->solution = []; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Wireless.V1.UsageRecordInstance]'; } }src/Twilio/Rest/Wireless/V1/CommandOptions.php000064400000022206150515725670015264 0ustar00options['sim'] = $sim; $this->options['status'] = $status; $this->options['direction'] = $direction; $this->options['transport'] = $transport; } /** * The `sid` or `unique_name` of the [Sim resources](https://www.twilio.com/docs/wireless/api/sim-resource) to read. * * @param string $sim The sid or unique_name of the Sim resources to read * @return $this Fluent Builder */ public function setSim(string $sim): self { $this->options['sim'] = $sim; return $this; } /** * The status of the resources to read. Can be: `queued`, `sent`, `delivered`, `received`, or `failed`. * * @param string $status The status of the resources to read * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * Only return Commands with this direction value. * * @param string $direction Only return Commands with this direction value * @return $this Fluent Builder */ public function setDirection(string $direction): self { $this->options['direction'] = $direction; return $this; } /** * Only return Commands with this transport value. Can be: `sms` or `ip`. * * @param string $transport Only return Commands with this transport value * @return $this Fluent Builder */ public function setTransport(string $transport): self { $this->options['transport'] = $transport; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Wireless.V1.ReadCommandOptions ' . $options . ']'; } } class CreateCommandOptions extends Options { /** * @param string $sim The sid or unique_name of the SIM to send the Command to * @param string $callbackMethod The HTTP method we use to call callback_url * @param string $callbackUrl he URL we call when the Command has finished * sending * @param string $commandMode The mode to use when sending the SMS message * @param string $includeSid Whether to include the SID of the command in the * message body * @param bool $deliveryReceiptRequested Whether to request delivery receipt * from the recipient */ public function __construct(string $sim = Values::NONE, string $callbackMethod = Values::NONE, string $callbackUrl = Values::NONE, string $commandMode = Values::NONE, string $includeSid = Values::NONE, bool $deliveryReceiptRequested = Values::NONE) { $this->options['sim'] = $sim; $this->options['callbackMethod'] = $callbackMethod; $this->options['callbackUrl'] = $callbackUrl; $this->options['commandMode'] = $commandMode; $this->options['includeSid'] = $includeSid; $this->options['deliveryReceiptRequested'] = $deliveryReceiptRequested; } /** * The `sid` or `unique_name` of the [SIM](https://www.twilio.com/docs/wireless/api/sim-resource) to send the Command to. * * @param string $sim The sid or unique_name of the SIM to send the Command to * @return $this Fluent Builder */ public function setSim(string $sim): self { $this->options['sim'] = $sim; return $this; } /** * The HTTP method we use to call `callback_url`. Can be: `POST` or `GET`, and the default is `POST`. * * @param string $callbackMethod The HTTP method we use to call callback_url * @return $this Fluent Builder */ public function setCallbackMethod(string $callbackMethod): self { $this->options['callbackMethod'] = $callbackMethod; return $this; } /** * The URL we call using the `callback_url` when the Command has finished sending, whether the command was delivered or it failed. * * @param string $callbackUrl he URL we call when the Command has finished * sending * @return $this Fluent Builder */ public function setCallbackUrl(string $callbackUrl): self { $this->options['callbackUrl'] = $callbackUrl; return $this; } /** * The mode to use when sending the SMS message. Can be: `text` or `binary`. The default SMS mode is `text`. * * @param string $commandMode The mode to use when sending the SMS message * @return $this Fluent Builder */ public function setCommandMode(string $commandMode): self { $this->options['commandMode'] = $commandMode; return $this; } /** * Whether to include the SID of the command in the message body. Can be: `none`, `start`, or `end`, and the default behavior is `none`. When sending a Command to a SIM in text mode, we can automatically include the SID of the Command in the message body, which could be used to ensure that the device does not process the same Command more than once. A value of `start` will prepend the message with the Command SID, and `end` will append it to the end, separating the Command SID from the message body with a space. The length of the Command SID is included in the 160 character limit so the SMS body must be 128 characters or less before the Command SID is included. * * @param string $includeSid Whether to include the SID of the command in the * message body * @return $this Fluent Builder */ public function setIncludeSid(string $includeSid): self { $this->options['includeSid'] = $includeSid; return $this; } /** * Whether to request delivery receipt from the recipient. For Commands that request delivery receipt, the Command state transitions to 'delivered' once the server has received a delivery receipt from the device. The default value is `true`. * * @param bool $deliveryReceiptRequested Whether to request delivery receipt * from the recipient * @return $this Fluent Builder */ public function setDeliveryReceiptRequested(bool $deliveryReceiptRequested): self { $this->options['deliveryReceiptRequested'] = $deliveryReceiptRequested; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Wireless.V1.CreateCommandOptions ' . $options . ']'; } }src/Twilio/Rest/Wireless/V1/SimPage.php000064400000002147150515725670013661 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SimInstance \Twilio\Rest\Wireless\V1\SimInstance */ public function buildInstance(array $payload): SimInstance { return new SimInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Wireless.V1.SimPage]'; } }src/Twilio/Rest/Wireless/V1/CommandPage.php000064400000002177150515725670014512 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CommandInstance \Twilio\Rest\Wireless\V1\CommandInstance */ public function buildInstance(array $payload): CommandInstance { return new CommandInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Wireless.V1.CommandPage]'; } }src/Twilio/Rest/Wireless/V1/SimOptions.php000064400000046313150515725670014443 0ustar00options['status'] = $status; $this->options['iccid'] = $iccid; $this->options['ratePlan'] = $ratePlan; $this->options['eId'] = $eId; $this->options['simRegistrationCode'] = $simRegistrationCode; } /** * Only return Sim resources with this status. * * @param string $status Only return Sim resources with this status * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * Only return Sim resources with this ICCID. This will return a list with a maximum size of 1. * * @param string $iccid Only return Sim resources with this ICCID * @return $this Fluent Builder */ public function setIccid(string $iccid): self { $this->options['iccid'] = $iccid; return $this; } /** * The SID or unique name of a [RatePlan resource](https://www.twilio.com/docs/wireless/api/rateplan-resource). Only return Sim resources assigned to this RatePlan resource. * * @param string $ratePlan Only return Sim resources assigned to this RatePlan * resource * @return $this Fluent Builder */ public function setRatePlan(string $ratePlan): self { $this->options['ratePlan'] = $ratePlan; return $this; } /** * Deprecated. * * @param string $eId Deprecated * @return $this Fluent Builder */ public function setEId(string $eId): self { $this->options['eId'] = $eId; return $this; } /** * Only return Sim resources with this registration code. This will return a list with a maximum size of 1. * * @param string $simRegistrationCode Only return Sim resources with this * registration code * @return $this Fluent Builder */ public function setSimRegistrationCode(string $simRegistrationCode): self { $this->options['simRegistrationCode'] = $simRegistrationCode; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Wireless.V1.ReadSimOptions ' . $options . ']'; } } class UpdateSimOptions extends Options { /** * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @param string $callbackMethod The HTTP method we should use to call * callback_url * @param string $callbackUrl The URL we should call when the Sim resource has * finished updating * @param string $friendlyName A string to describe the Sim resource * @param string $ratePlan The SID or unique name of the RatePlan resource to * which the Sim resource should be assigned * @param string $status The new status of the Sim resource * @param string $commandsCallbackMethod The HTTP method we should use to call * commands_callback_url * @param string $commandsCallbackUrl The URL we should call when the SIM sends * a Command * @param string $smsFallbackMethod The HTTP method we should use to call * sms_fallback_url * @param string $smsFallbackUrl The URL we should call when an error occurs * while retrieving or executing the TwiML * requested from sms_url * @param string $smsMethod The HTTP method we should use to call sms_url * @param string $smsUrl The URL we should call when the SIM-connected device * sends an SMS message that is not a Command * @param string $voiceFallbackMethod Deprecated * @param string $voiceFallbackUrl Deprecated * @param string $voiceMethod Deprecated * @param string $voiceUrl Deprecated * @param string $resetStatus Initiate a connectivity reset on a SIM * @param string $accountSid The SID of the Account to which the Sim resource * should belong */ public function __construct(string $uniqueName = Values::NONE, string $callbackMethod = Values::NONE, string $callbackUrl = Values::NONE, string $friendlyName = Values::NONE, string $ratePlan = Values::NONE, string $status = Values::NONE, string $commandsCallbackMethod = Values::NONE, string $commandsCallbackUrl = Values::NONE, string $smsFallbackMethod = Values::NONE, string $smsFallbackUrl = Values::NONE, string $smsMethod = Values::NONE, string $smsUrl = Values::NONE, string $voiceFallbackMethod = Values::NONE, string $voiceFallbackUrl = Values::NONE, string $voiceMethod = Values::NONE, string $voiceUrl = Values::NONE, string $resetStatus = Values::NONE, string $accountSid = Values::NONE) { $this->options['uniqueName'] = $uniqueName; $this->options['callbackMethod'] = $callbackMethod; $this->options['callbackUrl'] = $callbackUrl; $this->options['friendlyName'] = $friendlyName; $this->options['ratePlan'] = $ratePlan; $this->options['status'] = $status; $this->options['commandsCallbackMethod'] = $commandsCallbackMethod; $this->options['commandsCallbackUrl'] = $commandsCallbackUrl; $this->options['smsFallbackMethod'] = $smsFallbackMethod; $this->options['smsFallbackUrl'] = $smsFallbackUrl; $this->options['smsMethod'] = $smsMethod; $this->options['smsUrl'] = $smsUrl; $this->options['voiceFallbackMethod'] = $voiceFallbackMethod; $this->options['voiceFallbackUrl'] = $voiceFallbackUrl; $this->options['voiceMethod'] = $voiceMethod; $this->options['voiceUrl'] = $voiceUrl; $this->options['resetStatus'] = $resetStatus; $this->options['accountSid'] = $accountSid; } /** * An application-defined string that uniquely identifies the resource. It can be used in place of the `sid` in the URL path to address the resource. * * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * The HTTP method we should use to call `callback_url`. Can be: `POST` or `GET`. The default is `POST`. * * @param string $callbackMethod The HTTP method we should use to call * callback_url * @return $this Fluent Builder */ public function setCallbackMethod(string $callbackMethod): self { $this->options['callbackMethod'] = $callbackMethod; return $this; } /** * The URL we should call using the `callback_url` when the SIM has finished updating. When the SIM transitions from `new` to `ready` or from any status to `deactivated`, we call this URL when the status changes to an intermediate status (`ready` or `deactivated`) and again when the status changes to its final status (`active` or `canceled`). * * @param string $callbackUrl The URL we should call when the Sim resource has * finished updating * @return $this Fluent Builder */ public function setCallbackUrl(string $callbackUrl): self { $this->options['callbackUrl'] = $callbackUrl; return $this; } /** * A descriptive string that you create to describe the Sim resource. It does not need to be unique. * * @param string $friendlyName A string to describe the Sim resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The SID or unique name of the [RatePlan resource](https://www.twilio.com/docs/wireless/api/rateplan-resource) to which the Sim resource should be assigned. * * @param string $ratePlan The SID or unique name of the RatePlan resource to * which the Sim resource should be assigned * @return $this Fluent Builder */ public function setRatePlan(string $ratePlan): self { $this->options['ratePlan'] = $ratePlan; return $this; } /** * The new status of the Sim resource. Can be: `ready`, `active`, `suspended`, or `deactivated`. * * @param string $status The new status of the Sim resource * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * The HTTP method we should use to call `commands_callback_url`. Can be: `POST` or `GET`. The default is `POST`. * * @param string $commandsCallbackMethod The HTTP method we should use to call * commands_callback_url * @return $this Fluent Builder */ public function setCommandsCallbackMethod(string $commandsCallbackMethod): self { $this->options['commandsCallbackMethod'] = $commandsCallbackMethod; return $this; } /** * The URL we should call using the `commands_callback_method` when the SIM sends a [Command](https://www.twilio.com/docs/wireless/api/command-resource). Your server should respond with an HTTP status code in the 200 range; any response body is ignored. * * @param string $commandsCallbackUrl The URL we should call when the SIM sends * a Command * @return $this Fluent Builder */ public function setCommandsCallbackUrl(string $commandsCallbackUrl): self { $this->options['commandsCallbackUrl'] = $commandsCallbackUrl; return $this; } /** * The HTTP method we should use to call `sms_fallback_url`. Can be: `GET` or `POST`. Default is `POST`. * * @param string $smsFallbackMethod The HTTP method we should use to call * sms_fallback_url * @return $this Fluent Builder */ public function setSmsFallbackMethod(string $smsFallbackMethod): self { $this->options['smsFallbackMethod'] = $smsFallbackMethod; return $this; } /** * The URL we should call using the `sms_fallback_method` when an error occurs while retrieving or executing the TwiML requested from `sms_url`. * * @param string $smsFallbackUrl The URL we should call when an error occurs * while retrieving or executing the TwiML * requested from sms_url * @return $this Fluent Builder */ public function setSmsFallbackUrl(string $smsFallbackUrl): self { $this->options['smsFallbackUrl'] = $smsFallbackUrl; return $this; } /** * The HTTP method we should use to call `sms_url`. Can be: `GET` or `POST`. Default is `POST`. * * @param string $smsMethod The HTTP method we should use to call sms_url * @return $this Fluent Builder */ public function setSmsMethod(string $smsMethod): self { $this->options['smsMethod'] = $smsMethod; return $this; } /** * The URL we should call using the `sms_method` when the SIM-connected device sends an SMS message that is not a [Command](https://www.twilio.com/docs/wireless/api/command-resource). * * @param string $smsUrl The URL we should call when the SIM-connected device * sends an SMS message that is not a Command * @return $this Fluent Builder */ public function setSmsUrl(string $smsUrl): self { $this->options['smsUrl'] = $smsUrl; return $this; } /** * Deprecated. * * @param string $voiceFallbackMethod Deprecated * @return $this Fluent Builder */ public function setVoiceFallbackMethod(string $voiceFallbackMethod): self { $this->options['voiceFallbackMethod'] = $voiceFallbackMethod; return $this; } /** * Deprecated. * * @param string $voiceFallbackUrl Deprecated * @return $this Fluent Builder */ public function setVoiceFallbackUrl(string $voiceFallbackUrl): self { $this->options['voiceFallbackUrl'] = $voiceFallbackUrl; return $this; } /** * Deprecated. * * @param string $voiceMethod Deprecated * @return $this Fluent Builder */ public function setVoiceMethod(string $voiceMethod): self { $this->options['voiceMethod'] = $voiceMethod; return $this; } /** * Deprecated. * * @param string $voiceUrl Deprecated * @return $this Fluent Builder */ public function setVoiceUrl(string $voiceUrl): self { $this->options['voiceUrl'] = $voiceUrl; return $this; } /** * Initiate a connectivity reset on the SIM. Set to `resetting` to initiate a connectivity reset on the SIM. No other value is valid. * * @param string $resetStatus Initiate a connectivity reset on a SIM * @return $this Fluent Builder */ public function setResetStatus(string $resetStatus): self { $this->options['resetStatus'] = $resetStatus; return $this; } /** * The SID of the [Account](https://www.twilio.com/docs/iam/api/account) to which the Sim resource should belong. The Account SID can only be that of the requesting Account or that of a [Subaccount](https://www.twilio.com/docs/iam/api/subaccounts) of the requesting Account. Only valid when the Sim resource's status is `new`. For more information, see the [Move SIMs between Subaccounts documentation](https://www.twilio.com/docs/wireless/api/sim-resource#move-sims-between-subaccounts). * * @param string $accountSid The SID of the Account to which the Sim resource * should belong * @return $this Fluent Builder */ public function setAccountSid(string $accountSid): self { $this->options['accountSid'] = $accountSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Wireless.V1.UpdateSimOptions ' . $options . ']'; } }src/Twilio/Rest/Wireless/V1/UsageRecordList.php000064400000011575150515725670015400 0ustar00solution = []; $this->uri = '/UsageRecords'; } /** * Streams UsageRecordInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads UsageRecordInstance 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 UsageRecordInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of UsageRecordInstance 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 UsageRecordPage Page of UsageRecordInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): UsageRecordPage { $options = new Values($options); $params = Values::of([ 'End' => Serialize::iso8601DateTime($options['end']), 'Start' => Serialize::iso8601DateTime($options['start']), 'Granularity' => $options['granularity'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new UsageRecordPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of UsageRecordInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return UsageRecordPage Page of UsageRecordInstance */ public function getPage(string $targetUrl): UsageRecordPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new UsageRecordPage($this->version, $response, $this->solution); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Wireless.V1.UsageRecordList]'; } }src/Twilio/Rest/Wireless/V1/SimContext.php000064400000012247150515725670014433 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Sims/' . \rawurlencode($sid) . ''; } /** * Fetch the SimInstance * * @return SimInstance Fetched SimInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SimInstance { $payload = $this->version->fetch('GET', $this->uri); return new SimInstance($this->version, $payload, $this->solution['sid']); } /** * Update the SimInstance * * @param array|Options $options Optional Arguments * @return SimInstance Updated SimInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SimInstance { $options = new Values($options); $data = Values::of([ 'UniqueName' => $options['uniqueName'], 'CallbackMethod' => $options['callbackMethod'], 'CallbackUrl' => $options['callbackUrl'], 'FriendlyName' => $options['friendlyName'], 'RatePlan' => $options['ratePlan'], 'Status' => $options['status'], 'CommandsCallbackMethod' => $options['commandsCallbackMethod'], 'CommandsCallbackUrl' => $options['commandsCallbackUrl'], 'SmsFallbackMethod' => $options['smsFallbackMethod'], 'SmsFallbackUrl' => $options['smsFallbackUrl'], 'SmsMethod' => $options['smsMethod'], 'SmsUrl' => $options['smsUrl'], 'VoiceFallbackMethod' => $options['voiceFallbackMethod'], 'VoiceFallbackUrl' => $options['voiceFallbackUrl'], 'VoiceMethod' => $options['voiceMethod'], 'VoiceUrl' => $options['voiceUrl'], 'ResetStatus' => $options['resetStatus'], 'AccountSid' => $options['accountSid'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new SimInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the SimInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the usageRecords */ protected function getUsageRecords(): UsageRecordList { if (!$this->_usageRecords) { $this->_usageRecords = new UsageRecordList($this->version, $this->solution['sid']); } return $this->_usageRecords; } /** * Access the dataSessions */ protected function getDataSessions(): DataSessionList { if (!$this->_dataSessions) { $this->_dataSessions = new DataSessionList($this->version, $this->solution['sid']); } return $this->_dataSessions; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Wireless.V1.SimContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Wireless/V1/RatePlanContext.php000064400000004640150515725670015407 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/RatePlans/' . \rawurlencode($sid) . ''; } /** * Fetch the RatePlanInstance * * @return RatePlanInstance Fetched RatePlanInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RatePlanInstance { $payload = $this->version->fetch('GET', $this->uri); return new RatePlanInstance($this->version, $payload, $this->solution['sid']); } /** * Update the RatePlanInstance * * @param array|Options $options Optional Arguments * @return RatePlanInstance Updated RatePlanInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): RatePlanInstance { $options = new Values($options); $data = Values::of([ 'UniqueName' => $options['uniqueName'], 'FriendlyName' => $options['friendlyName'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new RatePlanInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the RatePlanInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Wireless.V1.RatePlanContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Wireless/V1/RatePlanPage.php000064400000002205150515725670014632 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return RatePlanInstance \Twilio\Rest\Wireless\V1\RatePlanInstance */ public function buildInstance(array $payload): RatePlanInstance { return new RatePlanInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Wireless.V1.RatePlanPage]'; } }src/Twilio/Rest/Wireless/V1/SimList.php000064400000011776150515725670013730 0ustar00solution = []; $this->uri = '/Sims'; } /** * Streams SimInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads SimInstance 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 SimInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of SimInstance 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 SimPage Page of SimInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SimPage { $options = new Values($options); $params = Values::of([ 'Status' => $options['status'], 'Iccid' => $options['iccid'], 'RatePlan' => $options['ratePlan'], 'EId' => $options['eId'], 'SimRegistrationCode' => $options['simRegistrationCode'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new SimPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of SimInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return SimPage Page of SimInstance */ public function getPage(string $targetUrl): SimPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new SimPage($this->version, $response, $this->solution); } /** * Constructs a SimContext * * @param string $sid The SID of the Sim resource to fetch */ public function getContext(string $sid): SimContext { return new SimContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Wireless.V1.SimList]'; } }src/Twilio/Rest/Wireless/V1/CommandContext.php000064400000003360150515725670015255 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Commands/' . \rawurlencode($sid) . ''; } /** * Fetch the CommandInstance * * @return CommandInstance Fetched CommandInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CommandInstance { $payload = $this->version->fetch('GET', $this->uri); return new CommandInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the CommandInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Wireless.V1.CommandContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Wireless/V1/UsageRecordOptions.php000064400000006360150515725670016114 0ustar00options['end'] = $end; $this->options['start'] = $start; $this->options['granularity'] = $granularity; } /** * Only include usage that has occurred on or before this date. Format is [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). * * @param \DateTime $end Only include usage that has occurred on or before this * date * @return $this Fluent Builder */ public function setEnd(\DateTime $end): self { $this->options['end'] = $end; return $this; } /** * Only include usage that has occurred on or after this date. Format is [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). * * @param \DateTime $start Only include usage that has occurred on or after * this date * @return $this Fluent Builder */ public function setStart(\DateTime $start): self { $this->options['start'] = $start; return $this; } /** * How to summarize the usage by time. Can be: `daily`, `hourly`, or `all`. A value of `all` returns one Usage Record that describes the usage for the entire period. * * @param string $granularity The time-based grouping that results are * aggregated by * @return $this Fluent Builder */ public function setGranularity(string $granularity): self { $this->options['granularity'] = $granularity; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Wireless.V1.ReadUsageRecordOptions ' . $options . ']'; } }src/Twilio/Rest/Wireless/V1/Sim/UsageRecordInstance.php000064400000004156150515725670016756 0ustar00properties = [ 'simSid' => Values::array_get($payload, 'sim_sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'period' => Values::array_get($payload, 'period'), 'commands' => Values::array_get($payload, 'commands'), 'data' => Values::array_get($payload, 'data'), ]; $this->solution = ['simSid' => $simSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Wireless.V1.UsageRecordInstance]'; } }src/Twilio/Rest/Wireless/V1/Sim/UsageRecordList.php000064400000012076150515725670016125 0ustar00solution = ['simSid' => $simSid, ]; $this->uri = '/Sims/' . \rawurlencode($simSid) . '/UsageRecords'; } /** * Streams UsageRecordInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads UsageRecordInstance 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 UsageRecordInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of UsageRecordInstance 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 UsageRecordPage Page of UsageRecordInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): UsageRecordPage { $options = new Values($options); $params = Values::of([ 'End' => Serialize::iso8601DateTime($options['end']), 'Start' => Serialize::iso8601DateTime($options['start']), 'Granularity' => $options['granularity'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new UsageRecordPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of UsageRecordInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return UsageRecordPage Page of UsageRecordInstance */ public function getPage(string $targetUrl): UsageRecordPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new UsageRecordPage($this->version, $response, $this->solution); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Wireless.V1.UsageRecordList]'; } }src/Twilio/Rest/Wireless/V1/Sim/DataSessionPage.php000064400000002272150515725670016075 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return DataSessionInstance \Twilio\Rest\Wireless\V1\Sim\DataSessionInstance */ public function buildInstance(array $payload): DataSessionInstance { return new DataSessionInstance($this->version, $payload, $this->solution['simSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Wireless.V1.DataSessionPage]'; } }src/Twilio/Rest/Wireless/V1/Sim/DataSessionInstance.php000064400000006561150515725670016772 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'simSid' => Values::array_get($payload, 'sim_sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'radioLink' => Values::array_get($payload, 'radio_link'), 'operatorMcc' => Values::array_get($payload, 'operator_mcc'), 'operatorMnc' => Values::array_get($payload, 'operator_mnc'), 'operatorCountry' => Values::array_get($payload, 'operator_country'), 'operatorName' => Values::array_get($payload, 'operator_name'), 'cellId' => Values::array_get($payload, 'cell_id'), 'cellLocationEstimate' => Values::array_get($payload, 'cell_location_estimate'), 'packetsUploaded' => Values::array_get($payload, 'packets_uploaded'), 'packetsDownloaded' => Values::array_get($payload, 'packets_downloaded'), 'lastUpdated' => Deserialize::dateTime(Values::array_get($payload, 'last_updated')), 'start' => Deserialize::dateTime(Values::array_get($payload, 'start')), 'end' => Deserialize::dateTime(Values::array_get($payload, 'end')), 'imei' => Values::array_get($payload, 'imei'), ]; $this->solution = ['simSid' => $simSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Wireless.V1.DataSessionInstance]'; } }src/Twilio/Rest/Wireless/V1/Sim/DataSessionList.php000064400000011003150515725670016124 0ustar00solution = ['simSid' => $simSid, ]; $this->uri = '/Sims/' . \rawurlencode($simSid) . '/DataSessions'; } /** * Streams DataSessionInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads DataSessionInstance 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 DataSessionInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of DataSessionInstance 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 DataSessionPage Page of DataSessionInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): DataSessionPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new DataSessionPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of DataSessionInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return DataSessionPage Page of DataSessionInstance */ public function getPage(string $targetUrl): DataSessionPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new DataSessionPage($this->version, $response, $this->solution); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Wireless.V1.DataSessionList]'; } }src/Twilio/Rest/Wireless/V1/Sim/UsageRecordOptions.php000064400000006405150515725670016644 0ustar00options['end'] = $end; $this->options['start'] = $start; $this->options['granularity'] = $granularity; } /** * Only include usage that occurred on or before this date, specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). The default is the current time. * * @param \DateTime $end Only include usage that occurred on or before this date * @return $this Fluent Builder */ public function setEnd(\DateTime $end): self { $this->options['end'] = $end; return $this; } /** * Only include usage that has occurred on or after this date, specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html). The default is one month before the `end` parameter value. * * @param \DateTime $start Only include usage that has occurred on or after * this date * @return $this Fluent Builder */ public function setStart(\DateTime $start): self { $this->options['start'] = $start; return $this; } /** * How to summarize the usage by time. Can be: `daily`, `hourly`, or `all`. The default is `all`. A value of `all` returns one Usage Record that describes the usage for the entire period. * * @param string $granularity The time-based grouping that results are * aggregated by * @return $this Fluent Builder */ public function setGranularity(string $granularity): self { $this->options['granularity'] = $granularity; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Wireless.V1.ReadUsageRecordOptions ' . $options . ']'; } }src/Twilio/Rest/Wireless/V1/Sim/UsageRecordPage.php000064400000002272150515725670016063 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return UsageRecordInstance \Twilio\Rest\Wireless\V1\Sim\UsageRecordInstance */ public function buildInstance(array $payload): UsageRecordInstance { return new UsageRecordInstance($this->version, $payload, $this->solution['simSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Wireless.V1.UsageRecordPage]'; } }src/Twilio/Rest/Wireless/V1/UsageRecordPage.php000064400000002227150515725670015333 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return UsageRecordInstance \Twilio\Rest\Wireless\V1\UsageRecordInstance */ public function buildInstance(array $payload): UsageRecordInstance { return new UsageRecordInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Wireless.V1.UsageRecordPage]'; } }src/Twilio/Rest/Wireless/V1/CommandInstance.php000064400000010000150515725670015362 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'simSid' => Values::array_get($payload, 'sim_sid'), 'command' => Values::array_get($payload, 'command'), 'commandMode' => Values::array_get($payload, 'command_mode'), 'transport' => Values::array_get($payload, 'transport'), 'deliveryReceiptRequested' => Values::array_get($payload, 'delivery_receipt_requested'), 'status' => Values::array_get($payload, 'status'), 'direction' => Values::array_get($payload, 'direction'), '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 = ['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 CommandContext Context for this CommandInstance */ protected function proxy(): CommandContext { if (!$this->context) { $this->context = new CommandContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the CommandInstance * * @return CommandInstance Fetched CommandInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CommandInstance { return $this->proxy()->fetch(); } /** * Delete the CommandInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Wireless.V1.CommandInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Wireless/V1/CommandList.php000064400000014216150515725670014546 0ustar00solution = []; $this->uri = '/Commands'; } /** * Streams CommandInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param array|Options $options Optional Arguments * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads CommandInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param array|Options $options Optional Arguments * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return CommandInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of CommandInstance records from the API. * Request is executed immediately * * @param array|Options $options Optional Arguments * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return CommandPage Page of CommandInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): CommandPage { $options = new Values($options); $params = Values::of([ 'Sim' => $options['sim'], 'Status' => $options['status'], 'Direction' => $options['direction'], 'Transport' => $options['transport'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new CommandPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of CommandInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return CommandPage Page of CommandInstance */ public function getPage(string $targetUrl): CommandPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new CommandPage($this->version, $response, $this->solution); } /** * Create the CommandInstance * * @param string $command The message body of the Command or a Base64 encoded * byte string in binary mode * @param array|Options $options Optional Arguments * @return CommandInstance Created CommandInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $command, array $options = []): CommandInstance { $options = new Values($options); $data = Values::of([ 'Command' => $command, 'Sim' => $options['sim'], 'CallbackMethod' => $options['callbackMethod'], 'CallbackUrl' => $options['callbackUrl'], 'CommandMode' => $options['commandMode'], 'IncludeSid' => $options['includeSid'], 'DeliveryReceiptRequested' => Serialize::booleanToString($options['deliveryReceiptRequested']), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new CommandInstance($this->version, $payload); } /** * Constructs a CommandContext * * @param string $sid The SID that identifies the resource to fetch */ public function getContext(string $sid): CommandContext { return new CommandContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Wireless.V1.CommandList]'; } }src/Twilio/Rest/Wireless/V1/RatePlanInstance.php000064400000011737150515725670015534 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'dataEnabled' => Values::array_get($payload, 'data_enabled'), 'dataMetering' => Values::array_get($payload, 'data_metering'), 'dataLimit' => Values::array_get($payload, 'data_limit'), 'messagingEnabled' => Values::array_get($payload, 'messaging_enabled'), 'voiceEnabled' => Values::array_get($payload, 'voice_enabled'), 'nationalRoamingEnabled' => Values::array_get($payload, 'national_roaming_enabled'), 'nationalRoamingDataLimit' => Values::array_get($payload, 'national_roaming_data_limit'), 'internationalRoaming' => Values::array_get($payload, 'international_roaming'), 'internationalRoamingDataLimit' => Values::array_get($payload, 'international_roaming_data_limit'), '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 = ['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 RatePlanContext Context for this RatePlanInstance */ protected function proxy(): RatePlanContext { if (!$this->context) { $this->context = new RatePlanContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the RatePlanInstance * * @return RatePlanInstance Fetched RatePlanInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RatePlanInstance { return $this->proxy()->fetch(); } /** * Update the RatePlanInstance * * @param array|Options $options Optional Arguments * @return RatePlanInstance Updated RatePlanInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): RatePlanInstance { return $this->proxy()->update($options); } /** * Delete the RatePlanInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Wireless.V1.RatePlanInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Wireless/V1/RatePlanList.php000064400000013721150515725670014676 0ustar00solution = []; $this->uri = '/RatePlans'; } /** * Streams RatePlanInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads RatePlanInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return RatePlanInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of RatePlanInstance records from the API. * Request is executed immediately * * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return RatePlanPage Page of RatePlanInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): RatePlanPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new RatePlanPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of RatePlanInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return RatePlanPage Page of RatePlanInstance */ public function getPage(string $targetUrl): RatePlanPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new RatePlanPage($this->version, $response, $this->solution); } /** * Create the RatePlanInstance * * @param array|Options $options Optional Arguments * @return RatePlanInstance Created RatePlanInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): RatePlanInstance { $options = new Values($options); $data = Values::of([ 'UniqueName' => $options['uniqueName'], 'FriendlyName' => $options['friendlyName'], 'DataEnabled' => Serialize::booleanToString($options['dataEnabled']), 'DataLimit' => $options['dataLimit'], 'DataMetering' => $options['dataMetering'], 'MessagingEnabled' => Serialize::booleanToString($options['messagingEnabled']), 'VoiceEnabled' => Serialize::booleanToString($options['voiceEnabled']), 'NationalRoamingEnabled' => Serialize::booleanToString($options['nationalRoamingEnabled']), 'InternationalRoaming' => Serialize::map($options['internationalRoaming'], function($e) { return $e; }), 'NationalRoamingDataLimit' => $options['nationalRoamingDataLimit'], 'InternationalRoamingDataLimit' => $options['internationalRoamingDataLimit'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new RatePlanInstance($this->version, $payload); } /** * Constructs a RatePlanContext * * @param string $sid The SID that identifies the resource to fetch */ public function getContext(string $sid): RatePlanContext { return new RatePlanContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Wireless.V1.RatePlanList]'; } }src/Twilio/Rest/Wireless/V1/RatePlanOptions.php000064400000034475150515725670015427 0ustar00options['uniqueName'] = $uniqueName; $this->options['friendlyName'] = $friendlyName; $this->options['dataEnabled'] = $dataEnabled; $this->options['dataLimit'] = $dataLimit; $this->options['dataMetering'] = $dataMetering; $this->options['messagingEnabled'] = $messagingEnabled; $this->options['voiceEnabled'] = $voiceEnabled; $this->options['nationalRoamingEnabled'] = $nationalRoamingEnabled; $this->options['internationalRoaming'] = $internationalRoaming; $this->options['nationalRoamingDataLimit'] = $nationalRoamingDataLimit; $this->options['internationalRoamingDataLimit'] = $internationalRoamingDataLimit; } /** * An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. * * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * A descriptive string that you create to describe the resource. It does not have to be unique. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Whether SIMs can use GPRS/3G/4G/LTE data connectivity. * * @param bool $dataEnabled Whether SIMs can use GPRS/3G/4G/LTE data * connectivity * @return $this Fluent Builder */ public function setDataEnabled(bool $dataEnabled): self { $this->options['dataEnabled'] = $dataEnabled; return $this; } /** * The total data usage (download and upload combined) in Megabytes that the Network allows during one month on the home network (T-Mobile USA). The metering period begins the day of activation and ends on the same day in the following month. Can be up to 2TB and the default value is `1000`. * * @param int $dataLimit The total data usage in Megabytes that the Network * allows during one month on the home network * @return $this Fluent Builder */ public function setDataLimit(int $dataLimit): self { $this->options['dataLimit'] = $dataLimit; return $this; } /** * The model used to meter data usage. Can be: `payg` and `quota-1`, `quota-10`, and `quota-50`. Learn more about the available [data metering models](https://www.twilio.com/docs/wireless/api/rateplan-resource#payg-vs-quota-data-plans). * * @param string $dataMetering The model used to meter data usage * @return $this Fluent Builder */ public function setDataMetering(string $dataMetering): self { $this->options['dataMetering'] = $dataMetering; return $this; } /** * Whether SIMs can make, send, and receive SMS using [Commands](https://www.twilio.com/docs/wireless/api/command-resource). * * @param bool $messagingEnabled Whether SIMs can make, send, and receive SMS * using Commands * @return $this Fluent Builder */ public function setMessagingEnabled(bool $messagingEnabled): self { $this->options['messagingEnabled'] = $messagingEnabled; return $this; } /** * Deprecated. * * @param bool $voiceEnabled Deprecated * @return $this Fluent Builder */ public function setVoiceEnabled(bool $voiceEnabled): self { $this->options['voiceEnabled'] = $voiceEnabled; return $this; } /** * Whether SIMs can roam on networks other than the home network (T-Mobile USA) in the United States. See [national roaming](https://www.twilio.com/docs/wireless/api/rateplan-resource#national-roaming). * * @param bool $nationalRoamingEnabled Whether SIMs can roam on networks other * than the home network in the United * States * @return $this Fluent Builder */ public function setNationalRoamingEnabled(bool $nationalRoamingEnabled): self { $this->options['nationalRoamingEnabled'] = $nationalRoamingEnabled; return $this; } /** * The list of services that SIMs capable of using GPRS/3G/4G/LTE data connectivity can use outside of the United States. Can contain: `data` and `messaging`. * * @param string[] $internationalRoaming The services that SIMs capable of * using GPRS/3G/4G/LTE data connectivity * can use outside of the United States * @return $this Fluent Builder */ public function setInternationalRoaming(array $internationalRoaming): self { $this->options['internationalRoaming'] = $internationalRoaming; return $this; } /** * The total data usage (download and upload combined) in Megabytes that the Network allows during one month on non-home networks in the United States. The metering period begins the day of activation and ends on the same day in the following month. Can be up to 2TB. See [national roaming](https://www.twilio.com/docs/wireless/api/rateplan-resource#national-roaming) for more info. * * @param int $nationalRoamingDataLimit The total data usage in Megabytes that * the Network allows during one month on * non-home networks in the United States * @return $this Fluent Builder */ public function setNationalRoamingDataLimit(int $nationalRoamingDataLimit): self { $this->options['nationalRoamingDataLimit'] = $nationalRoamingDataLimit; return $this; } /** * The total data usage (download and upload combined) in Megabytes that the Network allows during one month when roaming outside the United States. Can be up to 2TB. * * @param int $internationalRoamingDataLimit The total data usage (download and * upload combined) in Megabytes that * the Network allows during one * month when roaming outside the * United States * @return $this Fluent Builder */ public function setInternationalRoamingDataLimit(int $internationalRoamingDataLimit): self { $this->options['internationalRoamingDataLimit'] = $internationalRoamingDataLimit; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Wireless.V1.CreateRatePlanOptions ' . $options . ']'; } } class UpdateRatePlanOptions extends Options { /** * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @param string $friendlyName A string to describe the resource */ public function __construct(string $uniqueName = Values::NONE, string $friendlyName = Values::NONE) { $this->options['uniqueName'] = $uniqueName; $this->options['friendlyName'] = $friendlyName; } /** * An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. * * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * A descriptive string that you create to describe the resource. It does not have to be unique. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Wireless.V1.UpdateRatePlanOptions ' . $options . ']'; } }src/Twilio/Rest/Wireless/V1/SimInstance.php000064400000014054150515725670014551 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'ratePlanSid' => Values::array_get($payload, 'rate_plan_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'iccid' => Values::array_get($payload, 'iccid'), 'eId' => Values::array_get($payload, 'e_id'), 'status' => Values::array_get($payload, 'status'), 'resetStatus' => Values::array_get($payload, 'reset_status'), 'commandsCallbackUrl' => Values::array_get($payload, 'commands_callback_url'), 'commandsCallbackMethod' => Values::array_get($payload, 'commands_callback_method'), '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'), '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'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), 'ipAddress' => Values::array_get($payload, 'ip_address'), ]; $this->solution = ['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 SimContext Context for this SimInstance */ protected function proxy(): SimContext { if (!$this->context) { $this->context = new SimContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the SimInstance * * @return SimInstance Fetched SimInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SimInstance { return $this->proxy()->fetch(); } /** * Update the SimInstance * * @param array|Options $options Optional Arguments * @return SimInstance Updated SimInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SimInstance { return $this->proxy()->update($options); } /** * Delete the SimInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the usageRecords */ protected function getUsageRecords(): UsageRecordList { return $this->proxy()->usageRecords; } /** * Access the dataSessions */ protected function getDataSessions(): DataSessionList { return $this->proxy()->dataSessions; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Wireless.V1.SimInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Wireless/V1.php000064400000006254150515725670012337 0ustar00version = 'v1'; } protected function getUsageRecords(): UsageRecordList { if (!$this->_usageRecords) { $this->_usageRecords = new UsageRecordList($this); } return $this->_usageRecords; } protected function getCommands(): CommandList { if (!$this->_commands) { $this->_commands = new CommandList($this); } return $this->_commands; } protected function getRatePlans(): RatePlanList { if (!$this->_ratePlans) { $this->_ratePlans = new RatePlanList($this); } return $this->_ratePlans; } protected function getSims(): SimList { if (!$this->_sims) { $this->_sims = new SimList($this); } return $this->_sims; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Wireless.V1]'; } }src/Twilio/Rest/Sync/V1/ServiceInstance.php000064400000013142150515725670014535 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'uniqueName' => Values::array_get($payload, 'unique_name'), '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'), 'webhookUrl' => Values::array_get($payload, 'webhook_url'), 'webhooksFromRestEnabled' => Values::array_get($payload, 'webhooks_from_rest_enabled'), 'reachabilityWebhooksEnabled' => Values::array_get($payload, 'reachability_webhooks_enabled'), 'aclEnabled' => Values::array_get($payload, 'acl_enabled'), 'reachabilityDebouncingEnabled' => Values::array_get($payload, 'reachability_debouncing_enabled'), 'reachabilityDebouncingWindow' => Values::array_get($payload, 'reachability_debouncing_window'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 ServiceContext Context for this ServiceInstance */ protected function proxy(): ServiceContext { if (!$this->context) { $this->context = new ServiceContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the ServiceInstance * * @return ServiceInstance Fetched ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ServiceInstance { return $this->proxy()->fetch(); } /** * Delete the ServiceInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the ServiceInstance * * @param array|Options $options Optional Arguments * @return ServiceInstance Updated ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ServiceInstance { return $this->proxy()->update($options); } /** * Access the documents */ protected function getDocuments(): DocumentList { return $this->proxy()->documents; } /** * Access the syncLists */ protected function getSyncLists(): SyncListList { return $this->proxy()->syncLists; } /** * Access the syncMaps */ protected function getSyncMaps(): SyncMapList { return $this->proxy()->syncMaps; } /** * Access the syncStreams */ protected function getSyncStreams(): SyncStreamList { return $this->proxy()->syncStreams; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Sync.V1.ServiceInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Sync/V1/Service/SyncMapOptions.php000064400000012025150515725670015775 0ustar00options['uniqueName'] = $uniqueName; $this->options['ttl'] = $ttl; $this->options['collectionTtl'] = $collectionTtl; } /** * An application-defined string that uniquely identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. * * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * An alias for `collection_ttl`. If both parameters are provided, this value is ignored. * * @param int $ttl An alias for collection_ttl * @return $this Fluent Builder */ public function setTtl(int $ttl): self { $this->options['ttl'] = $ttl; return $this; } /** * How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Sync Map expires (time-to-live) and is deleted. * * @param int $collectionTtl How long, in seconds, before the Sync Map expires * and is deleted * @return $this Fluent Builder */ public function setCollectionTtl(int $collectionTtl): self { $this->options['collectionTtl'] = $collectionTtl; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Sync.V1.CreateSyncMapOptions ' . $options . ']'; } } class UpdateSyncMapOptions extends Options { /** * @param int $ttl An alias for collection_ttl * @param int $collectionTtl How long, in seconds, before the Sync Map expires * and is deleted */ public function __construct(int $ttl = Values::NONE, int $collectionTtl = Values::NONE) { $this->options['ttl'] = $ttl; $this->options['collectionTtl'] = $collectionTtl; } /** * An alias for `collection_ttl`. If both parameters are provided, this value is ignored. * * @param int $ttl An alias for collection_ttl * @return $this Fluent Builder */ public function setTtl(int $ttl): self { $this->options['ttl'] = $ttl; return $this; } /** * How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Sync Map expires (time-to-live) and is deleted. * * @param int $collectionTtl How long, in seconds, before the Sync Map expires * and is deleted * @return $this Fluent Builder */ public function setCollectionTtl(int $collectionTtl): self { $this->options['collectionTtl'] = $collectionTtl; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Sync.V1.UpdateSyncMapOptions ' . $options . ']'; } }src/Twilio/Rest/Sync/V1/Service/DocumentPage.php000064400000002250150515725670015421 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return DocumentInstance \Twilio\Rest\Sync\V1\Service\DocumentInstance */ public function buildInstance(array $payload): DocumentInstance { return new DocumentInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Sync.V1.DocumentPage]'; } }src/Twilio/Rest/Sync/V1/Service/DocumentOptions.php000064400000013711150515725670016204 0ustar00options['uniqueName'] = $uniqueName; $this->options['data'] = $data; $this->options['ttl'] = $ttl; } /** * An application-defined string that uniquely identifies the Sync Document * * @param string $uniqueName An application-defined string that uniquely * identifies the Sync Document * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * A JSON string that represents an arbitrary, schema-less object that the Sync Document stores. Can be up to 16 KiB in length. * * @param array $data A JSON string that represents an arbitrary, schema-less * object that the Sync Document stores * @return $this Fluent Builder */ public function setData(array $data): self { $this->options['data'] = $data; return $this; } /** * How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Sync Document expires and is deleted (the Sync Document's time-to-live). * * @param int $ttl How long, in seconds, before the Sync Document expires and * is deleted * @return $this Fluent Builder */ public function setTtl(int $ttl): self { $this->options['ttl'] = $ttl; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Sync.V1.CreateDocumentOptions ' . $options . ']'; } } class UpdateDocumentOptions extends Options { /** * @param array $data A JSON string that represents an arbitrary, schema-less * object that the Sync Document stores * @param int $ttl How long, in seconds, before the Document resource expires * and is deleted * @param string $ifMatch The If-Match HTTP request header */ public function __construct(array $data = Values::ARRAY_NONE, int $ttl = Values::NONE, string $ifMatch = Values::NONE) { $this->options['data'] = $data; $this->options['ttl'] = $ttl; $this->options['ifMatch'] = $ifMatch; } /** * A JSON string that represents an arbitrary, schema-less object that the Sync Document stores. Can be up to 16 KiB in length. * * @param array $data A JSON string that represents an arbitrary, schema-less * object that the Sync Document stores * @return $this Fluent Builder */ public function setData(array $data): self { $this->options['data'] = $data; return $this; } /** * How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Sync Document expires and is deleted (time-to-live). * * @param int $ttl How long, in seconds, before the Document resource expires * and is deleted * @return $this Fluent Builder */ public function setTtl(int $ttl): self { $this->options['ttl'] = $ttl; return $this; } /** * The If-Match HTTP request header * * @param string $ifMatch The If-Match HTTP request header * @return $this Fluent Builder */ public function setIfMatch(string $ifMatch): self { $this->options['ifMatch'] = $ifMatch; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Sync.V1.UpdateDocumentOptions ' . $options . ']'; } }src/Twilio/Rest/Sync/V1/Service/SyncListInstance.php000064400000012107150515725670016305 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), 'revision' => Values::array_get($payload, 'revision'), 'dateExpires' => Deserialize::dateTime(Values::array_get($payload, 'date_expires')), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'createdBy' => Values::array_get($payload, 'created_by'), ]; $this->solution = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return SyncListContext Context for this SyncListInstance */ protected function proxy(): SyncListContext { if (!$this->context) { $this->context = new SyncListContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the SyncListInstance * * @return SyncListInstance Fetched SyncListInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SyncListInstance { return $this->proxy()->fetch(); } /** * Delete the SyncListInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the SyncListInstance * * @param array|Options $options Optional Arguments * @return SyncListInstance Updated SyncListInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SyncListInstance { return $this->proxy()->update($options); } /** * Access the syncListItems */ protected function getSyncListItems(): SyncListItemList { return $this->proxy()->syncListItems; } /** * Access the syncListPermissions */ protected function getSyncListPermissions(): SyncListPermissionList { return $this->proxy()->syncListPermissions; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Sync.V1.SyncListInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Sync/V1/Service/SyncMapContext.php000064400000012206150515725670015767 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Maps/' . \rawurlencode($sid) . ''; } /** * Fetch the SyncMapInstance * * @return SyncMapInstance Fetched SyncMapInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SyncMapInstance { $payload = $this->version->fetch('GET', $this->uri); return new SyncMapInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Delete the SyncMapInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the SyncMapInstance * * @param array|Options $options Optional Arguments * @return SyncMapInstance Updated SyncMapInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SyncMapInstance { $options = new Values($options); $data = Values::of(['Ttl' => $options['ttl'], 'CollectionTtl' => $options['collectionTtl'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new SyncMapInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Access the syncMapItems */ protected function getSyncMapItems(): SyncMapItemList { if (!$this->_syncMapItems) { $this->_syncMapItems = new SyncMapItemList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_syncMapItems; } /** * Access the syncMapPermissions */ protected function getSyncMapPermissions(): SyncMapPermissionList { if (!$this->_syncMapPermissions) { $this->_syncMapPermissions = new SyncMapPermissionList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_syncMapPermissions; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Sync.V1.SyncMapContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Sync/V1/Service/SyncStreamInstance.php000064400000011352150515725670016626 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), 'dateExpires' => Deserialize::dateTime(Values::array_get($payload, 'date_expires')), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'createdBy' => Values::array_get($payload, 'created_by'), ]; $this->solution = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return SyncStreamContext Context for this SyncStreamInstance */ protected function proxy(): SyncStreamContext { if (!$this->context) { $this->context = new SyncStreamContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the SyncStreamInstance * * @return SyncStreamInstance Fetched SyncStreamInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SyncStreamInstance { return $this->proxy()->fetch(); } /** * Delete the SyncStreamInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the SyncStreamInstance * * @param array|Options $options Optional Arguments * @return SyncStreamInstance Updated SyncStreamInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SyncStreamInstance { return $this->proxy()->update($options); } /** * Access the streamMessages */ protected function getStreamMessages(): StreamMessageList { return $this->proxy()->streamMessages; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Sync.V1.SyncStreamInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Sync/V1/Service/SyncMapPage.php000064400000002242150515725670015216 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SyncMapInstance \Twilio\Rest\Sync\V1\Service\SyncMapInstance */ public function buildInstance(array $payload): SyncMapInstance { return new SyncMapInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Sync.V1.SyncMapPage]'; } }src/Twilio/Rest/Sync/V1/Service/SyncStreamOptions.php000064400000007545150515725670016526 0ustar00options['uniqueName'] = $uniqueName; $this->options['ttl'] = $ttl; } /** * An application-defined string that uniquely identifies the resource. This value must be unique within its Service and it can be up to 320 characters long. The `unique_name` value can be used as an alternative to the `sid` in the URL path to address the resource. * * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Stream expires and is deleted (time-to-live). * * @param int $ttl How long, in seconds, before the Stream expires and is * deleted * @return $this Fluent Builder */ public function setTtl(int $ttl): self { $this->options['ttl'] = $ttl; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Sync.V1.CreateSyncStreamOptions ' . $options . ']'; } } class UpdateSyncStreamOptions extends Options { /** * @param int $ttl How long, in seconds, before the Stream expires and is * deleted */ public function __construct(int $ttl = Values::NONE) { $this->options['ttl'] = $ttl; } /** * How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Stream expires and is deleted (time-to-live). * * @param int $ttl How long, in seconds, before the Stream expires and is * deleted * @return $this Fluent Builder */ public function setTtl(int $ttl): self { $this->options['ttl'] = $ttl; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Sync.V1.UpdateSyncStreamOptions ' . $options . ']'; } }src/Twilio/Rest/Sync/V1/Service/SyncListList.php000064400000013007150515725670015454 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Lists'; } /** * Create the SyncListInstance * * @param array|Options $options Optional Arguments * @return SyncListInstance Created SyncListInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): SyncListInstance { $options = new Values($options); $data = Values::of([ 'UniqueName' => $options['uniqueName'], 'Ttl' => $options['ttl'], 'CollectionTtl' => $options['collectionTtl'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new SyncListInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Streams SyncListInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads SyncListInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return SyncListInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of SyncListInstance records from the API. * Request is executed immediately * * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return SyncListPage Page of SyncListInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SyncListPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new SyncListPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of SyncListInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return SyncListPage Page of SyncListInstance */ public function getPage(string $targetUrl): SyncListPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new SyncListPage($this->version, $response, $this->solution); } /** * Constructs a SyncListContext * * @param string $sid The SID of the Sync List resource to fetch */ public function getContext(string $sid): SyncListContext { return new SyncListContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Sync.V1.SyncListList]'; } }src/Twilio/Rest/Sync/V1/Service/SyncListPage.php000064400000002250150515725670015413 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SyncListInstance \Twilio\Rest\Sync\V1\Service\SyncListInstance */ public function buildInstance(array $payload): SyncListInstance { return new SyncListInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Sync.V1.SyncListPage]'; } }src/Twilio/Rest/Sync/V1/Service/DocumentList.php000064400000013045150515725670015464 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Documents'; } /** * Create the DocumentInstance * * @param array|Options $options Optional Arguments * @return DocumentInstance Created DocumentInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): DocumentInstance { $options = new Values($options); $data = Values::of([ 'UniqueName' => $options['uniqueName'], 'Data' => Serialize::jsonObject($options['data']), 'Ttl' => $options['ttl'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new DocumentInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Streams DocumentInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads DocumentInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return DocumentInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of DocumentInstance records from the API. * Request is executed immediately * * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return DocumentPage Page of DocumentInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): DocumentPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new DocumentPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of DocumentInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return DocumentPage Page of DocumentInstance */ public function getPage(string $targetUrl): DocumentPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new DocumentPage($this->version, $response, $this->solution); } /** * Constructs a DocumentContext * * @param string $sid The SID of the Document resource to fetch */ public function getContext(string $sid): DocumentContext { return new DocumentContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Sync.V1.DocumentList]'; } }src/Twilio/Rest/Sync/V1/Service/DocumentContext.php000064400000011260150515725670016172 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Documents/' . \rawurlencode($sid) . ''; } /** * Fetch the DocumentInstance * * @return DocumentInstance Fetched DocumentInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): DocumentInstance { $payload = $this->version->fetch('GET', $this->uri); return new DocumentInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Delete the DocumentInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the DocumentInstance * * @param array|Options $options Optional Arguments * @return DocumentInstance Updated DocumentInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): DocumentInstance { $options = new Values($options); $data = Values::of(['Data' => Serialize::jsonObject($options['data']), 'Ttl' => $options['ttl'], ]); $headers = Values::of(['If-Match' => $options['ifMatch'], ]); $payload = $this->version->update('POST', $this->uri, [], $data, $headers); return new DocumentInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Access the documentPermissions */ protected function getDocumentPermissions(): DocumentPermissionList { if (!$this->_documentPermissions) { $this->_documentPermissions = new DocumentPermissionList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_documentPermissions; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Sync.V1.DocumentContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Sync/V1/Service/SyncMapInstance.php000064400000012050150515725670016104 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), 'revision' => Values::array_get($payload, 'revision'), 'dateExpires' => Deserialize::dateTime(Values::array_get($payload, 'date_expires')), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'createdBy' => Values::array_get($payload, 'created_by'), ]; $this->solution = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return SyncMapContext Context for this SyncMapInstance */ protected function proxy(): SyncMapContext { if (!$this->context) { $this->context = new SyncMapContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the SyncMapInstance * * @return SyncMapInstance Fetched SyncMapInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SyncMapInstance { return $this->proxy()->fetch(); } /** * Delete the SyncMapInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the SyncMapInstance * * @param array|Options $options Optional Arguments * @return SyncMapInstance Updated SyncMapInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SyncMapInstance { return $this->proxy()->update($options); } /** * Access the syncMapItems */ protected function getSyncMapItems(): SyncMapItemList { return $this->proxy()->syncMapItems; } /** * Access the syncMapPermissions */ protected function getSyncMapPermissions(): SyncMapPermissionList { return $this->proxy()->syncMapPermissions; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Sync.V1.SyncMapInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Sync/V1/Service/SyncStreamPage.php000064400000002264150515725670015740 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SyncStreamInstance \Twilio\Rest\Sync\V1\Service\SyncStreamInstance */ public function buildInstance(array $payload): SyncStreamInstance { return new SyncStreamInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Sync.V1.SyncStreamPage]'; } }src/Twilio/Rest/Sync/V1/Service/SyncList/SyncListPermissionContext.php000064400000006762150515725670022020 0ustar00solution = ['serviceSid' => $serviceSid, 'listSid' => $listSid, 'identity' => $identity, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Lists/' . \rawurlencode($listSid) . '/Permissions/' . \rawurlencode($identity) . ''; } /** * Fetch the SyncListPermissionInstance * * @return SyncListPermissionInstance Fetched SyncListPermissionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SyncListPermissionInstance { $payload = $this->version->fetch('GET', $this->uri); return new SyncListPermissionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['listSid'], $this->solution['identity'] ); } /** * Delete the SyncListPermissionInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the SyncListPermissionInstance * * @param bool $read Read access * @param bool $write Write access * @param bool $manage Manage access * @return SyncListPermissionInstance Updated SyncListPermissionInstance * @throws TwilioException When an HTTP error occurs. */ public function update(bool $read, bool $write, bool $manage): SyncListPermissionInstance { $data = Values::of([ 'Read' => Serialize::booleanToString($read), 'Write' => Serialize::booleanToString($write), 'Manage' => Serialize::booleanToString($manage), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new SyncListPermissionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['listSid'], $this->solution['identity'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Sync.V1.SyncListPermissionContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Sync/V1/Service/SyncList/SyncListPermissionList.php000064400000012604150515725670021277 0ustar00solution = ['serviceSid' => $serviceSid, 'listSid' => $listSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Lists/' . \rawurlencode($listSid) . '/Permissions'; } /** * Streams SyncListPermissionInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads SyncListPermissionInstance 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 SyncListPermissionInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of SyncListPermissionInstance 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 SyncListPermissionPage Page of SyncListPermissionInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SyncListPermissionPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new SyncListPermissionPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of SyncListPermissionInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return SyncListPermissionPage Page of SyncListPermissionInstance */ public function getPage(string $targetUrl): SyncListPermissionPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new SyncListPermissionPage($this->version, $response, $this->solution); } /** * Constructs a SyncListPermissionContext * * @param string $identity The application-defined string that uniquely * identifies the User's Sync List Permission resource * to fetch */ public function getContext(string $identity): SyncListPermissionContext { return new SyncListPermissionContext( $this->version, $this->solution['serviceSid'], $this->solution['listSid'], $identity ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Sync.V1.SyncListPermissionList]'; } }src/Twilio/Rest/Sync/V1/Service/SyncList/SyncListItemContext.php000064400000007047150515725670020563 0ustar00solution = ['serviceSid' => $serviceSid, 'listSid' => $listSid, 'index' => $index, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Lists/' . \rawurlencode($listSid) . '/Items/' . \rawurlencode($index) . ''; } /** * Fetch the SyncListItemInstance * * @return SyncListItemInstance Fetched SyncListItemInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SyncListItemInstance { $payload = $this->version->fetch('GET', $this->uri); return new SyncListItemInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['listSid'], $this->solution['index'] ); } /** * Delete the SyncListItemInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { $options = new Values($options); $headers = Values::of(['If-Match' => $options['ifMatch'], ]); return $this->version->delete('DELETE', $this->uri, [], [], $headers); } /** * Update the SyncListItemInstance * * @param array|Options $options Optional Arguments * @return SyncListItemInstance Updated SyncListItemInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SyncListItemInstance { $options = new Values($options); $data = Values::of([ 'Data' => Serialize::jsonObject($options['data']), 'Ttl' => $options['ttl'], 'ItemTtl' => $options['itemTtl'], 'CollectionTtl' => $options['collectionTtl'], ]); $headers = Values::of(['If-Match' => $options['ifMatch'], ]); $payload = $this->version->update('POST', $this->uri, [], $data, $headers); return new SyncListItemInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['listSid'], $this->solution['index'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Sync.V1.SyncListItemContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Sync/V1/Service/SyncList/SyncListItemOptions.php000064400000026502150515725670020567 0ustar00options['ifMatch'] = $ifMatch; } /** * If provided, applies this mutation if (and only if) the “revision” field of this [map item] matches the provided value. This matches the semantics of (and is implemented with) the HTTP [If-Match header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match). * * @param string $ifMatch The If-Match HTTP request header * @return $this Fluent Builder */ public function setIfMatch(string $ifMatch): self { $this->options['ifMatch'] = $ifMatch; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Sync.V1.DeleteSyncListItemOptions ' . $options . ']'; } } class CreateSyncListItemOptions extends Options { /** * @param int $ttl An alias for item_ttl * @param int $itemTtl How long, in seconds, before the List Item expires * @param int $collectionTtl How long, in seconds, before the List Item's * parent Sync List expires */ public function __construct(int $ttl = Values::NONE, int $itemTtl = Values::NONE, int $collectionTtl = Values::NONE) { $this->options['ttl'] = $ttl; $this->options['itemTtl'] = $itemTtl; $this->options['collectionTtl'] = $collectionTtl; } /** * An alias for `item_ttl`. If both parameters are provided, this value is ignored. * * @param int $ttl An alias for item_ttl * @return $this Fluent Builder */ public function setTtl(int $ttl): self { $this->options['ttl'] = $ttl; return $this; } /** * How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the List Item expires (time-to-live) and is deleted. * * @param int $itemTtl How long, in seconds, before the List Item expires * @return $this Fluent Builder */ public function setItemTtl(int $itemTtl): self { $this->options['itemTtl'] = $itemTtl; return $this; } /** * How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the List Item's parent Sync List expires (time-to-live) and is deleted. * * @param int $collectionTtl How long, in seconds, before the List Item's * parent Sync List expires * @return $this Fluent Builder */ public function setCollectionTtl(int $collectionTtl): self { $this->options['collectionTtl'] = $collectionTtl; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Sync.V1.CreateSyncListItemOptions ' . $options . ']'; } } class ReadSyncListItemOptions extends Options { /** * @param string $order The order to return the List Items * @param string $from The index of the first Sync List Item resource to read * @param string $bounds Whether to include the List Item referenced by the * from parameter */ public function __construct(string $order = Values::NONE, string $from = Values::NONE, string $bounds = Values::NONE) { $this->options['order'] = $order; $this->options['from'] = $from; $this->options['bounds'] = $bounds; } /** * How to order the List Items returned by their `index` value. Can be: `asc` (ascending) or `desc` (descending) and the default is ascending. * * @param string $order The order to return the List Items * @return $this Fluent Builder */ public function setOrder(string $order): self { $this->options['order'] = $order; return $this; } /** * The `index` of the first Sync List Item resource to read. See also `bounds`. * * @param string $from The index of the first Sync List Item resource to read * @return $this Fluent Builder */ public function setFrom(string $from): self { $this->options['from'] = $from; return $this; } /** * Whether to include the List Item referenced by the `from` parameter. Can be: `inclusive` to include the List Item referenced by the `from` parameter or `exclusive` to start with the next List Item. The default value is `inclusive`. * * @param string $bounds Whether to include the List Item referenced by the * from parameter * @return $this Fluent Builder */ public function setBounds(string $bounds): self { $this->options['bounds'] = $bounds; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Sync.V1.ReadSyncListItemOptions ' . $options . ']'; } } class UpdateSyncListItemOptions extends Options { /** * @param array $data A JSON string that represents an arbitrary, schema-less * object that the List Item stores * @param int $ttl An alias for item_ttl * @param int $itemTtl How long, in seconds, before the List Item expires * @param int $collectionTtl How long, in seconds, before the List Item's * parent Sync List expires * @param string $ifMatch The If-Match HTTP request header */ public function __construct(array $data = Values::ARRAY_NONE, int $ttl = Values::NONE, int $itemTtl = Values::NONE, int $collectionTtl = Values::NONE, string $ifMatch = Values::NONE) { $this->options['data'] = $data; $this->options['ttl'] = $ttl; $this->options['itemTtl'] = $itemTtl; $this->options['collectionTtl'] = $collectionTtl; $this->options['ifMatch'] = $ifMatch; } /** * A JSON string that represents an arbitrary, schema-less object that the List Item stores. Can be up to 16 KiB in length. * * @param array $data A JSON string that represents an arbitrary, schema-less * object that the List Item stores * @return $this Fluent Builder */ public function setData(array $data): self { $this->options['data'] = $data; return $this; } /** * An alias for `item_ttl`. If both parameters are provided, this value is ignored. * * @param int $ttl An alias for item_ttl * @return $this Fluent Builder */ public function setTtl(int $ttl): self { $this->options['ttl'] = $ttl; return $this; } /** * How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the List Item expires (time-to-live) and is deleted. * * @param int $itemTtl How long, in seconds, before the List Item expires * @return $this Fluent Builder */ public function setItemTtl(int $itemTtl): self { $this->options['itemTtl'] = $itemTtl; return $this; } /** * How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the List Item's parent Sync List expires (time-to-live) and is deleted. This parameter can only be used when the List Item's `data` or `ttl` is updated in the same request. * * @param int $collectionTtl How long, in seconds, before the List Item's * parent Sync List expires * @return $this Fluent Builder */ public function setCollectionTtl(int $collectionTtl): self { $this->options['collectionTtl'] = $collectionTtl; return $this; } /** * If provided, applies this mutation if (and only if) the “revision” field of this [map item] matches the provided value. This matches the semantics of (and is implemented with) the HTTP [If-Match header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match). * * @param string $ifMatch The If-Match HTTP request header * @return $this Fluent Builder */ public function setIfMatch(string $ifMatch): self { $this->options['ifMatch'] = $ifMatch; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Sync.V1.UpdateSyncListItemOptions ' . $options . ']'; } }src/Twilio/Rest/Sync/V1/Service/SyncList/SyncListItemInstance.php000064400000011634150515725670020700 0ustar00properties = [ 'index' => Values::array_get($payload, 'index'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'listSid' => Values::array_get($payload, 'list_sid'), 'url' => Values::array_get($payload, 'url'), 'revision' => Values::array_get($payload, 'revision'), 'data' => Values::array_get($payload, 'data'), 'dateExpires' => Deserialize::dateTime(Values::array_get($payload, 'date_expires')), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'createdBy' => Values::array_get($payload, 'created_by'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'listSid' => $listSid, 'index' => $index ?: $this->properties['index'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return SyncListItemContext Context for this SyncListItemInstance */ protected function proxy(): SyncListItemContext { if (!$this->context) { $this->context = new SyncListItemContext( $this->version, $this->solution['serviceSid'], $this->solution['listSid'], $this->solution['index'] ); } return $this->context; } /** * Fetch the SyncListItemInstance * * @return SyncListItemInstance Fetched SyncListItemInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SyncListItemInstance { return $this->proxy()->fetch(); } /** * Delete the SyncListItemInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { return $this->proxy()->delete($options); } /** * Update the SyncListItemInstance * * @param array|Options $options Optional Arguments * @return SyncListItemInstance Updated SyncListItemInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SyncListItemInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Sync.V1.SyncListItemInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Sync/V1/Service/SyncList/SyncListItemPage.php000064400000002450150515725670020004 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SyncListItemInstance \Twilio\Rest\Sync\V1\Service\SyncList\SyncListItemInstance */ public function buildInstance(array $payload): SyncListItemInstance { return new SyncListItemInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['listSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Sync.V1.SyncListItemPage]'; } }src/Twilio/Rest/Sync/V1/Service/SyncList/SyncListPermissionInstance.php000064400000011357150515725670022134 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'listSid' => Values::array_get($payload, 'list_sid'), 'identity' => Values::array_get($payload, 'identity'), 'read' => Values::array_get($payload, 'read'), 'write' => Values::array_get($payload, 'write'), 'manage' => Values::array_get($payload, 'manage'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'listSid' => $listSid, 'identity' => $identity ?: $this->properties['identity'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return SyncListPermissionContext Context for this SyncListPermissionInstance */ protected function proxy(): SyncListPermissionContext { if (!$this->context) { $this->context = new SyncListPermissionContext( $this->version, $this->solution['serviceSid'], $this->solution['listSid'], $this->solution['identity'] ); } return $this->context; } /** * Fetch the SyncListPermissionInstance * * @return SyncListPermissionInstance Fetched SyncListPermissionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SyncListPermissionInstance { return $this->proxy()->fetch(); } /** * Delete the SyncListPermissionInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the SyncListPermissionInstance * * @param bool $read Read access * @param bool $write Write access * @param bool $manage Manage access * @return SyncListPermissionInstance Updated SyncListPermissionInstance * @throws TwilioException When an HTTP error occurs. */ public function update(bool $read, bool $write, bool $manage): SyncListPermissionInstance { return $this->proxy()->update($read, $write, $manage); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Sync.V1.SyncListPermissionInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Sync/V1/Service/SyncList/SyncListPermissionPage.php000064400000002514150515725670021237 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SyncListPermissionInstance \Twilio\Rest\Sync\V1\Service\SyncList\SyncListPermissionInstance */ public function buildInstance(array $payload): SyncListPermissionInstance { return new SyncListPermissionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['listSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Sync.V1.SyncListPermissionPage]'; } }src/Twilio/Rest/Sync/V1/Service/SyncList/SyncListItemList.php000064400000015162150515725670020047 0ustar00solution = ['serviceSid' => $serviceSid, 'listSid' => $listSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Lists/' . \rawurlencode($listSid) . '/Items'; } /** * Create the SyncListItemInstance * * @param array $data A JSON string that represents an arbitrary, schema-less * object that the List Item stores * @param array|Options $options Optional Arguments * @return SyncListItemInstance Created SyncListItemInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $data, array $options = []): SyncListItemInstance { $options = new Values($options); $data = Values::of([ 'Data' => Serialize::jsonObject($data), 'Ttl' => $options['ttl'], 'ItemTtl' => $options['itemTtl'], 'CollectionTtl' => $options['collectionTtl'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new SyncListItemInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['listSid'] ); } /** * Streams SyncListItemInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param array|Options $options Optional Arguments * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads SyncListItemInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param array|Options $options Optional Arguments * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return SyncListItemInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of SyncListItemInstance records from the API. * Request is executed immediately * * @param array|Options $options Optional Arguments * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return SyncListItemPage Page of SyncListItemInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SyncListItemPage { $options = new Values($options); $params = Values::of([ 'Order' => $options['order'], 'From' => $options['from'], 'Bounds' => $options['bounds'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new SyncListItemPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of SyncListItemInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return SyncListItemPage Page of SyncListItemInstance */ public function getPage(string $targetUrl): SyncListItemPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new SyncListItemPage($this->version, $response, $this->solution); } /** * Constructs a SyncListItemContext * * @param int $index The index of the Sync List Item resource to fetch */ public function getContext(int $index): SyncListItemContext { return new SyncListItemContext( $this->version, $this->solution['serviceSid'], $this->solution['listSid'], $index ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Sync.V1.SyncListItemList]'; } }src/Twilio/Rest/Sync/V1/Service/SyncMapList.php000064400000012755150515725670015267 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Maps'; } /** * Create the SyncMapInstance * * @param array|Options $options Optional Arguments * @return SyncMapInstance Created SyncMapInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): SyncMapInstance { $options = new Values($options); $data = Values::of([ 'UniqueName' => $options['uniqueName'], 'Ttl' => $options['ttl'], 'CollectionTtl' => $options['collectionTtl'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new SyncMapInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Streams SyncMapInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads SyncMapInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return SyncMapInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of SyncMapInstance records from the API. * Request is executed immediately * * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return SyncMapPage Page of SyncMapInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SyncMapPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new SyncMapPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of SyncMapInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return SyncMapPage Page of SyncMapInstance */ public function getPage(string $targetUrl): SyncMapPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new SyncMapPage($this->version, $response, $this->solution); } /** * Constructs a SyncMapContext * * @param string $sid The SID of the Sync Map resource to fetch */ public function getContext(string $sid): SyncMapContext { return new SyncMapContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Sync.V1.SyncMapList]'; } }src/Twilio/Rest/Sync/V1/Service/SyncListOptions.php000064400000012157150515725670016201 0ustar00options['uniqueName'] = $uniqueName; $this->options['ttl'] = $ttl; $this->options['collectionTtl'] = $collectionTtl; } /** * An application-defined string that uniquely identifies the resource. This value must be unique within its Service and it can be up to 320 characters long. The `unique_name` value can be used as an alternative to the `sid` in the URL path to address the resource. * * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * Alias for collection_ttl. If both are provided, this value is ignored. * * @param int $ttl Alias for collection_ttl * @return $this Fluent Builder */ public function setTtl(int $ttl): self { $this->options['ttl'] = $ttl; return $this; } /** * How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Sync List expires (time-to-live) and is deleted. * * @param int $collectionTtl How long, in seconds, before the Sync List expires * and is deleted * @return $this Fluent Builder */ public function setCollectionTtl(int $collectionTtl): self { $this->options['collectionTtl'] = $collectionTtl; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Sync.V1.CreateSyncListOptions ' . $options . ']'; } } class UpdateSyncListOptions extends Options { /** * @param int $ttl An alias for collection_ttl * @param int $collectionTtl How long, in seconds, before the Sync List expires * and is deleted */ public function __construct(int $ttl = Values::NONE, int $collectionTtl = Values::NONE) { $this->options['ttl'] = $ttl; $this->options['collectionTtl'] = $collectionTtl; } /** * An alias for `collection_ttl`. If both are provided, this value is ignored. * * @param int $ttl An alias for collection_ttl * @return $this Fluent Builder */ public function setTtl(int $ttl): self { $this->options['ttl'] = $ttl; return $this; } /** * How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Sync List expires (time-to-live) and is deleted. * * @param int $collectionTtl How long, in seconds, before the Sync List expires * and is deleted * @return $this Fluent Builder */ public function setCollectionTtl(int $collectionTtl): self { $this->options['collectionTtl'] = $collectionTtl; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Sync.V1.UpdateSyncListOptions ' . $options . ']'; } }src/Twilio/Rest/Sync/V1/Service/SyncStream/StreamMessageInstance.php000064400000003747150515725670021377 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'data' => Values::array_get($payload, 'data'), ]; $this->solution = ['serviceSid' => $serviceSid, 'streamSid' => $streamSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Sync.V1.StreamMessageInstance]'; } }src/Twilio/Rest/Sync/V1/Service/SyncStream/StreamMessagePage.php000064400000002464150515725670020502 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return StreamMessageInstance \Twilio\Rest\Sync\V1\Service\SyncStream\StreamMessageInstance */ public function buildInstance(array $payload): StreamMessageInstance { return new StreamMessageInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['streamSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Sync.V1.StreamMessagePage]'; } }src/Twilio/Rest/Sync/V1/Service/SyncStream/StreamMessageList.php000064400000003742150515725670020541 0ustar00solution = ['serviceSid' => $serviceSid, 'streamSid' => $streamSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Streams/' . \rawurlencode($streamSid) . '/Messages'; } /** * Create the StreamMessageInstance * * @param array $data A JSON string that represents an arbitrary, schema-less * object that makes up the Stream Message body * @return StreamMessageInstance Created StreamMessageInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $data): StreamMessageInstance { $data = Values::of(['Data' => Serialize::jsonObject($data), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new StreamMessageInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['streamSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Sync.V1.StreamMessageList]'; } }src/Twilio/Rest/Sync/V1/Service/SyncMap/SyncMapItemList.php000064400000015301150515725670017446 0ustar00solution = ['serviceSid' => $serviceSid, 'mapSid' => $mapSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Maps/' . \rawurlencode($mapSid) . '/Items'; } /** * Create the SyncMapItemInstance * * @param string $key The unique, user-defined key for the Map Item * @param array $data A JSON string that represents an arbitrary, schema-less * object that the Map Item stores * @param array|Options $options Optional Arguments * @return SyncMapItemInstance Created SyncMapItemInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $key, array $data, array $options = []): SyncMapItemInstance { $options = new Values($options); $data = Values::of([ 'Key' => $key, 'Data' => Serialize::jsonObject($data), 'Ttl' => $options['ttl'], 'ItemTtl' => $options['itemTtl'], 'CollectionTtl' => $options['collectionTtl'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new SyncMapItemInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['mapSid'] ); } /** * Streams SyncMapItemInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param array|Options $options Optional Arguments * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads SyncMapItemInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param array|Options $options Optional Arguments * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return SyncMapItemInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of SyncMapItemInstance records from the API. * Request is executed immediately * * @param array|Options $options Optional Arguments * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return SyncMapItemPage Page of SyncMapItemInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SyncMapItemPage { $options = new Values($options); $params = Values::of([ 'Order' => $options['order'], 'From' => $options['from'], 'Bounds' => $options['bounds'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new SyncMapItemPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of SyncMapItemInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return SyncMapItemPage Page of SyncMapItemInstance */ public function getPage(string $targetUrl): SyncMapItemPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new SyncMapItemPage($this->version, $response, $this->solution); } /** * Constructs a SyncMapItemContext * * @param string $key The key value of the Sync Map Item resource to fetch */ public function getContext(string $key): SyncMapItemContext { return new SyncMapItemContext( $this->version, $this->solution['serviceSid'], $this->solution['mapSid'], $key ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Sync.V1.SyncMapItemList]'; } }src/Twilio/Rest/Sync/V1/Service/SyncMap/SyncMapPermissionPage.php000064400000002503150515725670020641 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SyncMapPermissionInstance \Twilio\Rest\Sync\V1\Service\SyncMap\SyncMapPermissionInstance */ public function buildInstance(array $payload): SyncMapPermissionInstance { return new SyncMapPermissionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['mapSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Sync.V1.SyncMapPermissionPage]'; } }src/Twilio/Rest/Sync/V1/Service/SyncMap/SyncMapPermissionList.php000064400000012427150515725670020706 0ustar00solution = ['serviceSid' => $serviceSid, 'mapSid' => $mapSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Maps/' . \rawurlencode($mapSid) . '/Permissions'; } /** * Streams SyncMapPermissionInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads SyncMapPermissionInstance 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 SyncMapPermissionInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of SyncMapPermissionInstance 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 SyncMapPermissionPage Page of SyncMapPermissionInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SyncMapPermissionPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new SyncMapPermissionPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of SyncMapPermissionInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return SyncMapPermissionPage Page of SyncMapPermissionInstance */ public function getPage(string $targetUrl): SyncMapPermissionPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new SyncMapPermissionPage($this->version, $response, $this->solution); } /** * Constructs a SyncMapPermissionContext * * @param string $identity The application-defined string that uniquely * identifies the User's Sync Map Permission resource * to fetch */ public function getContext(string $identity): SyncMapPermissionContext { return new SyncMapPermissionContext( $this->version, $this->solution['serviceSid'], $this->solution['mapSid'], $identity ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Sync.V1.SyncMapPermissionList]'; } }src/Twilio/Rest/Sync/V1/Service/SyncMap/SyncMapItemContext.php000064400000007004150515725670020160 0ustar00solution = ['serviceSid' => $serviceSid, 'mapSid' => $mapSid, 'key' => $key, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Maps/' . \rawurlencode($mapSid) . '/Items/' . \rawurlencode($key) . ''; } /** * Fetch the SyncMapItemInstance * * @return SyncMapItemInstance Fetched SyncMapItemInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SyncMapItemInstance { $payload = $this->version->fetch('GET', $this->uri); return new SyncMapItemInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['mapSid'], $this->solution['key'] ); } /** * Delete the SyncMapItemInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { $options = new Values($options); $headers = Values::of(['If-Match' => $options['ifMatch'], ]); return $this->version->delete('DELETE', $this->uri, [], [], $headers); } /** * Update the SyncMapItemInstance * * @param array|Options $options Optional Arguments * @return SyncMapItemInstance Updated SyncMapItemInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SyncMapItemInstance { $options = new Values($options); $data = Values::of([ 'Data' => Serialize::jsonObject($options['data']), 'Ttl' => $options['ttl'], 'ItemTtl' => $options['itemTtl'], 'CollectionTtl' => $options['collectionTtl'], ]); $headers = Values::of(['If-Match' => $options['ifMatch'], ]); $payload = $this->version->update('POST', $this->uri, [], $data, $headers); return new SyncMapItemInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['mapSid'], $this->solution['key'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Sync.V1.SyncMapItemContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Sync/V1/Service/SyncMap/SyncMapPermissionContext.php000064400000006726150515725670021424 0ustar00solution = ['serviceSid' => $serviceSid, 'mapSid' => $mapSid, 'identity' => $identity, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Maps/' . \rawurlencode($mapSid) . '/Permissions/' . \rawurlencode($identity) . ''; } /** * Fetch the SyncMapPermissionInstance * * @return SyncMapPermissionInstance Fetched SyncMapPermissionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SyncMapPermissionInstance { $payload = $this->version->fetch('GET', $this->uri); return new SyncMapPermissionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['mapSid'], $this->solution['identity'] ); } /** * Delete the SyncMapPermissionInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the SyncMapPermissionInstance * * @param bool $read Read access * @param bool $write Write access * @param bool $manage Manage access * @return SyncMapPermissionInstance Updated SyncMapPermissionInstance * @throws TwilioException When an HTTP error occurs. */ public function update(bool $read, bool $write, bool $manage): SyncMapPermissionInstance { $data = Values::of([ 'Read' => Serialize::booleanToString($read), 'Write' => Serialize::booleanToString($write), 'Manage' => Serialize::booleanToString($manage), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new SyncMapPermissionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['mapSid'], $this->solution['identity'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Sync.V1.SyncMapPermissionContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Sync/V1/Service/SyncMap/SyncMapItemOptions.php000064400000027002150515725670020167 0ustar00options['ifMatch'] = $ifMatch; } /** * If provided, applies this mutation if (and only if) the “revision” field of this [map item] matches the provided value. This matches the semantics of (and is implemented with) the HTTP [If-Match header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match). * * @param string $ifMatch The If-Match HTTP request header * @return $this Fluent Builder */ public function setIfMatch(string $ifMatch): self { $this->options['ifMatch'] = $ifMatch; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Sync.V1.DeleteSyncMapItemOptions ' . $options . ']'; } } class CreateSyncMapItemOptions extends Options { /** * @param int $ttl An alias for item_ttl * @param int $itemTtl How long, in seconds, before the Map Item expires * @param int $collectionTtl How long, in seconds, before the Map Item's parent * Sync Map expires and is deleted */ public function __construct(int $ttl = Values::NONE, int $itemTtl = Values::NONE, int $collectionTtl = Values::NONE) { $this->options['ttl'] = $ttl; $this->options['itemTtl'] = $itemTtl; $this->options['collectionTtl'] = $collectionTtl; } /** * An alias for `item_ttl`. If both parameters are provided, this value is ignored. * * @param int $ttl An alias for item_ttl * @return $this Fluent Builder */ public function setTtl(int $ttl): self { $this->options['ttl'] = $ttl; return $this; } /** * How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Map Item expires (time-to-live) and is deleted. * * @param int $itemTtl How long, in seconds, before the Map Item expires * @return $this Fluent Builder */ public function setItemTtl(int $itemTtl): self { $this->options['itemTtl'] = $itemTtl; return $this; } /** * How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Map Item's parent Sync Map expires (time-to-live) and is deleted. * * @param int $collectionTtl How long, in seconds, before the Map Item's parent * Sync Map expires and is deleted * @return $this Fluent Builder */ public function setCollectionTtl(int $collectionTtl): self { $this->options['collectionTtl'] = $collectionTtl; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Sync.V1.CreateSyncMapItemOptions ' . $options . ']'; } } class ReadSyncMapItemOptions extends Options { /** * @param string $order How to order the Map Items returned by their key value * @param string $from The index of the first Sync Map Item resource to read * @param string $bounds Whether to include the Map Item referenced by the from * parameter */ public function __construct(string $order = Values::NONE, string $from = Values::NONE, string $bounds = Values::NONE) { $this->options['order'] = $order; $this->options['from'] = $from; $this->options['bounds'] = $bounds; } /** * How to order the Map Items returned by their `key` value. Can be: `asc` (ascending) or `desc` (descending) and the default is ascending. Map Items are [ordered lexicographically](https://en.wikipedia.org/wiki/Lexicographical_order) by Item key. * * @param string $order How to order the Map Items returned by their key value * @return $this Fluent Builder */ public function setOrder(string $order): self { $this->options['order'] = $order; return $this; } /** * The `key` of the first Sync Map Item resource to read. See also `bounds`. * * @param string $from The index of the first Sync Map Item resource to read * @return $this Fluent Builder */ public function setFrom(string $from): self { $this->options['from'] = $from; return $this; } /** * Whether to include the Map Item referenced by the `from` parameter. Can be: `inclusive` to include the Map Item referenced by the `from` parameter or `exclusive` to start with the next Map Item. The default value is `inclusive`. * * @param string $bounds Whether to include the Map Item referenced by the from * parameter * @return $this Fluent Builder */ public function setBounds(string $bounds): self { $this->options['bounds'] = $bounds; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Sync.V1.ReadSyncMapItemOptions ' . $options . ']'; } } class UpdateSyncMapItemOptions extends Options { /** * @param array $data A JSON string that represents an arbitrary, schema-less * object that the Map Item stores * @param int $ttl An alias for item_ttl * @param int $itemTtl How long, in seconds, before the Map Item expires * @param int $collectionTtl How long, in seconds, before the Map Item's parent * Sync Map expires and is deleted * @param string $ifMatch The If-Match HTTP request header */ public function __construct(array $data = Values::ARRAY_NONE, int $ttl = Values::NONE, int $itemTtl = Values::NONE, int $collectionTtl = Values::NONE, string $ifMatch = Values::NONE) { $this->options['data'] = $data; $this->options['ttl'] = $ttl; $this->options['itemTtl'] = $itemTtl; $this->options['collectionTtl'] = $collectionTtl; $this->options['ifMatch'] = $ifMatch; } /** * A JSON string that represents an arbitrary, schema-less object that the Map Item stores. Can be up to 16 KiB in length. * * @param array $data A JSON string that represents an arbitrary, schema-less * object that the Map Item stores * @return $this Fluent Builder */ public function setData(array $data): self { $this->options['data'] = $data; return $this; } /** * An alias for `item_ttl`. If both parameters are provided, this value is ignored. * * @param int $ttl An alias for item_ttl * @return $this Fluent Builder */ public function setTtl(int $ttl): self { $this->options['ttl'] = $ttl; return $this; } /** * How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Map Item expires (time-to-live) and is deleted. * * @param int $itemTtl How long, in seconds, before the Map Item expires * @return $this Fluent Builder */ public function setItemTtl(int $itemTtl): self { $this->options['itemTtl'] = $itemTtl; return $this; } /** * How long, [in seconds](https://www.twilio.com/docs/sync/limits#sync-payload-limits), before the Map Item's parent Sync Map expires (time-to-live) and is deleted. This parameter can only be used when the Map Item's `data` or `ttl` is updated in the same request. * * @param int $collectionTtl How long, in seconds, before the Map Item's parent * Sync Map expires and is deleted * @return $this Fluent Builder */ public function setCollectionTtl(int $collectionTtl): self { $this->options['collectionTtl'] = $collectionTtl; return $this; } /** * If provided, applies this mutation if (and only if) the “revision” field of this [map item] matches the provided value. This matches the semantics of (and is implemented with) the HTTP [If-Match header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match). * * @param string $ifMatch The If-Match HTTP request header * @return $this Fluent Builder */ public function setIfMatch(string $ifMatch): self { $this->options['ifMatch'] = $ifMatch; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Sync.V1.UpdateSyncMapItemOptions ' . $options . ']'; } }src/Twilio/Rest/Sync/V1/Service/SyncMap/SyncMapItemPage.php000064400000002437150515725670017415 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SyncMapItemInstance \Twilio\Rest\Sync\V1\Service\SyncMap\SyncMapItemInstance */ public function buildInstance(array $payload): SyncMapItemInstance { return new SyncMapItemInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['mapSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Sync.V1.SyncMapItemPage]'; } }src/Twilio/Rest/Sync/V1/Service/SyncMap/SyncMapItemInstance.php000064400000011573150515725670020306 0ustar00properties = [ 'key' => Values::array_get($payload, 'key'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'mapSid' => Values::array_get($payload, 'map_sid'), 'url' => Values::array_get($payload, 'url'), 'revision' => Values::array_get($payload, 'revision'), 'data' => Values::array_get($payload, 'data'), 'dateExpires' => Deserialize::dateTime(Values::array_get($payload, 'date_expires')), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'createdBy' => Values::array_get($payload, 'created_by'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'mapSid' => $mapSid, 'key' => $key ?: $this->properties['key'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return SyncMapItemContext Context for this SyncMapItemInstance */ protected function proxy(): SyncMapItemContext { if (!$this->context) { $this->context = new SyncMapItemContext( $this->version, $this->solution['serviceSid'], $this->solution['mapSid'], $this->solution['key'] ); } return $this->context; } /** * Fetch the SyncMapItemInstance * * @return SyncMapItemInstance Fetched SyncMapItemInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SyncMapItemInstance { return $this->proxy()->fetch(); } /** * Delete the SyncMapItemInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { return $this->proxy()->delete($options); } /** * Update the SyncMapItemInstance * * @param array|Options $options Optional Arguments * @return SyncMapItemInstance Updated SyncMapItemInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SyncMapItemInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Sync.V1.SyncMapItemInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Sync/V1/Service/SyncMap/SyncMapPermissionInstance.php000064400000011213150515725670021527 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'mapSid' => Values::array_get($payload, 'map_sid'), 'identity' => Values::array_get($payload, 'identity'), 'read' => Values::array_get($payload, 'read'), 'write' => Values::array_get($payload, 'write'), 'manage' => Values::array_get($payload, 'manage'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'mapSid' => $mapSid, 'identity' => $identity ?: $this->properties['identity'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return SyncMapPermissionContext Context for this SyncMapPermissionInstance */ protected function proxy(): SyncMapPermissionContext { if (!$this->context) { $this->context = new SyncMapPermissionContext( $this->version, $this->solution['serviceSid'], $this->solution['mapSid'], $this->solution['identity'] ); } return $this->context; } /** * Fetch the SyncMapPermissionInstance * * @return SyncMapPermissionInstance Fetched SyncMapPermissionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SyncMapPermissionInstance { return $this->proxy()->fetch(); } /** * Delete the SyncMapPermissionInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the SyncMapPermissionInstance * * @param bool $read Read access * @param bool $write Write access * @param bool $manage Manage access * @return SyncMapPermissionInstance Updated SyncMapPermissionInstance * @throws TwilioException When an HTTP error occurs. */ public function update(bool $read, bool $write, bool $manage): SyncMapPermissionInstance { return $this->proxy()->update($read, $write, $manage); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Sync.V1.SyncMapPermissionInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Sync/V1/Service/SyncStreamList.php000064400000012733150515725670016001 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Streams'; } /** * Create the SyncStreamInstance * * @param array|Options $options Optional Arguments * @return SyncStreamInstance Created SyncStreamInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): SyncStreamInstance { $options = new Values($options); $data = Values::of(['UniqueName' => $options['uniqueName'], 'Ttl' => $options['ttl'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new SyncStreamInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Streams SyncStreamInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads SyncStreamInstance 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 SyncStreamInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of SyncStreamInstance 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 SyncStreamPage Page of SyncStreamInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SyncStreamPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new SyncStreamPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of SyncStreamInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return SyncStreamPage Page of SyncStreamInstance */ public function getPage(string $targetUrl): SyncStreamPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new SyncStreamPage($this->version, $response, $this->solution); } /** * Constructs a SyncStreamContext * * @param string $sid The SID of the Stream resource to fetch */ public function getContext(string $sid): SyncStreamContext { return new SyncStreamContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Sync.V1.SyncStreamList]'; } }src/Twilio/Rest/Sync/V1/Service/DocumentInstance.php000064400000011635150515725670016320 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), 'revision' => Values::array_get($payload, 'revision'), 'data' => Values::array_get($payload, 'data'), 'dateExpires' => Deserialize::dateTime(Values::array_get($payload, 'date_expires')), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'createdBy' => Values::array_get($payload, 'created_by'), ]; $this->solution = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return DocumentContext Context for this DocumentInstance */ protected function proxy(): DocumentContext { if (!$this->context) { $this->context = new DocumentContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the DocumentInstance * * @return DocumentInstance Fetched DocumentInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): DocumentInstance { return $this->proxy()->fetch(); } /** * Delete the DocumentInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the DocumentInstance * * @param array|Options $options Optional Arguments * @return DocumentInstance Updated DocumentInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): DocumentInstance { return $this->proxy()->update($options); } /** * Access the documentPermissions */ protected function getDocumentPermissions(): DocumentPermissionList { return $this->proxy()->documentPermissions; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Sync.V1.DocumentInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Sync/V1/Service/Document/DocumentPermissionContext.php000064400000007104150515725670022023 0ustar00solution = [ 'serviceSid' => $serviceSid, 'documentSid' => $documentSid, 'identity' => $identity, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Documents/' . \rawurlencode($documentSid) . '/Permissions/' . \rawurlencode($identity) . ''; } /** * Fetch the DocumentPermissionInstance * * @return DocumentPermissionInstance Fetched DocumentPermissionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): DocumentPermissionInstance { $payload = $this->version->fetch('GET', $this->uri); return new DocumentPermissionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['documentSid'], $this->solution['identity'] ); } /** * Delete the DocumentPermissionInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the DocumentPermissionInstance * * @param bool $read Read access * @param bool $write Write access * @param bool $manage Manage access * @return DocumentPermissionInstance Updated DocumentPermissionInstance * @throws TwilioException When an HTTP error occurs. */ public function update(bool $read, bool $write, bool $manage): DocumentPermissionInstance { $data = Values::of([ 'Read' => Serialize::booleanToString($read), 'Write' => Serialize::booleanToString($write), 'Manage' => Serialize::booleanToString($manage), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new DocumentPermissionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['documentSid'], $this->solution['identity'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Sync.V1.DocumentPermissionContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Sync/V1/Service/Document/DocumentPermissionPage.php000064400000002520150515725670021250 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return DocumentPermissionInstance \Twilio\Rest\Sync\V1\Service\Document\DocumentPermissionInstance */ public function buildInstance(array $payload): DocumentPermissionInstance { return new DocumentPermissionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['documentSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Sync.V1.DocumentPermissionPage]'; } }src/Twilio/Rest/Sync/V1/Service/Document/DocumentPermissionInstance.php000064400000011315150515725670022142 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'documentSid' => Values::array_get($payload, 'document_sid'), 'identity' => Values::array_get($payload, 'identity'), 'read' => Values::array_get($payload, 'read'), 'write' => Values::array_get($payload, 'write'), 'manage' => Values::array_get($payload, 'manage'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'documentSid' => $documentSid, 'identity' => $identity ?: $this->properties['identity'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return DocumentPermissionContext Context for this DocumentPermissionInstance */ protected function proxy(): DocumentPermissionContext { if (!$this->context) { $this->context = new DocumentPermissionContext( $this->version, $this->solution['serviceSid'], $this->solution['documentSid'], $this->solution['identity'] ); } return $this->context; } /** * Fetch the DocumentPermissionInstance * * @return DocumentPermissionInstance Fetched DocumentPermissionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): DocumentPermissionInstance { return $this->proxy()->fetch(); } /** * Delete the DocumentPermissionInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the DocumentPermissionInstance * * @param bool $read Read access * @param bool $write Write access * @param bool $manage Manage access * @return DocumentPermissionInstance Updated DocumentPermissionInstance * @throws TwilioException When an HTTP error occurs. */ public function update(bool $read, bool $write, bool $manage): DocumentPermissionInstance { return $this->proxy()->update($read, $write, $manage); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Sync.V1.DocumentPermissionInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Sync/V1/Service/Document/DocumentPermissionList.php000064400000012536150515725670021317 0ustar00solution = ['serviceSid' => $serviceSid, 'documentSid' => $documentSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Documents/' . \rawurlencode($documentSid) . '/Permissions'; } /** * Streams DocumentPermissionInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads DocumentPermissionInstance 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 DocumentPermissionInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of DocumentPermissionInstance 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 DocumentPermissionPage Page of DocumentPermissionInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): DocumentPermissionPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new DocumentPermissionPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of DocumentPermissionInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return DocumentPermissionPage Page of DocumentPermissionInstance */ public function getPage(string $targetUrl): DocumentPermissionPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new DocumentPermissionPage($this->version, $response, $this->solution); } /** * Constructs a DocumentPermissionContext * * @param string $identity The application-defined string that uniquely * identifies the User's Document Permission resource * to fetch */ public function getContext(string $identity): DocumentPermissionContext { return new DocumentPermissionContext( $this->version, $this->solution['serviceSid'], $this->solution['documentSid'], $identity ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Sync.V1.DocumentPermissionList]'; } }src/Twilio/Rest/Sync/V1/Service/SyncStreamContext.php000064400000010614150515725670016506 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Streams/' . \rawurlencode($sid) . ''; } /** * Fetch the SyncStreamInstance * * @return SyncStreamInstance Fetched SyncStreamInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SyncStreamInstance { $payload = $this->version->fetch('GET', $this->uri); return new SyncStreamInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Delete the SyncStreamInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the SyncStreamInstance * * @param array|Options $options Optional Arguments * @return SyncStreamInstance Updated SyncStreamInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SyncStreamInstance { $options = new Values($options); $data = Values::of(['Ttl' => $options['ttl'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new SyncStreamInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Access the streamMessages */ protected function getStreamMessages(): StreamMessageList { if (!$this->_streamMessages) { $this->_streamMessages = new StreamMessageList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_streamMessages; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Sync.V1.SyncStreamContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Sync/V1/Service/SyncListContext.php000064400000012264150515725670016171 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Lists/' . \rawurlencode($sid) . ''; } /** * Fetch the SyncListInstance * * @return SyncListInstance Fetched SyncListInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SyncListInstance { $payload = $this->version->fetch('GET', $this->uri); return new SyncListInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Delete the SyncListInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the SyncListInstance * * @param array|Options $options Optional Arguments * @return SyncListInstance Updated SyncListInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SyncListInstance { $options = new Values($options); $data = Values::of(['Ttl' => $options['ttl'], 'CollectionTtl' => $options['collectionTtl'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new SyncListInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Access the syncListItems */ protected function getSyncListItems(): SyncListItemList { if (!$this->_syncListItems) { $this->_syncListItems = new SyncListItemList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_syncListItems; } /** * Access the syncListPermissions */ protected function getSyncListPermissions(): SyncListPermissionList { if (!$this->_syncListPermissions) { $this->_syncListPermissions = new SyncListPermissionList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_syncListPermissions; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Sync.V1.SyncListContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Sync/V1/ServiceContext.php000064400000013544150515725670014423 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($sid) . ''; } /** * Fetch the ServiceInstance * * @return ServiceInstance Fetched ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ServiceInstance { $payload = $this->version->fetch('GET', $this->uri); return new ServiceInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the ServiceInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the ServiceInstance * * @param array|Options $options Optional Arguments * @return ServiceInstance Updated ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ServiceInstance { $options = new Values($options); $data = Values::of([ 'WebhookUrl' => $options['webhookUrl'], 'FriendlyName' => $options['friendlyName'], 'ReachabilityWebhooksEnabled' => Serialize::booleanToString($options['reachabilityWebhooksEnabled']), 'AclEnabled' => Serialize::booleanToString($options['aclEnabled']), 'ReachabilityDebouncingEnabled' => Serialize::booleanToString($options['reachabilityDebouncingEnabled']), 'ReachabilityDebouncingWindow' => $options['reachabilityDebouncingWindow'], 'WebhooksFromRestEnabled' => Serialize::booleanToString($options['webhooksFromRestEnabled']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ServiceInstance($this->version, $payload, $this->solution['sid']); } /** * Access the documents */ protected function getDocuments(): DocumentList { if (!$this->_documents) { $this->_documents = new DocumentList($this->version, $this->solution['sid']); } return $this->_documents; } /** * Access the syncLists */ protected function getSyncLists(): SyncListList { if (!$this->_syncLists) { $this->_syncLists = new SyncListList($this->version, $this->solution['sid']); } return $this->_syncLists; } /** * Access the syncMaps */ protected function getSyncMaps(): SyncMapList { if (!$this->_syncMaps) { $this->_syncMaps = new SyncMapList($this->version, $this->solution['sid']); } return $this->_syncMaps; } /** * Access the syncStreams */ protected function getSyncStreams(): SyncStreamList { if (!$this->_syncStreams) { $this->_syncStreams = new SyncStreamList($this->version, $this->solution['sid']); } return $this->_syncStreams; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Sync.V1.ServiceContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Sync/V1/ServiceOptions.php000064400000041765150515725670014440 0ustar00options['friendlyName'] = $friendlyName; $this->options['webhookUrl'] = $webhookUrl; $this->options['reachabilityWebhooksEnabled'] = $reachabilityWebhooksEnabled; $this->options['aclEnabled'] = $aclEnabled; $this->options['reachabilityDebouncingEnabled'] = $reachabilityDebouncingEnabled; $this->options['reachabilityDebouncingWindow'] = $reachabilityDebouncingWindow; $this->options['webhooksFromRestEnabled'] = $webhooksFromRestEnabled; } /** * A string that you assign to describe the resource. * * @param string $friendlyName A string that you assign to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The URL we should call when Sync objects are manipulated. * * @param string $webhookUrl The URL we should call when Sync objects are * manipulated * @return $this Fluent Builder */ public function setWebhookUrl(string $webhookUrl): self { $this->options['webhookUrl'] = $webhookUrl; return $this; } /** * Whether the service instance should call `webhook_url` when client endpoints connect to Sync. The default is `false`. * * @param bool $reachabilityWebhooksEnabled Whether the service instance should * call webhook_url when client * endpoints connect to Sync * @return $this Fluent Builder */ public function setReachabilityWebhooksEnabled(bool $reachabilityWebhooksEnabled): self { $this->options['reachabilityWebhooksEnabled'] = $reachabilityWebhooksEnabled; return $this; } /** * Whether token identities in the Service must be granted access to Sync objects by using the [Permissions](https://www.twilio.com/docs/sync/api/sync-permissions) resource. * * @param bool $aclEnabled Whether token identities in the Service must be * granted access to Sync objects by using the * Permissions resource * @return $this Fluent Builder */ public function setAclEnabled(bool $aclEnabled): self { $this->options['aclEnabled'] = $aclEnabled; return $this; } /** * Whether every `endpoint_disconnected` event should occur after a configurable delay. The default is `false`, where the `endpoint_disconnected` event occurs immediately after disconnection. When `true`, intervening reconnections can prevent the `endpoint_disconnected` event. * * @param bool $reachabilityDebouncingEnabled Whether every * endpoint_disconnected event * occurs after a configurable delay * @return $this Fluent Builder */ public function setReachabilityDebouncingEnabled(bool $reachabilityDebouncingEnabled): self { $this->options['reachabilityDebouncingEnabled'] = $reachabilityDebouncingEnabled; return $this; } /** * The reachability event delay in milliseconds if `reachability_debouncing_enabled` = `true`. Must be between 1,000 and 30,000 and defaults to 5,000. This is the number of milliseconds after the last running client disconnects, and a Sync identity is declared offline, before the `webhook_url` is called if all endpoints remain offline. A reconnection from the same identity by any endpoint during this interval prevents the call to `webhook_url`. * * @param int $reachabilityDebouncingWindow The reachability event delay in * milliseconds * @return $this Fluent Builder */ public function setReachabilityDebouncingWindow(int $reachabilityDebouncingWindow): self { $this->options['reachabilityDebouncingWindow'] = $reachabilityDebouncingWindow; return $this; } /** * Whether the Service instance should call `webhook_url` when the REST API is used to update Sync objects. The default is `false`. * * @param bool $webhooksFromRestEnabled Whether the Service instance should * call webhook_url when the REST API is * used to update Sync objects * @return $this Fluent Builder */ public function setWebhooksFromRestEnabled(bool $webhooksFromRestEnabled): self { $this->options['webhooksFromRestEnabled'] = $webhooksFromRestEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Sync.V1.CreateServiceOptions ' . $options . ']'; } } class UpdateServiceOptions extends Options { /** * @param string $webhookUrl The URL we should call when Sync objects are * manipulated * @param string $friendlyName A string that you assign to describe the resource * @param bool $reachabilityWebhooksEnabled Whether the service instance should * call webhook_url when client * endpoints connect to Sync * @param bool $aclEnabled Whether token identities in the Service must be * granted access to Sync objects by using the * Permissions resource * @param bool $reachabilityDebouncingEnabled Whether every * endpoint_disconnected event * occurs after a configurable delay * @param int $reachabilityDebouncingWindow The reachability event delay in * milliseconds * @param bool $webhooksFromRestEnabled Whether the Service instance should * call webhook_url when the REST API is * used to update Sync objects */ public function __construct(string $webhookUrl = Values::NONE, string $friendlyName = Values::NONE, bool $reachabilityWebhooksEnabled = Values::NONE, bool $aclEnabled = Values::NONE, bool $reachabilityDebouncingEnabled = Values::NONE, int $reachabilityDebouncingWindow = Values::NONE, bool $webhooksFromRestEnabled = Values::NONE) { $this->options['webhookUrl'] = $webhookUrl; $this->options['friendlyName'] = $friendlyName; $this->options['reachabilityWebhooksEnabled'] = $reachabilityWebhooksEnabled; $this->options['aclEnabled'] = $aclEnabled; $this->options['reachabilityDebouncingEnabled'] = $reachabilityDebouncingEnabled; $this->options['reachabilityDebouncingWindow'] = $reachabilityDebouncingWindow; $this->options['webhooksFromRestEnabled'] = $webhooksFromRestEnabled; } /** * The URL we should call when Sync objects are manipulated. * * @param string $webhookUrl The URL we should call when Sync objects are * manipulated * @return $this Fluent Builder */ public function setWebhookUrl(string $webhookUrl): self { $this->options['webhookUrl'] = $webhookUrl; return $this; } /** * A string that you assign to describe the resource. * * @param string $friendlyName A string that you assign to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Whether the service instance should call `webhook_url` when client endpoints connect to Sync. The default is `false`. * * @param bool $reachabilityWebhooksEnabled Whether the service instance should * call webhook_url when client * endpoints connect to Sync * @return $this Fluent Builder */ public function setReachabilityWebhooksEnabled(bool $reachabilityWebhooksEnabled): self { $this->options['reachabilityWebhooksEnabled'] = $reachabilityWebhooksEnabled; return $this; } /** * Whether token identities in the Service must be granted access to Sync objects by using the [Permissions](https://www.twilio.com/docs/sync/api/sync-permissions) resource. * * @param bool $aclEnabled Whether token identities in the Service must be * granted access to Sync objects by using the * Permissions resource * @return $this Fluent Builder */ public function setAclEnabled(bool $aclEnabled): self { $this->options['aclEnabled'] = $aclEnabled; return $this; } /** * Whether every `endpoint_disconnected` event should occur after a configurable delay. The default is `false`, where the `endpoint_disconnected` event occurs immediately after disconnection. When `true`, intervening reconnections can prevent the `endpoint_disconnected` event. * * @param bool $reachabilityDebouncingEnabled Whether every * endpoint_disconnected event * occurs after a configurable delay * @return $this Fluent Builder */ public function setReachabilityDebouncingEnabled(bool $reachabilityDebouncingEnabled): self { $this->options['reachabilityDebouncingEnabled'] = $reachabilityDebouncingEnabled; return $this; } /** * The reachability event delay in milliseconds if `reachability_debouncing_enabled` = `true`. Must be between 1,000 and 30,000 and defaults to 5,000. This is the number of milliseconds after the last running client disconnects, and a Sync identity is declared offline, before the webhook is called if all endpoints remain offline. A reconnection from the same identity by any endpoint during this interval prevents the webhook from being called. * * @param int $reachabilityDebouncingWindow The reachability event delay in * milliseconds * @return $this Fluent Builder */ public function setReachabilityDebouncingWindow(int $reachabilityDebouncingWindow): self { $this->options['reachabilityDebouncingWindow'] = $reachabilityDebouncingWindow; return $this; } /** * Whether the Service instance should call `webhook_url` when the REST API is used to update Sync objects. The default is `false`. * * @param bool $webhooksFromRestEnabled Whether the Service instance should * call webhook_url when the REST API is * used to update Sync objects * @return $this Fluent Builder */ public function setWebhooksFromRestEnabled(bool $webhooksFromRestEnabled): self { $this->options['webhooksFromRestEnabled'] = $webhooksFromRestEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Sync.V1.UpdateServiceOptions ' . $options . ']'; } }src/Twilio/Rest/Sync/V1/ServicePage.php000064400000002163150515725670013646 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ServiceInstance \Twilio\Rest\Sync\V1\ServiceInstance */ public function buildInstance(array $payload): ServiceInstance { return new ServiceInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Sync.V1.ServicePage]'; } }src/Twilio/Rest/Sync/V1/ServiceList.php000064400000013262150515725670013707 0ustar00solution = []; $this->uri = '/Services'; } /** * Create the ServiceInstance * * @param array|Options $options Optional Arguments * @return ServiceInstance Created ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): ServiceInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'WebhookUrl' => $options['webhookUrl'], 'ReachabilityWebhooksEnabled' => Serialize::booleanToString($options['reachabilityWebhooksEnabled']), 'AclEnabled' => Serialize::booleanToString($options['aclEnabled']), 'ReachabilityDebouncingEnabled' => Serialize::booleanToString($options['reachabilityDebouncingEnabled']), 'ReachabilityDebouncingWindow' => $options['reachabilityDebouncingWindow'], 'WebhooksFromRestEnabled' => Serialize::booleanToString($options['webhooksFromRestEnabled']), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ServiceInstance($this->version, $payload); } /** * Streams ServiceInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ServiceInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return ServiceInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of ServiceInstance records from the API. * Request is executed immediately * * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return ServicePage Page of ServiceInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ServicePage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ServicePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ServiceInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ServicePage Page of ServiceInstance */ public function getPage(string $targetUrl): ServicePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ServicePage($this->version, $response, $this->solution); } /** * Constructs a ServiceContext * * @param string $sid The SID of the Service resource to fetch */ public function getContext(string $sid): ServiceContext { return new ServiceContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Sync.V1.ServiceList]'; } }src/Twilio/Rest/Sync/V1.php000064400000004226150515725670011453 0ustar00version = 'v1'; } protected function getServices(): ServiceList { if (!$this->_services) { $this->_services = new ServiceList($this); } return $this->_services; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Sync.V1]'; } }src/Twilio/Rest/Insights.php000064400000006702150515725670012042 0ustar00baseUrl = 'https://insights.twilio.com'; } /** * @return V1 Version v1 of insights */ protected function getV1(): V1 { 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 TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } protected function getSettings(): \Twilio\Rest\Insights\V1\SettingList { return $this->v1->settings; } protected function contextSettings(): \Twilio\Rest\Insights\V1\SettingContext { return $this->v1->settings(); } protected function getCalls(): \Twilio\Rest\Insights\V1\CallList { return $this->v1->calls; } /** * @param string $sid The sid */ protected function contextCalls(string $sid): \Twilio\Rest\Insights\V1\CallContext { return $this->v1->calls($sid); } protected function getCallSummaries(): \Twilio\Rest\Insights\V1\CallSummariesList { return $this->v1->callSummaries; } protected function getRooms(): \Twilio\Rest\Insights\V1\RoomList { return $this->v1->rooms; } /** * @param string $roomSid The SID of the Room resource. */ protected function contextRooms(string $roomSid): \Twilio\Rest\Insights\V1\RoomContext { return $this->v1->rooms($roomSid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Insights]'; } }src/Twilio/Rest/Video.php000064400000011563150515725670011321 0ustar00baseUrl = 'https://video.twilio.com'; } /** * @return V1 Version v1 of video */ protected function getV1(): V1 { 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 TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } protected function getCompositions(): \Twilio\Rest\Video\V1\CompositionList { return $this->v1->compositions; } /** * @param string $sid The SID that identifies the resource to fetch */ protected function contextCompositions(string $sid): \Twilio\Rest\Video\V1\CompositionContext { return $this->v1->compositions($sid); } protected function getCompositionHooks(): \Twilio\Rest\Video\V1\CompositionHookList { return $this->v1->compositionHooks; } /** * @param string $sid The SID that identifies the resource to fetch */ protected function contextCompositionHooks(string $sid): \Twilio\Rest\Video\V1\CompositionHookContext { return $this->v1->compositionHooks($sid); } protected function getCompositionSettings(): \Twilio\Rest\Video\V1\CompositionSettingsList { return $this->v1->compositionSettings; } protected function contextCompositionSettings(): \Twilio\Rest\Video\V1\CompositionSettingsContext { return $this->v1->compositionSettings(); } protected function getRecordings(): \Twilio\Rest\Video\V1\RecordingList { return $this->v1->recordings; } /** * @param string $sid The SID that identifies the resource to fetch */ protected function contextRecordings(string $sid): \Twilio\Rest\Video\V1\RecordingContext { return $this->v1->recordings($sid); } protected function getRecordingSettings(): \Twilio\Rest\Video\V1\RecordingSettingsList { return $this->v1->recordingSettings; } protected function contextRecordingSettings(): \Twilio\Rest\Video\V1\RecordingSettingsContext { return $this->v1->recordingSettings(); } protected function getRooms(): \Twilio\Rest\Video\V1\RoomList { return $this->v1->rooms; } /** * @param string $sid The SID that identifies the resource to fetch */ protected function contextRooms(string $sid): \Twilio\Rest\Video\V1\RoomContext { return $this->v1->rooms($sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Video]'; } }src/Twilio/Rest/Proxy/V1/ServiceInstance.php000064400000012713150515725670014745 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'chatInstanceSid' => Values::array_get($payload, 'chat_instance_sid'), 'callbackUrl' => Values::array_get($payload, 'callback_url'), 'defaultTtl' => Values::array_get($payload, 'default_ttl'), 'numberSelectionBehavior' => Values::array_get($payload, 'number_selection_behavior'), 'geoMatchLevel' => Values::array_get($payload, 'geo_match_level'), 'interceptCallbackUrl' => Values::array_get($payload, 'intercept_callback_url'), 'outOfSessionCallbackUrl' => Values::array_get($payload, 'out_of_session_callback_url'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 ServiceContext Context for this ServiceInstance */ protected function proxy(): ServiceContext { if (!$this->context) { $this->context = new ServiceContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the ServiceInstance * * @return ServiceInstance Fetched ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ServiceInstance { return $this->proxy()->fetch(); } /** * Delete the ServiceInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the ServiceInstance * * @param array|Options $options Optional Arguments * @return ServiceInstance Updated ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ServiceInstance { return $this->proxy()->update($options); } /** * Access the sessions */ protected function getSessions(): SessionList { return $this->proxy()->sessions; } /** * Access the phoneNumbers */ protected function getPhoneNumbers(): PhoneNumberList { return $this->proxy()->phoneNumbers; } /** * Access the shortCodes */ protected function getShortCodes(): ShortCodeList { return $this->proxy()->shortCodes; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Proxy.V1.ServiceInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Proxy/V1/Service/PhoneNumberOptions.php000064400000011062150515725670017052 0ustar00options['sid'] = $sid; $this->options['phoneNumber'] = $phoneNumber; $this->options['isReserved'] = $isReserved; } /** * The SID of a Twilio [IncomingPhoneNumber](https://www.twilio.com/docs/phone-numbers/api/incomingphonenumber-resource) resource that represents the Twilio Number you would like to assign to your Proxy Service. * * @param string $sid The SID of a Twilio IncomingPhoneNumber resource * @return $this Fluent Builder */ public function setSid(string $sid): self { $this->options['sid'] = $sid; return $this; } /** * The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format. E.164 phone numbers consist of a + followed by the country code and subscriber number without punctuation characters. For example, +14155551234. * * @param string $phoneNumber The phone number in E.164 format * @return $this Fluent Builder */ public function setPhoneNumber(string $phoneNumber): self { $this->options['phoneNumber'] = $phoneNumber; return $this; } /** * Whether the new phone number should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information. * * @param bool $isReserved Whether the new phone number should be reserved * @return $this Fluent Builder */ public function setIsReserved(bool $isReserved): self { $this->options['isReserved'] = $isReserved; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Proxy.V1.CreatePhoneNumberOptions ' . $options . ']'; } } class UpdatePhoneNumberOptions extends Options { /** * @param bool $isReserved Whether the new phone number should be reserved */ public function __construct(bool $isReserved = Values::NONE) { $this->options['isReserved'] = $isReserved; } /** * Whether the phone number should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information. * * @param bool $isReserved Whether the new phone number should be reserved * @return $this Fluent Builder */ public function setIsReserved(bool $isReserved): self { $this->options['isReserved'] = $isReserved; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Proxy.V1.UpdatePhoneNumberOptions ' . $options . ']'; } }src/Twilio/Rest/Proxy/V1/Service/ShortCodeOptions.php000064400000003625150515725670016530 0ustar00options['isReserved'] = $isReserved; } /** * Whether the short code should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information. * * @param bool $isReserved Whether the short code should be reserved for manual * assignment to participants only * @return $this Fluent Builder */ public function setIsReserved(bool $isReserved): self { $this->options['isReserved'] = $isReserved; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Proxy.V1.UpdateShortCodeOptions ' . $options . ']'; } }src/Twilio/Rest/Proxy/V1/Service/ShortCodeInstance.php000064400000011007150515725670016632 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'shortCode' => Values::array_get($payload, 'short_code'), 'isoCountry' => Values::array_get($payload, 'iso_country'), 'capabilities' => Values::array_get($payload, 'capabilities'), 'url' => Values::array_get($payload, 'url'), 'isReserved' => Values::array_get($payload, 'is_reserved'), ]; $this->solution = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return ShortCodeContext Context for this ShortCodeInstance */ protected function proxy(): ShortCodeContext { if (!$this->context) { $this->context = new ShortCodeContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Delete the ShortCodeInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Fetch the ShortCodeInstance * * @return ShortCodeInstance Fetched ShortCodeInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ShortCodeInstance { return $this->proxy()->fetch(); } /** * Update the ShortCodeInstance * * @param array|Options $options Optional Arguments * @return ShortCodeInstance Updated ShortCodeInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ShortCodeInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Proxy.V1.ShortCodeInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Proxy/V1/Service/PhoneNumberContext.php000064400000005674150515725670017057 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/PhoneNumbers/' . \rawurlencode($sid) . ''; } /** * Delete the PhoneNumberInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Fetch the PhoneNumberInstance * * @return PhoneNumberInstance Fetched PhoneNumberInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): PhoneNumberInstance { $payload = $this->version->fetch('GET', $this->uri); return new PhoneNumberInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Update the PhoneNumberInstance * * @param array|Options $options Optional Arguments * @return PhoneNumberInstance Updated PhoneNumberInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): PhoneNumberInstance { $options = new Values($options); $data = Values::of(['IsReserved' => Serialize::booleanToString($options['isReserved']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new PhoneNumberInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Proxy.V1.PhoneNumberContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Proxy/V1/Service/SessionOptions.php000064400000026735150515725670016270 0ustar00options['uniqueName'] = $uniqueName; $this->options['dateExpiry'] = $dateExpiry; $this->options['ttl'] = $ttl; $this->options['mode'] = $mode; $this->options['status'] = $status; $this->options['participants'] = $participants; $this->options['failOnParticipantConflict'] = $failOnParticipantConflict; } /** * An application-defined string that uniquely identifies the resource. This value must be 191 characters or fewer in length and be unique. **This value should not have PII.** * * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Session should expire. If this is value is present, it overrides the `ttl` value. * * @param \DateTime $dateExpiry The ISO 8601 date when the Session should expire * @return $this Fluent Builder */ public function setDateExpiry(\DateTime $dateExpiry): self { $this->options['dateExpiry'] = $dateExpiry; return $this; } /** * The time, in seconds, when the session will expire. The time is measured from the last Session create or the Session's last Interaction. * * @param int $ttl When the session will expire * @return $this Fluent Builder */ public function setTtl(int $ttl): self { $this->options['ttl'] = $ttl; return $this; } /** * The Mode of the Session. Can be: `message-only`, `voice-only`, or `voice-and-message` and the default value is `voice-and-message`. * * @param string $mode The Mode of the Session * @return $this Fluent Builder */ public function setMode(string $mode): self { $this->options['mode'] = $mode; return $this; } /** * The initial status of the Session. Can be: `open`, `in-progress`, `closed`, `failed`, or `unknown`. The default is `open` on create. * * @param string $status Session status * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * The Participant objects to include in the new session. * * @param array[] $participants The Participant objects to include in the new * session * @return $this Fluent Builder */ public function setParticipants(array $participants): self { $this->options['participants'] = $participants; return $this; } /** * [Experimental] For accounts with the ProxyAllowParticipantConflict account flag, setting to true enables per-request opt-in to allowing Proxy to reject a Session create (with Participants) request that could cause the same Identifier/ProxyIdentifier pair to be active in multiple Sessions. Depending on the context, this could be a 409 error (Twilio error code 80623) or a 400 error (Twilio error code 80604). If not provided, requests will be allowed to succeed and a Debugger notification (80802) will be emitted. Having multiple, active Participants with the same Identifier/ProxyIdentifier pair causes calls and messages from affected Participants to be routed incorrectly. Please note, the default behavior for accounts without the ProxyAllowParticipantConflict flag is to reject the request as described. This will eventually be the default for all accounts. * * @param bool $failOnParticipantConflict An experimental parameter to override * the ProxyAllowParticipantConflict * account flag on a per-request basis. * @return $this Fluent Builder */ public function setFailOnParticipantConflict(bool $failOnParticipantConflict): self { $this->options['failOnParticipantConflict'] = $failOnParticipantConflict; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Proxy.V1.CreateSessionOptions ' . $options . ']'; } } class UpdateSessionOptions extends Options { /** * @param \DateTime $dateExpiry The ISO 8601 date when the Session should expire * @param int $ttl When the session will expire * @param string $status The new status of the resource * @param bool $failOnParticipantConflict An experimental parameter to override * the ProxyAllowParticipantConflict * account flag on a per-request basis. */ public function __construct(\DateTime $dateExpiry = Values::NONE, int $ttl = Values::NONE, string $status = Values::NONE, bool $failOnParticipantConflict = Values::NONE) { $this->options['dateExpiry'] = $dateExpiry; $this->options['ttl'] = $ttl; $this->options['status'] = $status; $this->options['failOnParticipantConflict'] = $failOnParticipantConflict; } /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Session should expire. If this is value is present, it overrides the `ttl` value. * * @param \DateTime $dateExpiry The ISO 8601 date when the Session should expire * @return $this Fluent Builder */ public function setDateExpiry(\DateTime $dateExpiry): self { $this->options['dateExpiry'] = $dateExpiry; return $this; } /** * The time, in seconds, when the session will expire. The time is measured from the last Session create or the Session's last Interaction. * * @param int $ttl When the session will expire * @return $this Fluent Builder */ public function setTtl(int $ttl): self { $this->options['ttl'] = $ttl; return $this; } /** * The new status of the resource. Can be: `in-progress` to re-open a session or `closed` to close a session. * * @param string $status The new status of the resource * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * [Experimental] For accounts with the ProxyAllowParticipantConflict account flag, setting to true enables per-request opt-in to allowing Proxy to return a 400 error (Twilio error code 80604) when a request to set a Session to in-progress would cause Participants with the same Identifier/ProxyIdentifier pair to be active in multiple Sessions. If not provided, requests will be allowed to succeed, and a Debugger notification (80801) will be emitted. Having multiple, active Participants with the same Identifier/ProxyIdentifier pair causes calls and messages from affected Participants to be routed incorrectly. Please note, the default behavior for accounts without the ProxyAllowParticipantConflict flag is to reject the request as described. This will eventually be the default for all accounts. * * @param bool $failOnParticipantConflict An experimental parameter to override * the ProxyAllowParticipantConflict * account flag on a per-request basis. * @return $this Fluent Builder */ public function setFailOnParticipantConflict(bool $failOnParticipantConflict): self { $this->options['failOnParticipantConflict'] = $failOnParticipantConflict; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Proxy.V1.UpdateSessionOptions ' . $options . ']'; } }src/Twilio/Rest/Proxy/V1/Service/SessionPage.php000064400000002426150515725670015500 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SessionInstance \Twilio\Rest\Proxy\V1\Service\SessionInstance */ public function buildInstance(array $payload): SessionInstance { return new SessionInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Proxy.V1.SessionPage]'; } }src/Twilio/Rest/Proxy/V1/Service/PhoneNumberPage.php000064400000002456150515725670016302 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return PhoneNumberInstance \Twilio\Rest\Proxy\V1\Service\PhoneNumberInstance */ public function buildInstance(array $payload): PhoneNumberInstance { return new PhoneNumberInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Proxy.V1.PhoneNumberPage]'; } }src/Twilio/Rest/Proxy/V1/Service/SessionContext.php000064400000012546150515725670016254 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Sessions/' . \rawurlencode($sid) . ''; } /** * Fetch the SessionInstance * * @return SessionInstance Fetched SessionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SessionInstance { $payload = $this->version->fetch('GET', $this->uri); return new SessionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Delete the SessionInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the SessionInstance * * @param array|Options $options Optional Arguments * @return SessionInstance Updated SessionInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SessionInstance { $options = new Values($options); $data = Values::of([ 'DateExpiry' => Serialize::iso8601DateTime($options['dateExpiry']), 'Ttl' => $options['ttl'], 'Status' => $options['status'], 'FailOnParticipantConflict' => Serialize::booleanToString($options['failOnParticipantConflict']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new SessionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Access the interactions */ protected function getInteractions(): InteractionList { if (!$this->_interactions) { $this->_interactions = new InteractionList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_interactions; } /** * Access the participants */ protected function getParticipants(): ParticipantList { if (!$this->_participants) { $this->_participants = new ParticipantList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_participants; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Proxy.V1.SessionContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Proxy/V1/Service/ShortCodeContext.php000064400000005613150515725670016520 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/ShortCodes/' . \rawurlencode($sid) . ''; } /** * Delete the ShortCodeInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Fetch the ShortCodeInstance * * @return ShortCodeInstance Fetched ShortCodeInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ShortCodeInstance { $payload = $this->version->fetch('GET', $this->uri); return new ShortCodeInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Update the ShortCodeInstance * * @param array|Options $options Optional Arguments * @return ShortCodeInstance Updated ShortCodeInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ShortCodeInstance { $options = new Values($options); $data = Values::of(['IsReserved' => Serialize::booleanToString($options['isReserved']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ShortCodeInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Proxy.V1.ShortCodeContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Proxy/V1/Service/SessionInstance.php000064400000013206150515725670016366 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'dateStarted' => Deserialize::dateTime(Values::array_get($payload, 'date_started')), 'dateEnded' => Deserialize::dateTime(Values::array_get($payload, 'date_ended')), 'dateLastInteraction' => Deserialize::dateTime(Values::array_get($payload, 'date_last_interaction')), 'dateExpiry' => Deserialize::dateTime(Values::array_get($payload, 'date_expiry')), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'status' => Values::array_get($payload, 'status'), 'closedReason' => Values::array_get($payload, 'closed_reason'), 'ttl' => Values::array_get($payload, 'ttl'), 'mode' => Values::array_get($payload, 'mode'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return SessionContext Context for this SessionInstance */ protected function proxy(): SessionContext { if (!$this->context) { $this->context = new SessionContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the SessionInstance * * @return SessionInstance Fetched SessionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SessionInstance { return $this->proxy()->fetch(); } /** * Delete the SessionInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the SessionInstance * * @param array|Options $options Optional Arguments * @return SessionInstance Updated SessionInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SessionInstance { return $this->proxy()->update($options); } /** * Access the interactions */ protected function getInteractions(): InteractionList { return $this->proxy()->interactions; } /** * Access the participants */ protected function getParticipants(): ParticipantList { return $this->proxy()->participants; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Proxy.V1.SessionInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Proxy/V1/Service/ShortCodePage.php000064400000002442150515725670015745 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ShortCodeInstance \Twilio\Rest\Proxy\V1\Service\ShortCodeInstance */ public function buildInstance(array $payload): ShortCodeInstance { return new ShortCodeInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Proxy.V1.ShortCodePage]'; } }src/Twilio/Rest/Proxy/V1/Service/ShortCodeList.php000064400000012627150515725670016012 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/ShortCodes'; } /** * Create the ShortCodeInstance * * @param string $sid The SID of a Twilio ShortCode resource * @return ShortCodeInstance Created ShortCodeInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $sid): ShortCodeInstance { $data = Values::of(['Sid' => $sid, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ShortCodeInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Streams ShortCodeInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ShortCodeInstance 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 ShortCodeInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of ShortCodeInstance 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 ShortCodePage Page of ShortCodeInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ShortCodePage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ShortCodePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ShortCodeInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ShortCodePage Page of ShortCodeInstance */ public function getPage(string $targetUrl): ShortCodePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ShortCodePage($this->version, $response, $this->solution); } /** * Constructs a ShortCodeContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): ShortCodeContext { return new ShortCodeContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Proxy.V1.ShortCodeList]'; } }src/Twilio/Rest/Proxy/V1/Service/PhoneNumberInstance.php000064400000011447150515725670017172 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'phoneNumber' => Values::array_get($payload, 'phone_number'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'isoCountry' => Values::array_get($payload, 'iso_country'), 'capabilities' => Values::array_get($payload, 'capabilities'), 'url' => Values::array_get($payload, 'url'), 'isReserved' => Values::array_get($payload, 'is_reserved'), 'inUse' => Values::array_get($payload, 'in_use'), ]; $this->solution = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return PhoneNumberContext Context for this PhoneNumberInstance */ protected function proxy(): PhoneNumberContext { if (!$this->context) { $this->context = new PhoneNumberContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Delete the PhoneNumberInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Fetch the PhoneNumberInstance * * @return PhoneNumberInstance Fetched PhoneNumberInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): PhoneNumberInstance { return $this->proxy()->fetch(); } /** * Update the PhoneNumberInstance * * @param array|Options $options Optional Arguments * @return PhoneNumberInstance Updated PhoneNumberInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): PhoneNumberInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Proxy.V1.PhoneNumberInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Proxy/V1/Service/SessionList.php000064400000013632150515725670015540 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Sessions'; } /** * Streams SessionInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads SessionInstance 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 SessionInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of SessionInstance 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 SessionPage Page of SessionInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SessionPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new SessionPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of SessionInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return SessionPage Page of SessionInstance */ public function getPage(string $targetUrl): SessionPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new SessionPage($this->version, $response, $this->solution); } /** * Create the SessionInstance * * @param array|Options $options Optional Arguments * @return SessionInstance Created SessionInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): SessionInstance { $options = new Values($options); $data = Values::of([ 'UniqueName' => $options['uniqueName'], 'DateExpiry' => Serialize::iso8601DateTime($options['dateExpiry']), 'Ttl' => $options['ttl'], 'Mode' => $options['mode'], 'Status' => $options['status'], 'Participants' => Serialize::map($options['participants'], function($e) { return Serialize::jsonObject($e); }), 'FailOnParticipantConflict' => Serialize::booleanToString($options['failOnParticipantConflict']), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new SessionInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Constructs a SessionContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): SessionContext { return new SessionContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Proxy.V1.SessionList]'; } }src/Twilio/Rest/Proxy/V1/Service/PhoneNumberList.php000064400000013370150515725670016336 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/PhoneNumbers'; } /** * Create the PhoneNumberInstance * * @param array|Options $options Optional Arguments * @return PhoneNumberInstance Created PhoneNumberInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): PhoneNumberInstance { $options = new Values($options); $data = Values::of([ 'Sid' => $options['sid'], 'PhoneNumber' => $options['phoneNumber'], 'IsReserved' => Serialize::booleanToString($options['isReserved']), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new PhoneNumberInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Streams PhoneNumberInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads PhoneNumberInstance 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 PhoneNumberInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of PhoneNumberInstance 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 PhoneNumberPage Page of PhoneNumberInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): PhoneNumberPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new PhoneNumberPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of PhoneNumberInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return PhoneNumberPage Page of PhoneNumberInstance */ public function getPage(string $targetUrl): PhoneNumberPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new PhoneNumberPage($this->version, $response, $this->solution); } /** * Constructs a PhoneNumberContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): PhoneNumberContext { return new PhoneNumberContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Proxy.V1.PhoneNumberList]'; } }src/Twilio/Rest/Proxy/V1/Service/Session/InteractionContext.php000064400000004665150515725670020536 0ustar00solution = ['serviceSid' => $serviceSid, 'sessionSid' => $sessionSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Sessions/' . \rawurlencode($sessionSid) . '/Interactions/' . \rawurlencode($sid) . ''; } /** * Fetch the InteractionInstance * * @return InteractionInstance Fetched InteractionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): InteractionInstance { $payload = $this->version->fetch('GET', $this->uri); return new InteractionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sessionSid'], $this->solution['sid'] ); } /** * Delete the InteractionInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Proxy.V1.InteractionContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Proxy/V1/Service/Session/InteractionPage.php000064400000002627150515725670017762 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return InteractionInstance \Twilio\Rest\Proxy\V1\Service\Session\InteractionInstance */ public function buildInstance(array $payload): InteractionInstance { return new InteractionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sessionSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Proxy.V1.InteractionPage]'; } }src/Twilio/Rest/Proxy/V1/Service/Session/InteractionInstance.php000064400000013072150515725670020646 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'sessionSid' => Values::array_get($payload, 'session_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'data' => Values::array_get($payload, 'data'), 'type' => Values::array_get($payload, 'type'), 'inboundParticipantSid' => Values::array_get($payload, 'inbound_participant_sid'), 'inboundResourceSid' => Values::array_get($payload, 'inbound_resource_sid'), 'inboundResourceStatus' => Values::array_get($payload, 'inbound_resource_status'), 'inboundResourceType' => Values::array_get($payload, 'inbound_resource_type'), 'inboundResourceUrl' => Values::array_get($payload, 'inbound_resource_url'), 'outboundParticipantSid' => Values::array_get($payload, 'outbound_participant_sid'), 'outboundResourceSid' => Values::array_get($payload, 'outbound_resource_sid'), 'outboundResourceStatus' => Values::array_get($payload, 'outbound_resource_status'), 'outboundResourceType' => Values::array_get($payload, 'outbound_resource_type'), 'outboundResourceUrl' => Values::array_get($payload, 'outbound_resource_url'), '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 = [ 'serviceSid' => $serviceSid, 'sessionSid' => $sessionSid, '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 InteractionContext Context for this InteractionInstance */ protected function proxy(): InteractionContext { if (!$this->context) { $this->context = new InteractionContext( $this->version, $this->solution['serviceSid'], $this->solution['sessionSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the InteractionInstance * * @return InteractionInstance Fetched InteractionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): InteractionInstance { return $this->proxy()->fetch(); } /** * Delete the InteractionInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Proxy.V1.InteractionInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Proxy/V1/Service/Session/InteractionList.php000064400000012221150515725670020010 0ustar00solution = ['serviceSid' => $serviceSid, 'sessionSid' => $sessionSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Sessions/' . \rawurlencode($sessionSid) . '/Interactions'; } /** * Streams InteractionInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads InteractionInstance 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 InteractionInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of InteractionInstance 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 InteractionPage Page of InteractionInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): InteractionPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new InteractionPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of InteractionInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return InteractionPage Page of InteractionInstance */ public function getPage(string $targetUrl): InteractionPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new InteractionPage($this->version, $response, $this->solution); } /** * Constructs a InteractionContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): InteractionContext { return new InteractionContext( $this->version, $this->solution['serviceSid'], $this->solution['sessionSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Proxy.V1.InteractionList]'; } }src/Twilio/Rest/Proxy/V1/Service/Session/ParticipantContext.php000064400000010477150515725670020533 0ustar00solution = ['serviceSid' => $serviceSid, 'sessionSid' => $sessionSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Sessions/' . \rawurlencode($sessionSid) . '/Participants/' . \rawurlencode($sid) . ''; } /** * Fetch the ParticipantInstance * * @return ParticipantInstance Fetched ParticipantInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ParticipantInstance { $payload = $this->version->fetch('GET', $this->uri); return new ParticipantInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sessionSid'], $this->solution['sid'] ); } /** * Delete the ParticipantInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the messageInteractions */ protected function getMessageInteractions(): MessageInteractionList { if (!$this->_messageInteractions) { $this->_messageInteractions = new MessageInteractionList( $this->version, $this->solution['serviceSid'], $this->solution['sessionSid'], $this->solution['sid'] ); } return $this->_messageInteractions; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Proxy.V1.ParticipantContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Proxy/V1/Service/Session/ParticipantPage.php000064400000002627150515725670017761 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ParticipantInstance \Twilio\Rest\Proxy\V1\Service\Session\ParticipantInstance */ public function buildInstance(array $payload): ParticipantInstance { return new ParticipantInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sessionSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Proxy.V1.ParticipantPage]'; } }src/Twilio/Rest/Proxy/V1/Service/Session/ParticipantList.php000064400000014441150515725670020015 0ustar00solution = ['serviceSid' => $serviceSid, 'sessionSid' => $sessionSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Sessions/' . \rawurlencode($sessionSid) . '/Participants'; } /** * Streams ParticipantInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ParticipantInstance 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 ParticipantInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of ParticipantInstance 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 ParticipantPage Page of ParticipantInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ParticipantPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ParticipantPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ParticipantInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ParticipantPage Page of ParticipantInstance */ public function getPage(string $targetUrl): ParticipantPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ParticipantPage($this->version, $response, $this->solution); } /** * Create the ParticipantInstance * * @param string $identifier The phone number of the Participant * @param array|Options $options Optional Arguments * @return ParticipantInstance Created ParticipantInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $identifier, array $options = []): ParticipantInstance { $options = new Values($options); $data = Values::of([ 'Identifier' => $identifier, 'FriendlyName' => $options['friendlyName'], 'ProxyIdentifier' => $options['proxyIdentifier'], 'ProxyIdentifierSid' => $options['proxyIdentifierSid'], 'FailOnParticipantConflict' => Serialize::booleanToString($options['failOnParticipantConflict']), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ParticipantInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sessionSid'] ); } /** * Constructs a ParticipantContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): ParticipantContext { return new ParticipantContext( $this->version, $this->solution['serviceSid'], $this->solution['sessionSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Proxy.V1.ParticipantList]'; } }src/Twilio/Rest/Proxy/V1/Service/Session/Participant/MessageInteractionOptions.php000064400000003661150515725670024323 0ustar00options['body'] = $body; $this->options['mediaUrl'] = $mediaUrl; } /** * The message to send to the participant * * @param string $body Message body * @return $this Fluent Builder */ public function setBody(string $body): self { $this->options['body'] = $body; return $this; } /** * Reserved. Not currently supported. * * @param string[] $mediaUrl Reserved * @return $this Fluent Builder */ public function setMediaUrl(array $mediaUrl): self { $this->options['mediaUrl'] = $mediaUrl; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Proxy.V1.CreateMessageInteractionOptions ' . $options . ']'; } }src/Twilio/Rest/Proxy/V1/Service/Session/Participant/MessageInteractionPage.php000064400000003010150515725670023530 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return MessageInteractionInstance \Twilio\Rest\Proxy\V1\Service\Session\Participant\MessageInteractionInstance */ public function buildInstance(array $payload): MessageInteractionInstance { return new MessageInteractionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sessionSid'], $this->solution['participantSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Proxy.V1.MessageInteractionPage]'; } }src/Twilio/Rest/Proxy/V1/Service/Session/Participant/MessageInteractionInstance.php000064400000013303150515725670024426 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'sessionSid' => Values::array_get($payload, 'session_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'data' => Values::array_get($payload, 'data'), 'type' => Values::array_get($payload, 'type'), 'participantSid' => Values::array_get($payload, 'participant_sid'), 'inboundParticipantSid' => Values::array_get($payload, 'inbound_participant_sid'), 'inboundResourceSid' => Values::array_get($payload, 'inbound_resource_sid'), 'inboundResourceStatus' => Values::array_get($payload, 'inbound_resource_status'), 'inboundResourceType' => Values::array_get($payload, 'inbound_resource_type'), 'inboundResourceUrl' => Values::array_get($payload, 'inbound_resource_url'), 'outboundParticipantSid' => Values::array_get($payload, 'outbound_participant_sid'), 'outboundResourceSid' => Values::array_get($payload, 'outbound_resource_sid'), 'outboundResourceStatus' => Values::array_get($payload, 'outbound_resource_status'), 'outboundResourceType' => Values::array_get($payload, 'outbound_resource_type'), 'outboundResourceUrl' => Values::array_get($payload, 'outbound_resource_url'), '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 = [ 'serviceSid' => $serviceSid, 'sessionSid' => $sessionSid, 'participantSid' => $participantSid, '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 MessageInteractionContext Context for this MessageInteractionInstance */ protected function proxy(): MessageInteractionContext { if (!$this->context) { $this->context = new MessageInteractionContext( $this->version, $this->solution['serviceSid'], $this->solution['sessionSid'], $this->solution['participantSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the MessageInteractionInstance * * @return MessageInteractionInstance Fetched MessageInteractionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MessageInteractionInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Proxy.V1.MessageInteractionInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Proxy/V1/Service/Session/Participant/MessageInteractionContext.php000064400000004637150515725670024320 0ustar00solution = [ 'serviceSid' => $serviceSid, 'sessionSid' => $sessionSid, 'participantSid' => $participantSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Sessions/' . \rawurlencode($sessionSid) . '/Participants/' . \rawurlencode($participantSid) . '/MessageInteractions/' . \rawurlencode($sid) . ''; } /** * Fetch the MessageInteractionInstance * * @return MessageInteractionInstance Fetched MessageInteractionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MessageInteractionInstance { $payload = $this->version->fetch('GET', $this->uri); return new MessageInteractionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sessionSid'], $this->solution['participantSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Proxy.V1.MessageInteractionContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Proxy/V1/Service/Session/Participant/MessageInteractionList.php000064400000015003150515725670023574 0ustar00solution = [ 'serviceSid' => $serviceSid, 'sessionSid' => $sessionSid, 'participantSid' => $participantSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Sessions/' . \rawurlencode($sessionSid) . '/Participants/' . \rawurlencode($participantSid) . '/MessageInteractions'; } /** * Create the MessageInteractionInstance * * @param array|Options $options Optional Arguments * @return MessageInteractionInstance Created MessageInteractionInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): MessageInteractionInstance { $options = new Values($options); $data = Values::of([ 'Body' => $options['body'], 'MediaUrl' => Serialize::map($options['mediaUrl'], function($e) { return $e; }), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new MessageInteractionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sessionSid'], $this->solution['participantSid'] ); } /** * Streams MessageInteractionInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads MessageInteractionInstance 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 MessageInteractionInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of MessageInteractionInstance 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 MessageInteractionPage Page of MessageInteractionInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): MessageInteractionPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new MessageInteractionPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of MessageInteractionInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return MessageInteractionPage Page of MessageInteractionInstance */ public function getPage(string $targetUrl): MessageInteractionPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new MessageInteractionPage($this->version, $response, $this->solution); } /** * Constructs a MessageInteractionContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): MessageInteractionContext { return new MessageInteractionContext( $this->version, $this->solution['serviceSid'], $this->solution['sessionSid'], $this->solution['participantSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Proxy.V1.MessageInteractionList]'; } }src/Twilio/Rest/Proxy/V1/Service/Session/ParticipantOptions.php000064400000012535150515725670020537 0ustar00options['friendlyName'] = $friendlyName; $this->options['proxyIdentifier'] = $proxyIdentifier; $this->options['proxyIdentifierSid'] = $proxyIdentifierSid; $this->options['failOnParticipantConflict'] = $failOnParticipantConflict; } /** * The string that you assigned to describe the participant. This value must be 255 characters or fewer. **This value should not have PII.** * * @param string $friendlyName The string that you assigned to describe the * participant * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The proxy phone number to use for the Participant. If not specified, Proxy will select a number from the pool. * * @param string $proxyIdentifier The proxy phone number to use for the * Participant * @return $this Fluent Builder */ public function setProxyIdentifier(string $proxyIdentifier): self { $this->options['proxyIdentifier'] = $proxyIdentifier; return $this; } /** * The SID of the Proxy Identifier to assign to the Participant. * * @param string $proxyIdentifierSid The Proxy Identifier Sid * @return $this Fluent Builder */ public function setProxyIdentifierSid(string $proxyIdentifierSid): self { $this->options['proxyIdentifierSid'] = $proxyIdentifierSid; return $this; } /** * [Experimental] For accounts with the ProxyAllowParticipantConflict account flag, setting to true enables per-request opt-in to allowing Proxy to reject a Participant create request that could cause the same Identifier/ProxyIdentifier pair to be active in multiple Sessions. Depending on the context, this could be a 409 error (Twilio error code 80623) or a 400 error (Twilio error code 80604). If not provided, requests will be allowed to succeed and a Debugger notification (80802) will be emitted. Having multiple, active Participants with the same Identifier/ProxyIdentifier pair causes calls and messages from affected Participants to be routed incorrectly. Please note, the default behavior for accounts without the ProxyAllowParticipantConflict flag is to reject the request as described. This will eventually be the default for all accounts. * * @param bool $failOnParticipantConflict An experimental parameter to override * the ProxyAllowParticipantConflict * account flag on a per-request basis. * @return $this Fluent Builder */ public function setFailOnParticipantConflict(bool $failOnParticipantConflict): self { $this->options['failOnParticipantConflict'] = $failOnParticipantConflict; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Proxy.V1.CreateParticipantOptions ' . $options . ']'; } }src/Twilio/Rest/Proxy/V1/Service/Session/ParticipantInstance.php000064400000012044150515725670020643 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'sessionSid' => Values::array_get($payload, 'session_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'identifier' => Values::array_get($payload, 'identifier'), 'proxyIdentifier' => Values::array_get($payload, 'proxy_identifier'), 'proxyIdentifierSid' => Values::array_get($payload, 'proxy_identifier_sid'), 'dateDeleted' => Deserialize::dateTime(Values::array_get($payload, 'date_deleted')), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'sessionSid' => $sessionSid, '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 ParticipantContext Context for this ParticipantInstance */ protected function proxy(): ParticipantContext { if (!$this->context) { $this->context = new ParticipantContext( $this->version, $this->solution['serviceSid'], $this->solution['sessionSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the ParticipantInstance * * @return ParticipantInstance Fetched ParticipantInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ParticipantInstance { return $this->proxy()->fetch(); } /** * Delete the ParticipantInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the messageInteractions */ protected function getMessageInteractions(): MessageInteractionList { return $this->proxy()->messageInteractions; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Proxy.V1.ParticipantInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Proxy/V1/ServiceContext.php000064400000012647150515725670014633 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($sid) . ''; } /** * Fetch the ServiceInstance * * @return ServiceInstance Fetched ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ServiceInstance { $payload = $this->version->fetch('GET', $this->uri); return new ServiceInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the ServiceInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the ServiceInstance * * @param array|Options $options Optional Arguments * @return ServiceInstance Updated ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ServiceInstance { $options = new Values($options); $data = Values::of([ 'UniqueName' => $options['uniqueName'], 'DefaultTtl' => $options['defaultTtl'], 'CallbackUrl' => $options['callbackUrl'], 'GeoMatchLevel' => $options['geoMatchLevel'], 'NumberSelectionBehavior' => $options['numberSelectionBehavior'], 'InterceptCallbackUrl' => $options['interceptCallbackUrl'], 'OutOfSessionCallbackUrl' => $options['outOfSessionCallbackUrl'], 'ChatInstanceSid' => $options['chatInstanceSid'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ServiceInstance($this->version, $payload, $this->solution['sid']); } /** * Access the sessions */ protected function getSessions(): SessionList { if (!$this->_sessions) { $this->_sessions = new SessionList($this->version, $this->solution['sid']); } return $this->_sessions; } /** * Access the phoneNumbers */ protected function getPhoneNumbers(): PhoneNumberList { if (!$this->_phoneNumbers) { $this->_phoneNumbers = new PhoneNumberList($this->version, $this->solution['sid']); } return $this->_phoneNumbers; } /** * Access the shortCodes */ protected function getShortCodes(): ShortCodeList { if (!$this->_shortCodes) { $this->_shortCodes = new ShortCodeList($this->version, $this->solution['sid']); } return $this->_shortCodes; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Proxy.V1.ServiceContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Proxy/V1/ServiceOptions.php000064400000042050150515725670014631 0ustar00options['defaultTtl'] = $defaultTtl; $this->options['callbackUrl'] = $callbackUrl; $this->options['geoMatchLevel'] = $geoMatchLevel; $this->options['numberSelectionBehavior'] = $numberSelectionBehavior; $this->options['interceptCallbackUrl'] = $interceptCallbackUrl; $this->options['outOfSessionCallbackUrl'] = $outOfSessionCallbackUrl; $this->options['chatInstanceSid'] = $chatInstanceSid; } /** * The default `ttl` value to set for Sessions created in the Service. The TTL (time to live) is measured in seconds after the Session's last create or last Interaction. The default value of `0` indicates an unlimited Session length. You can override a Session's default TTL value by setting its `ttl` value. * * @param int $defaultTtl Default TTL for a Session, in seconds * @return $this Fluent Builder */ public function setDefaultTtl(int $defaultTtl): self { $this->options['defaultTtl'] = $defaultTtl; return $this; } /** * The URL we should call when the interaction status changes. * * @param string $callbackUrl The URL we should call when the interaction * status changes * @return $this Fluent Builder */ public function setCallbackUrl(string $callbackUrl): self { $this->options['callbackUrl'] = $callbackUrl; return $this; } /** * Where a proxy number must be located relative to the participant identifier. Can be: `country`, `area-code`, or `extended-area-code`. The default value is `country` and more specific areas than `country` are only available in North America. * * @param string $geoMatchLevel Where a proxy number must be located relative * to the participant identifier * @return $this Fluent Builder */ public function setGeoMatchLevel(string $geoMatchLevel): self { $this->options['geoMatchLevel'] = $geoMatchLevel; return $this; } /** * The preference for Proxy Number selection in the Service instance. Can be: `prefer-sticky` or `avoid-sticky` and the default is `prefer-sticky`. `prefer-sticky` means that we will try and select the same Proxy Number for a given participant if they have previous [Sessions](https://www.twilio.com/docs/proxy/api/session), but we will not fail if that Proxy Number cannot be used. `avoid-sticky` means that we will try to use different Proxy Numbers as long as that is possible within a given pool rather than try and use a previously assigned number. * * @param string $numberSelectionBehavior The preference for Proxy Number * selection for the Service instance * @return $this Fluent Builder */ public function setNumberSelectionBehavior(string $numberSelectionBehavior): self { $this->options['numberSelectionBehavior'] = $numberSelectionBehavior; return $this; } /** * The URL we call on each interaction. If we receive a 403 status, we block the interaction; otherwise the interaction continues. * * @param string $interceptCallbackUrl The URL we call on each interaction * @return $this Fluent Builder */ public function setInterceptCallbackUrl(string $interceptCallbackUrl): self { $this->options['interceptCallbackUrl'] = $interceptCallbackUrl; return $this; } /** * The URL we should call when an inbound call or SMS action occurs on a closed or non-existent Session. If your server (or a Twilio [function](https://www.twilio.com/functions)) responds with valid [TwiML](https://www.twilio.com/docs/voice/twiml), we will process it. This means it is possible, for example, to play a message for a call, send an automated text message response, or redirect a call to another Phone Number. See [Out-of-Session Callback Response Guide](https://www.twilio.com/docs/proxy/out-session-callback-response-guide) for more information. * * @param string $outOfSessionCallbackUrl The URL we call when an inbound call * or SMS action occurs on a closed or * non-existent Session * @return $this Fluent Builder */ public function setOutOfSessionCallbackUrl(string $outOfSessionCallbackUrl): self { $this->options['outOfSessionCallbackUrl'] = $outOfSessionCallbackUrl; return $this; } /** * The SID of the Chat Service Instance managed by Proxy Service. The Chat Service enables Proxy to forward SMS and channel messages to this chat instance. This is a one-to-one relationship. * * @param string $chatInstanceSid The SID of the Chat Service Instance * @return $this Fluent Builder */ public function setChatInstanceSid(string $chatInstanceSid): self { $this->options['chatInstanceSid'] = $chatInstanceSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Proxy.V1.CreateServiceOptions ' . $options . ']'; } } class UpdateServiceOptions extends Options { /** * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @param int $defaultTtl Default TTL for a Session, in seconds * @param string $callbackUrl The URL we should call when the interaction * status changes * @param string $geoMatchLevel Where a proxy number must be located relative * to the participant identifier * @param string $numberSelectionBehavior The preference for Proxy Number * selection for the Service instance * @param string $interceptCallbackUrl The URL we call on each interaction * @param string $outOfSessionCallbackUrl The URL we call when an inbound call * or SMS action occurs on a closed or * non-existent Session * @param string $chatInstanceSid The SID of the Chat Service Instance */ public function __construct(string $uniqueName = Values::NONE, int $defaultTtl = Values::NONE, string $callbackUrl = Values::NONE, string $geoMatchLevel = Values::NONE, string $numberSelectionBehavior = Values::NONE, string $interceptCallbackUrl = Values::NONE, string $outOfSessionCallbackUrl = Values::NONE, string $chatInstanceSid = Values::NONE) { $this->options['uniqueName'] = $uniqueName; $this->options['defaultTtl'] = $defaultTtl; $this->options['callbackUrl'] = $callbackUrl; $this->options['geoMatchLevel'] = $geoMatchLevel; $this->options['numberSelectionBehavior'] = $numberSelectionBehavior; $this->options['interceptCallbackUrl'] = $interceptCallbackUrl; $this->options['outOfSessionCallbackUrl'] = $outOfSessionCallbackUrl; $this->options['chatInstanceSid'] = $chatInstanceSid; } /** * An application-defined string that uniquely identifies the resource. This value must be 191 characters or fewer in length and be unique. **This value should not have PII.** * * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * The default `ttl` value to set for Sessions created in the Service. The TTL (time to live) is measured in seconds after the Session's last create or last Interaction. The default value of `0` indicates an unlimited Session length. You can override a Session's default TTL value by setting its `ttl` value. * * @param int $defaultTtl Default TTL for a Session, in seconds * @return $this Fluent Builder */ public function setDefaultTtl(int $defaultTtl): self { $this->options['defaultTtl'] = $defaultTtl; return $this; } /** * The URL we should call when the interaction status changes. * * @param string $callbackUrl The URL we should call when the interaction * status changes * @return $this Fluent Builder */ public function setCallbackUrl(string $callbackUrl): self { $this->options['callbackUrl'] = $callbackUrl; return $this; } /** * Where a proxy number must be located relative to the participant identifier. Can be: `country`, `area-code`, or `extended-area-code`. The default value is `country` and more specific areas than `country` are only available in North America. * * @param string $geoMatchLevel Where a proxy number must be located relative * to the participant identifier * @return $this Fluent Builder */ public function setGeoMatchLevel(string $geoMatchLevel): self { $this->options['geoMatchLevel'] = $geoMatchLevel; return $this; } /** * The preference for Proxy Number selection in the Service instance. Can be: `prefer-sticky` or `avoid-sticky` and the default is `prefer-sticky`. `prefer-sticky` means that we will try and select the same Proxy Number for a given participant if they have previous [Sessions](https://www.twilio.com/docs/proxy/api/session), but we will not fail if that Proxy Number cannot be used. `avoid-sticky` means that we will try to use different Proxy Numbers as long as that is possible within a given pool rather than try and use a previously assigned number. * * @param string $numberSelectionBehavior The preference for Proxy Number * selection for the Service instance * @return $this Fluent Builder */ public function setNumberSelectionBehavior(string $numberSelectionBehavior): self { $this->options['numberSelectionBehavior'] = $numberSelectionBehavior; return $this; } /** * The URL we call on each interaction. If we receive a 403 status, we block the interaction; otherwise the interaction continues. * * @param string $interceptCallbackUrl The URL we call on each interaction * @return $this Fluent Builder */ public function setInterceptCallbackUrl(string $interceptCallbackUrl): self { $this->options['interceptCallbackUrl'] = $interceptCallbackUrl; return $this; } /** * The URL we should call when an inbound call or SMS action occurs on a closed or non-existent Session. If your server (or a Twilio [function](https://www.twilio.com/functions)) responds with valid [TwiML](https://www.twilio.com/docs/voice/twiml), we will process it. This means it is possible, for example, to play a message for a call, send an automated text message response, or redirect a call to another Phone Number. See [Out-of-Session Callback Response Guide](https://www.twilio.com/docs/proxy/out-session-callback-response-guide) for more information. * * @param string $outOfSessionCallbackUrl The URL we call when an inbound call * or SMS action occurs on a closed or * non-existent Session * @return $this Fluent Builder */ public function setOutOfSessionCallbackUrl(string $outOfSessionCallbackUrl): self { $this->options['outOfSessionCallbackUrl'] = $outOfSessionCallbackUrl; return $this; } /** * The SID of the Chat Service Instance managed by Proxy Service. The Chat Service enables Proxy to forward SMS and channel messages to this chat instance. This is a one-to-one relationship. * * @param string $chatInstanceSid The SID of the Chat Service Instance * @return $this Fluent Builder */ public function setChatInstanceSid(string $chatInstanceSid): self { $this->options['chatInstanceSid'] = $chatInstanceSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Proxy.V1.UpdateServiceOptions ' . $options . ']'; } }src/Twilio/Rest/Proxy/V1/ServicePage.php000064400000002347150515725670014057 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ServiceInstance \Twilio\Rest\Proxy\V1\ServiceInstance */ public function buildInstance(array $payload): ServiceInstance { return new ServiceInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Proxy.V1.ServicePage]'; } }src/Twilio/Rest/Proxy/V1/ServiceList.php000064400000013470150515725670014115 0ustar00solution = []; $this->uri = '/Services'; } /** * Streams ServiceInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ServiceInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return ServiceInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of ServiceInstance records from the API. * Request is executed immediately * * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return ServicePage Page of ServiceInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ServicePage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ServicePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ServiceInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ServicePage Page of ServiceInstance */ public function getPage(string $targetUrl): ServicePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ServicePage($this->version, $response, $this->solution); } /** * Create the ServiceInstance * * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @param array|Options $options Optional Arguments * @return ServiceInstance Created ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $uniqueName, array $options = []): ServiceInstance { $options = new Values($options); $data = Values::of([ 'UniqueName' => $uniqueName, 'DefaultTtl' => $options['defaultTtl'], 'CallbackUrl' => $options['callbackUrl'], 'GeoMatchLevel' => $options['geoMatchLevel'], 'NumberSelectionBehavior' => $options['numberSelectionBehavior'], 'InterceptCallbackUrl' => $options['interceptCallbackUrl'], 'OutOfSessionCallbackUrl' => $options['outOfSessionCallbackUrl'], 'ChatInstanceSid' => $options['chatInstanceSid'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ServiceInstance($this->version, $payload); } /** * Constructs a ServiceContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): ServiceContext { return new ServiceContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Proxy.V1.ServiceList]'; } }src/Twilio/Rest/Proxy/V1.php000064400000004233150515725670011656 0ustar00version = 'v1'; } protected function getServices(): ServiceList { if (!$this->_services) { $this->_services = new ServiceList($this); } return $this->_services; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Proxy.V1]'; } }src/Twilio/Rest/Trunking.php000064400000004752150515725670012056 0ustar00baseUrl = 'https://trunking.twilio.com'; } /** * @return V1 Version v1 of trunking */ protected function getV1(): V1 { 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 TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } protected function getTrunks(): \Twilio\Rest\Trunking\V1\TrunkList { return $this->v1->trunks; } /** * @param string $sid The unique string that identifies the resource */ protected function contextTrunks(string $sid): \Twilio\Rest\Trunking\V1\TrunkContext { return $this->v1->trunks($sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Trunking]'; } }src/Twilio/Rest/Verify.php000064400000007231150515725670011514 0ustar00baseUrl = 'https://verify.twilio.com'; } /** * @return V2 Version v2 of verify */ protected function getV2(): V2 { if (!$this->_v2) { $this->_v2 = new V2($this); } return $this->_v2; } /** * Magic getter to lazy load version * * @param string $name Version to return * @return \Twilio\Version The requested version * @throws TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } protected function getForms(): \Twilio\Rest\Verify\V2\FormList { return $this->v2->forms; } /** * @param string $formType The Type of this Form */ protected function contextForms(string $formType): \Twilio\Rest\Verify\V2\FormContext { return $this->v2->forms($formType); } protected function getServices(): \Twilio\Rest\Verify\V2\ServiceList { return $this->v2->services; } /** * @param string $sid The unique string that identifies the resource */ protected function contextServices(string $sid): \Twilio\Rest\Verify\V2\ServiceContext { return $this->v2->services($sid); } protected function getVerificationAttempts(): \Twilio\Rest\Verify\V2\VerificationAttemptList { return $this->v2->verificationAttempts; } /** * @param string $sid Verification Attempt Sid. */ protected function contextVerificationAttempts(string $sid): \Twilio\Rest\Verify\V2\VerificationAttemptContext { return $this->v2->verificationAttempts($sid); } protected function getTemplates(): \Twilio\Rest\Verify\V2\TemplateList { return $this->v2->templates; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify]'; } }src/Twilio/Rest/Monitor/V1/AlertInstance.php000064400000011012150515725670014711 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'alertText' => Values::array_get($payload, 'alert_text'), 'apiVersion' => Values::array_get($payload, 'api_version'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateGenerated' => Deserialize::dateTime(Values::array_get($payload, 'date_generated')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'errorCode' => Values::array_get($payload, 'error_code'), 'logLevel' => Values::array_get($payload, 'log_level'), 'moreInfo' => Values::array_get($payload, 'more_info'), 'requestMethod' => Values::array_get($payload, 'request_method'), 'requestUrl' => Values::array_get($payload, 'request_url'), 'requestVariables' => Values::array_get($payload, 'request_variables'), 'resourceSid' => Values::array_get($payload, 'resource_sid'), 'responseBody' => Values::array_get($payload, 'response_body'), 'responseHeaders' => Values::array_get($payload, 'response_headers'), 'sid' => Values::array_get($payload, 'sid'), 'url' => Values::array_get($payload, 'url'), 'requestHeaders' => Values::array_get($payload, 'request_headers'), 'serviceSid' => Values::array_get($payload, 'service_sid'), ]; $this->solution = ['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 AlertContext Context for this AlertInstance */ protected function proxy(): AlertContext { if (!$this->context) { $this->context = new AlertContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the AlertInstance * * @return AlertInstance Fetched AlertInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AlertInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Monitor.V1.AlertInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Monitor/V1/AlertList.php000064400000012031150515725670014062 0ustar00solution = []; $this->uri = '/Alerts'; } /** * Streams AlertInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads AlertInstance 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 AlertInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of AlertInstance 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 AlertPage Page of AlertInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): AlertPage { $options = new Values($options); $params = Values::of([ 'LogLevel' => $options['logLevel'], 'StartDate' => Serialize::iso8601DateTime($options['startDate']), 'EndDate' => Serialize::iso8601DateTime($options['endDate']), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new AlertPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of AlertInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return AlertPage Page of AlertInstance */ public function getPage(string $targetUrl): AlertPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new AlertPage($this->version, $response, $this->solution); } /** * Constructs a AlertContext * * @param string $sid The SID that identifies the resource to fetch */ public function getContext(string $sid): AlertContext { return new AlertContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Monitor.V1.AlertList]'; } }src/Twilio/Rest/Monitor/V1/AlertPage.php000064400000002160150515725670014025 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return AlertInstance \Twilio\Rest\Monitor\V1\AlertInstance */ public function buildInstance(array $payload): AlertInstance { return new AlertInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Monitor.V1.AlertPage]'; } }src/Twilio/Rest/Monitor/V1/AlertContext.php000064400000002703150515725670014600 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Alerts/' . \rawurlencode($sid) . ''; } /** * Fetch the AlertInstance * * @return AlertInstance Fetched AlertInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AlertInstance { $payload = $this->version->fetch('GET', $this->uri); return new AlertInstance($this->version, $payload, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Monitor.V1.AlertContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Monitor/V1/EventInstance.php000064400000007574150515725670014745 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'actorSid' => Values::array_get($payload, 'actor_sid'), 'actorType' => Values::array_get($payload, 'actor_type'), 'description' => Values::array_get($payload, 'description'), 'eventData' => Values::array_get($payload, 'event_data'), 'eventDate' => Deserialize::dateTime(Values::array_get($payload, 'event_date')), 'eventType' => Values::array_get($payload, 'event_type'), 'resourceSid' => Values::array_get($payload, 'resource_sid'), 'resourceType' => Values::array_get($payload, 'resource_type'), 'sid' => Values::array_get($payload, 'sid'), 'source' => Values::array_get($payload, 'source'), 'sourceIpAddress' => Values::array_get($payload, 'source_ip_address'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 EventContext Context for this EventInstance */ protected function proxy(): EventContext { if (!$this->context) { $this->context = new EventContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the EventInstance * * @return EventInstance Fetched EventInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): EventInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Monitor.V1.EventInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Monitor/V1/AlertOptions.php000064400000006350150515725670014611 0ustar00options['logLevel'] = $logLevel; $this->options['startDate'] = $startDate; $this->options['endDate'] = $endDate; } /** * Only show alerts for this log-level. Can be: `error`, `warning`, `notice`, or `debug`. * * @param string $logLevel Only show alerts for this log-level * @return $this Fluent Builder */ public function setLogLevel(string $logLevel): self { $this->options['logLevel'] = $logLevel; return $this; } /** * Only include alerts that occurred on or after this date and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported. * * @param \DateTime $startDate Only include alerts that occurred on or after * this date and time * @return $this Fluent Builder */ public function setStartDate(\DateTime $startDate): self { $this->options['startDate'] = $startDate; return $this; } /** * Only include alerts that occurred on or before this date and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported. * * @param \DateTime $endDate Only include alerts that occurred on or before * this date and time * @return $this Fluent Builder */ public function setEndDate(\DateTime $endDate): self { $this->options['endDate'] = $endDate; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Monitor.V1.ReadAlertOptions ' . $options . ']'; } }src/Twilio/Rest/Monitor/V1/EventOptions.php000064400000012530150515725670014620 0ustar00options['actorSid'] = $actorSid; $this->options['eventType'] = $eventType; $this->options['resourceSid'] = $resourceSid; $this->options['sourceIpAddress'] = $sourceIpAddress; $this->options['startDate'] = $startDate; $this->options['endDate'] = $endDate; } /** * Only include events initiated by this Actor. Useful for auditing actions taken by specific users or API credentials. * * @param string $actorSid Only include events initiated by this Actor * @return $this Fluent Builder */ public function setActorSid(string $actorSid): self { $this->options['actorSid'] = $actorSid; return $this; } /** * Only include events of this [Event Type](https://www.twilio.com/docs/usage/monitor-events#event-types). * * @param string $eventType Only include events of this Event Type * @return $this Fluent Builder */ public function setEventType(string $eventType): self { $this->options['eventType'] = $eventType; return $this; } /** * Only include events that refer to this resource. Useful for discovering the history of a specific resource. * * @param string $resourceSid Only include events that refer to this resource * @return $this Fluent Builder */ public function setResourceSid(string $resourceSid): self { $this->options['resourceSid'] = $resourceSid; return $this; } /** * Only include events that originated from this IP address. Useful for tracking suspicious activity originating from the API or the Twilio Console. * * @param string $sourceIpAddress Only include events that originated from this * IP address * @return $this Fluent Builder */ public function setSourceIpAddress(string $sourceIpAddress): self { $this->options['sourceIpAddress'] = $sourceIpAddress; return $this; } /** * Only include events that occurred on or after this date. Specify the date in GMT and [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. * * @param \DateTime $startDate Only include events that occurred on or after * this date * @return $this Fluent Builder */ public function setStartDate(\DateTime $startDate): self { $this->options['startDate'] = $startDate; return $this; } /** * Only include events that occurred on or before this date. Specify the date in GMT and [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. * * @param \DateTime $endDate Only include events that occurred on or before * this date * @return $this Fluent Builder */ public function setEndDate(\DateTime $endDate): self { $this->options['endDate'] = $endDate; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Monitor.V1.ReadEventOptions ' . $options . ']'; } }src/Twilio/Rest/Monitor/V1/EventList.php000064400000012277150515725670014110 0ustar00solution = []; $this->uri = '/Events'; } /** * Streams EventInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads EventInstance 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 EventInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of EventInstance 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 EventPage Page of EventInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): EventPage { $options = new Values($options); $params = Values::of([ 'ActorSid' => $options['actorSid'], 'EventType' => $options['eventType'], 'ResourceSid' => $options['resourceSid'], 'SourceIpAddress' => $options['sourceIpAddress'], 'StartDate' => Serialize::iso8601DateTime($options['startDate']), 'EndDate' => Serialize::iso8601DateTime($options['endDate']), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new EventPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of EventInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return EventPage Page of EventInstance */ public function getPage(string $targetUrl): EventPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new EventPage($this->version, $response, $this->solution); } /** * Constructs a EventContext * * @param string $sid The SID that identifies the resource to fetch */ public function getContext(string $sid): EventContext { return new EventContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Monitor.V1.EventList]'; } }src/Twilio/Rest/Monitor/V1/EventPage.php000064400000002160150515725670014037 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return EventInstance \Twilio\Rest\Monitor\V1\EventInstance */ public function buildInstance(array $payload): EventInstance { return new EventInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Monitor.V1.EventPage]'; } }src/Twilio/Rest/Monitor/V1/EventContext.php000064400000002703150515725670014612 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Events/' . \rawurlencode($sid) . ''; } /** * Fetch the EventInstance * * @return EventInstance Fetched EventInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): EventInstance { $payload = $this->version->fetch('GET', $this->uri); return new EventInstance($this->version, $payload, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Monitor.V1.EventContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Monitor/V1.php000064400000004740150515725670012167 0ustar00version = 'v1'; } protected function getAlerts(): AlertList { if (!$this->_alerts) { $this->_alerts = new AlertList($this); } return $this->_alerts; } protected function getEvents(): EventList { if (!$this->_events) { $this->_events = new EventList($this); } return $this->_events; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Monitor.V1]'; } }src/Twilio/Rest/Pricing.php000064400000007720150515725670011646 0ustar00baseUrl = 'https://pricing.twilio.com'; } /** * @return V1 Version v1 of pricing */ protected function getV1(): V1 { if (!$this->_v1) { $this->_v1 = new V1($this); } return $this->_v1; } /** * @return V2 Version v2 of pricing */ protected function getV2(): V2 { if (!$this->_v2) { $this->_v2 = new V2($this); } return $this->_v2; } /** * Magic getter to lazy load version * * @param string $name Version to return * @return \Twilio\Version The requested version * @throws TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } protected function getMessaging(): \Twilio\Rest\Pricing\V1\MessagingList { return $this->v1->messaging; } protected function getPhoneNumbers(): \Twilio\Rest\Pricing\V1\PhoneNumberList { return $this->v1->phoneNumbers; } protected function getVoice(): \Twilio\Rest\Pricing\V2\VoiceList { return $this->v2->voice; } protected function getCountries(): \Twilio\Rest\Pricing\V2\CountryList { return $this->v2->countries; } /** * @param string $isoCountry The ISO country code of the pricing information to * fetch */ protected function contextCountries(string $isoCountry): \Twilio\Rest\Pricing\V2\CountryContext { return $this->v2->countries($isoCountry); } protected function getNumbers(): \Twilio\Rest\Pricing\V2\NumberList { return $this->v2->numbers; } /** * @param string $destinationNumber The destination number for which to fetch * pricing information */ protected function contextNumbers(string $destinationNumber): \Twilio\Rest\Pricing\V2\NumberContext { return $this->v2->numbers($destinationNumber); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Pricing]'; } }src/Twilio/Rest/Fax.php000064400000004645150515725670010774 0ustar00baseUrl = 'https://fax.twilio.com'; } /** * @return V1 Version v1 of fax */ protected function getV1(): V1 { 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 TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } protected function getFaxes(): \Twilio\Rest\Fax\V1\FaxList { return $this->v1->faxes; } /** * @param string $sid The unique string that identifies the resource */ protected function contextFaxes(string $sid): \Twilio\Rest\Fax\V1\FaxContext { return $this->v1->faxes($sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Fax]'; } }src/Twilio/Rest/Verify/V2.php000064400000006417150515725670012010 0ustar00version = 'v2'; } protected function getForms(): FormList { if (!$this->_forms) { $this->_forms = new FormList($this); } return $this->_forms; } protected function getServices(): ServiceList { if (!$this->_services) { $this->_services = new ServiceList($this); } return $this->_services; } protected function getVerificationAttempts(): VerificationAttemptList { if (!$this->_verificationAttempts) { $this->_verificationAttempts = new VerificationAttemptList($this); } return $this->_verificationAttempts; } protected function getTemplates(): TemplateList { if (!$this->_templates) { $this->_templates = new TemplateList($this); } return $this->_templates; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Verify.V2]'; } }src/Twilio/Rest/Verify/V2/ServiceInstance.php000064400000015351150515725670015072 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'codeLength' => Values::array_get($payload, 'code_length'), 'lookupEnabled' => Values::array_get($payload, 'lookup_enabled'), 'psd2Enabled' => Values::array_get($payload, 'psd2_enabled'), 'skipSmsToLandlines' => Values::array_get($payload, 'skip_sms_to_landlines'), 'dtmfInputRequired' => Values::array_get($payload, 'dtmf_input_required'), 'ttsName' => Values::array_get($payload, 'tts_name'), 'doNotShareWarningEnabled' => Values::array_get($payload, 'do_not_share_warning_enabled'), 'customCodeEnabled' => Values::array_get($payload, 'custom_code_enabled'), 'push' => Values::array_get($payload, 'push'), 'totp' => Values::array_get($payload, 'totp'), 'defaultTemplateSid' => Values::array_get($payload, 'default_template_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 ServiceContext Context for this ServiceInstance */ protected function proxy(): ServiceContext { if (!$this->context) { $this->context = new ServiceContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the ServiceInstance * * @return ServiceInstance Fetched ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ServiceInstance { return $this->proxy()->fetch(); } /** * Delete the ServiceInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the ServiceInstance * * @param array|Options $options Optional Arguments * @return ServiceInstance Updated ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ServiceInstance { return $this->proxy()->update($options); } /** * Access the verifications */ protected function getVerifications(): VerificationList { return $this->proxy()->verifications; } /** * Access the verificationChecks */ protected function getVerificationChecks(): VerificationCheckList { return $this->proxy()->verificationChecks; } /** * Access the rateLimits */ protected function getRateLimits(): RateLimitList { return $this->proxy()->rateLimits; } /** * Access the messagingConfigurations */ protected function getMessagingConfigurations(): MessagingConfigurationList { return $this->proxy()->messagingConfigurations; } /** * Access the entities */ protected function getEntities(): EntityList { return $this->proxy()->entities; } /** * Access the webhooks */ protected function getWebhooks(): WebhookList { return $this->proxy()->webhooks; } /** * Access the accessTokens */ protected function getAccessTokens(): AccessTokenList { return $this->proxy()->accessTokens; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Verify.V2.ServiceInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Verify/V2/TemplateList.php000064400000011252150515725670014410 0ustar00solution = []; $this->uri = '/Templates'; } /** * Streams TemplateInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads TemplateInstance 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 TemplateInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of TemplateInstance 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 TemplatePage Page of TemplateInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): TemplatePage { $options = new Values($options); $params = Values::of([ 'FriendlyName' => $options['friendlyName'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new TemplatePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of TemplateInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return TemplatePage Page of TemplateInstance */ public function getPage(string $targetUrl): TemplatePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new TemplatePage($this->version, $response, $this->solution); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.TemplateList]'; } }src/Twilio/Rest/Verify/V2/TemplatePage.php000064400000002177150515725670014357 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return TemplateInstance \Twilio\Rest\Verify\V2\TemplateInstance */ public function buildInstance(array $payload): TemplateInstance { return new TemplateInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.TemplatePage]'; } }src/Twilio/Rest/Verify/V2/VerificationAttemptList.php000064400000012503150515725670016616 0ustar00solution = []; $this->uri = '/Attempts'; } /** * Streams VerificationAttemptInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads VerificationAttemptInstance 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 VerificationAttemptInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of VerificationAttemptInstance 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 VerificationAttemptPage Page of VerificationAttemptInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): VerificationAttemptPage { $options = new Values($options); $params = Values::of([ 'DateCreatedAfter' => Serialize::iso8601DateTime($options['dateCreatedAfter']), 'DateCreatedBefore' => Serialize::iso8601DateTime($options['dateCreatedBefore']), 'ChannelData.To' => $options['channelDataTo'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new VerificationAttemptPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of VerificationAttemptInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return VerificationAttemptPage Page of VerificationAttemptInstance */ public function getPage(string $targetUrl): VerificationAttemptPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new VerificationAttemptPage($this->version, $response, $this->solution); } /** * Constructs a VerificationAttemptContext * * @param string $sid Verification Attempt Sid. */ public function getContext(string $sid): VerificationAttemptContext { return new VerificationAttemptContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.VerificationAttemptList]'; } }src/Twilio/Rest/Verify/V2/Service/MessagingConfigurationInstance.php000064400000011127150515725700021526 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'country' => Values::array_get($payload, 'country'), 'messagingServiceSid' => Values::array_get($payload, 'messaging_service_sid'), '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 = [ 'serviceSid' => $serviceSid, 'country' => $country ?: $this->properties['country'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return MessagingConfigurationContext Context for this * MessagingConfigurationInstance */ protected function proxy(): MessagingConfigurationContext { if (!$this->context) { $this->context = new MessagingConfigurationContext( $this->version, $this->solution['serviceSid'], $this->solution['country'] ); } return $this->context; } /** * Update the MessagingConfigurationInstance * * @param string $messagingServiceSid The SID of the Messaging Service used for * this configuration. * @return MessagingConfigurationInstance Updated MessagingConfigurationInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $messagingServiceSid): MessagingConfigurationInstance { return $this->proxy()->update($messagingServiceSid); } /** * Fetch the MessagingConfigurationInstance * * @return MessagingConfigurationInstance Fetched MessagingConfigurationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MessagingConfigurationInstance { return $this->proxy()->fetch(); } /** * Delete the MessagingConfigurationInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Verify.V2.MessagingConfigurationInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Verify/V2/Service/MessagingConfigurationPage.php000064400000002402150515725700020632 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return MessagingConfigurationInstance \Twilio\Rest\Verify\V2\Service\MessagingConfigurationInstance */ public function buildInstance(array $payload): MessagingConfigurationInstance { return new MessagingConfigurationInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.MessagingConfigurationPage]'; } }src/Twilio/Rest/Verify/V2/Service/MessagingConfigurationList.php000064400000013704150515725700020700 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/MessagingConfigurations'; } /** * Create the MessagingConfigurationInstance * * @param string $country The ISO-3166-1 country code of the country or `all`. * @param string $messagingServiceSid The SID of the Messaging Service used for * this configuration. * @return MessagingConfigurationInstance Created MessagingConfigurationInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $country, string $messagingServiceSid): MessagingConfigurationInstance { $data = Values::of(['Country' => $country, 'MessagingServiceSid' => $messagingServiceSid, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new MessagingConfigurationInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Streams MessagingConfigurationInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads MessagingConfigurationInstance 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 MessagingConfigurationInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of MessagingConfigurationInstance 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 MessagingConfigurationPage Page of MessagingConfigurationInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): MessagingConfigurationPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new MessagingConfigurationPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of MessagingConfigurationInstance records from the * API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return MessagingConfigurationPage Page of MessagingConfigurationInstance */ public function getPage(string $targetUrl): MessagingConfigurationPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new MessagingConfigurationPage($this->version, $response, $this->solution); } /** * Constructs a MessagingConfigurationContext * * @param string $country The ISO-3166-1 country code of the country or `all`. */ public function getContext(string $country): MessagingConfigurationContext { return new MessagingConfigurationContext($this->version, $this->solution['serviceSid'], $country); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.MessagingConfigurationList]'; } }src/Twilio/Rest/Verify/V2/Service/AccessTokenOptions.php000064400000003175150515725700017156 0ustar00options['factorFriendlyName'] = $factorFriendlyName; } /** * The friendly name of the factor that is going to be created with this access token * * @param string $factorFriendlyName The factor friendly name * @return $this Fluent Builder */ public function setFactorFriendlyName(string $factorFriendlyName): self { $this->options['factorFriendlyName'] = $factorFriendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Verify.V2.CreateAccessTokenOptions ' . $options . ']'; } }src/Twilio/Rest/Verify/V2/Service/VerificationContext.php000064400000004655150515725700017373 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Verifications/' . \rawurlencode($sid) . ''; } /** * Update the VerificationInstance * * @param string $status The new status of the resource * @return VerificationInstance Updated VerificationInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $status): VerificationInstance { $data = Values::of(['Status' => $status, ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new VerificationInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Fetch the VerificationInstance * * @return VerificationInstance Fetched VerificationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): VerificationInstance { $payload = $this->version->fetch('GET', $this->uri); return new VerificationInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Verify.V2.VerificationContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Verify/V2/Service/VerificationCheckOptions.php000064400000007523150515725700020335 0ustar00options['to'] = $to; $this->options['verificationSid'] = $verificationSid; $this->options['amount'] = $amount; $this->options['payee'] = $payee; } /** * The phone number or [email](https://www.twilio.com/docs/verify/email) to verify. Either this parameter or the `verification_sid` must be specified. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). * * @param string $to The phone number or email to verify * @return $this Fluent Builder */ public function setTo(string $to): self { $this->options['to'] = $to; return $this; } /** * A SID that uniquely identifies the Verification Check. Either this parameter or the `to` phone number/[email](https://www.twilio.com/docs/verify/email) must be specified. * * @param string $verificationSid A SID that uniquely identifies the * Verification Check * @return $this Fluent Builder */ public function setVerificationSid(string $verificationSid): self { $this->options['verificationSid'] = $verificationSid; return $this; } /** * The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. * * @param string $amount The amount of the associated PSD2 compliant * transaction. * @return $this Fluent Builder */ public function setAmount(string $amount): self { $this->options['amount'] = $amount; return $this; } /** * The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. * * @param string $payee The payee of the associated PSD2 compliant transaction * @return $this Fluent Builder */ public function setPayee(string $payee): self { $this->options['payee'] = $payee; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Verify.V2.CreateVerificationCheckOptions ' . $options . ']'; } }src/Twilio/Rest/Verify/V2/Service/EntityList.php000064400000012522150515725700015504 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Entities'; } /** * Create the EntityInstance * * @param string $identity Unique external identifier of the Entity * @return EntityInstance Created EntityInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $identity): EntityInstance { $data = Values::of(['Identity' => $identity, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new EntityInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Streams EntityInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads EntityInstance 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 EntityInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of EntityInstance 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 EntityPage Page of EntityInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): EntityPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new EntityPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of EntityInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return EntityPage Page of EntityInstance */ public function getPage(string $targetUrl): EntityPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new EntityPage($this->version, $response, $this->solution); } /** * Constructs a EntityContext * * @param string $identity Unique external identifier of the Entity */ public function getContext(string $identity): EntityContext { return new EntityContext($this->version, $this->solution['serviceSid'], $identity); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.EntityList]'; } }src/Twilio/Rest/Verify/V2/Service/Entity/NewFactorPage.php000064400000002612150515725700017334 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return NewFactorInstance \Twilio\Rest\Verify\V2\Service\Entity\NewFactorInstance */ public function buildInstance(array $payload): NewFactorInstance { return new NewFactorInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['identity'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.NewFactorPage]'; } }src/Twilio/Rest/Verify/V2/Service/Entity/ChallengeContext.php000064400000010662150515725700020102 0ustar00solution = ['serviceSid' => $serviceSid, 'identity' => $identity, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Entities/' . \rawurlencode($identity) . '/Challenges/' . \rawurlencode($sid) . ''; } /** * Fetch the ChallengeInstance * * @return ChallengeInstance Fetched ChallengeInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ChallengeInstance { $payload = $this->version->fetch('GET', $this->uri); return new ChallengeInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['identity'], $this->solution['sid'] ); } /** * Update the ChallengeInstance * * @param array|Options $options Optional Arguments * @return ChallengeInstance Updated ChallengeInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ChallengeInstance { $options = new Values($options); $data = Values::of(['AuthPayload' => $options['authPayload'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ChallengeInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['identity'], $this->solution['sid'] ); } /** * Access the notifications */ protected function getNotifications(): NotificationList { if (!$this->_notifications) { $this->_notifications = new NotificationList( $this->version, $this->solution['serviceSid'], $this->solution['identity'], $this->solution['sid'] ); } return $this->_notifications; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Verify.V2.ChallengeContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Verify/V2/Service/Entity/FactorInstance.php000064400000011502150515725700017550 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'entitySid' => Values::array_get($payload, 'entity_sid'), 'identity' => Values::array_get($payload, 'identity'), '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'), 'status' => Values::array_get($payload, 'status'), 'factorType' => Values::array_get($payload, 'factor_type'), 'config' => Values::array_get($payload, 'config'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'identity' => $identity, '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 FactorContext Context for this FactorInstance */ protected function proxy(): FactorContext { if (!$this->context) { $this->context = new FactorContext( $this->version, $this->solution['serviceSid'], $this->solution['identity'], $this->solution['sid'] ); } return $this->context; } /** * Delete the FactorInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Fetch the FactorInstance * * @return FactorInstance Fetched FactorInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FactorInstance { return $this->proxy()->fetch(); } /** * Update the FactorInstance * * @param array|Options $options Optional Arguments * @return FactorInstance Updated FactorInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): FactorInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Verify.V2.FactorInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Verify/V2/Service/Entity/NewFactorList.php000064400000005462150515725700017401 0ustar00solution = ['serviceSid' => $serviceSid, 'identity' => $identity, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Entities/' . \rawurlencode($identity) . '/Factors'; } /** * Create the NewFactorInstance * * @param string $friendlyName The friendly name of this Factor * @param string $factorType The Type of this Factor * @param array|Options $options Optional Arguments * @return NewFactorInstance Created NewFactorInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, string $factorType, array $options = []): NewFactorInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $friendlyName, 'FactorType' => $factorType, 'Binding.Alg' => $options['bindingAlg'], 'Binding.PublicKey' => $options['bindingPublicKey'], 'Config.AppId' => $options['configAppId'], 'Config.NotificationPlatform' => $options['configNotificationPlatform'], 'Config.NotificationToken' => $options['configNotificationToken'], 'Config.SdkVersion' => $options['configSdkVersion'], 'Binding.Secret' => $options['bindingSecret'], 'Config.TimeStep' => $options['configTimeStep'], 'Config.Skew' => $options['configSkew'], 'Config.CodeLength' => $options['configCodeLength'], 'Config.Alg' => $options['configAlg'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new NewFactorInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['identity'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.NewFactorList]'; } }src/Twilio/Rest/Verify/V2/Service/Entity/ChallengeOptions.php000064400000022127150515725700020110 0ustar00options['expirationDate'] = $expirationDate; $this->options['detailsMessage'] = $detailsMessage; $this->options['detailsFields'] = $detailsFields; $this->options['hiddenDetails'] = $hiddenDetails; $this->options['authPayload'] = $authPayload; } /** * The date-time when this Challenge expires, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. The default value is five (5) minutes after Challenge creation. The max value is sixty (60) minutes after creation. * * @param \DateTime $expirationDate The date-time when this Challenge expires * @return $this Fluent Builder */ public function setExpirationDate(\DateTime $expirationDate): self { $this->options['expirationDate'] = $expirationDate; return $this; } /** * Shown to the user when the push notification arrives. Required when `factor_type` is `push`. Can be up to 256 characters in length * * @param string $detailsMessage Shown to the user when the push notification * arrives * @return $this Fluent Builder */ public function setDetailsMessage(string $detailsMessage): self { $this->options['detailsMessage'] = $detailsMessage; return $this; } /** * A list of objects that describe the Fields included in the Challenge. Each object contains the label and value of the field, the label can be up to 36 characters in length and the value can be up to 128 characters in length. Used when `factor_type` is `push`. There can be up to 20 details fields. * * @param array[] $detailsFields A list of objects that describe the Fields * included in the Challenge * @return $this Fluent Builder */ public function setDetailsFields(array $detailsFields): self { $this->options['detailsFields'] = $detailsFields; return $this; } /** * Details provided to give context about the Challenge. Not shown to the end user. It must be a stringified JSON with only strings values eg. `{"ip": "172.168.1.234"}`. Can be up to 1024 characters in length * * @param array $hiddenDetails Hidden details provided to contextualize the * Challenge * @return $this Fluent Builder */ public function setHiddenDetails(array $hiddenDetails): self { $this->options['hiddenDetails'] = $hiddenDetails; return $this; } /** * Optional payload used to verify the Challenge upon creation. Only used with a Factor of type `totp` to carry the TOTP code that needs to be verified. For `TOTP` this value must be between 3 and 8 characters long. * * @param string $authPayload Optional payload to verify the Challenge * @return $this Fluent Builder */ public function setAuthPayload(string $authPayload): self { $this->options['authPayload'] = $authPayload; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Verify.V2.CreateChallengeOptions ' . $options . ']'; } } class ReadChallengeOptions extends Options { /** * @param string $factorSid Factor Sid. * @param string $status The Status of theChallenges to fetch * @param string $order The sort order of the Challenges list */ public function __construct(string $factorSid = Values::NONE, string $status = Values::NONE, string $order = Values::NONE) { $this->options['factorSid'] = $factorSid; $this->options['status'] = $status; $this->options['order'] = $order; } /** * The unique SID identifier of the Factor. * * @param string $factorSid Factor Sid. * @return $this Fluent Builder */ public function setFactorSid(string $factorSid): self { $this->options['factorSid'] = $factorSid; return $this; } /** * The Status of the Challenges to fetch. One of `pending`, `expired`, `approved` or `denied`. * * @param string $status The Status of theChallenges to fetch * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * The desired sort order of the Challenges list. One of `asc` or `desc` for ascending and descending respectively. Defaults to `asc`. * * @param string $order The sort order of the Challenges list * @return $this Fluent Builder */ public function setOrder(string $order): self { $this->options['order'] = $order; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Verify.V2.ReadChallengeOptions ' . $options . ']'; } } class UpdateChallengeOptions extends Options { /** * @param string $authPayload Optional payload to verify the Challenge */ public function __construct(string $authPayload = Values::NONE) { $this->options['authPayload'] = $authPayload; } /** * The optional payload needed to verify the Challenge. E.g., a TOTP would use the numeric code. For `TOTP` this value must be between 3 and 8 characters long. For `Push` this value can be up to 5456 characters in length * * @param string $authPayload Optional payload to verify the Challenge * @return $this Fluent Builder */ public function setAuthPayload(string $authPayload): self { $this->options['authPayload'] = $authPayload; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Verify.V2.UpdateChallengeOptions ' . $options . ']'; } }src/Twilio/Rest/Verify/V2/Service/Entity/FactorPage.php000064400000002570150515725700016665 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return FactorInstance \Twilio\Rest\Verify\V2\Service\Entity\FactorInstance */ public function buildInstance(array $payload): FactorInstance { return new FactorInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['identity'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.FactorPage]'; } }src/Twilio/Rest/Verify/V2/Service/Entity/NewFactorInstance.php000064400000006206150515725700020227 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'entitySid' => Values::array_get($payload, 'entity_sid'), 'identity' => Values::array_get($payload, 'identity'), 'binding' => Values::array_get($payload, 'binding'), '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'), 'status' => Values::array_get($payload, 'status'), 'factorType' => Values::array_get($payload, 'factor_type'), 'config' => Values::array_get($payload, 'config'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['serviceSid' => $serviceSid, 'identity' => $identity, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Verify.V2.NewFactorInstance]'; } }src/Twilio/Rest/Verify/V2/Service/Entity/ChallengeInstance.php000064400000012707150515725700020224 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'entitySid' => Values::array_get($payload, 'entity_sid'), 'identity' => Values::array_get($payload, 'identity'), 'factorSid' => Values::array_get($payload, 'factor_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'dateResponded' => Deserialize::dateTime(Values::array_get($payload, 'date_responded')), 'expirationDate' => Deserialize::dateTime(Values::array_get($payload, 'expiration_date')), 'status' => Values::array_get($payload, 'status'), 'respondedReason' => Values::array_get($payload, 'responded_reason'), 'details' => Values::array_get($payload, 'details'), 'hiddenDetails' => Values::array_get($payload, 'hidden_details'), 'factorType' => Values::array_get($payload, 'factor_type'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'identity' => $identity, '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 ChallengeContext Context for this ChallengeInstance */ protected function proxy(): ChallengeContext { if (!$this->context) { $this->context = new ChallengeContext( $this->version, $this->solution['serviceSid'], $this->solution['identity'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the ChallengeInstance * * @return ChallengeInstance Fetched ChallengeInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ChallengeInstance { return $this->proxy()->fetch(); } /** * Update the ChallengeInstance * * @param array|Options $options Optional Arguments * @return ChallengeInstance Updated ChallengeInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ChallengeInstance { return $this->proxy()->update($options); } /** * Access the notifications */ protected function getNotifications(): NotificationList { return $this->proxy()->notifications; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Verify.V2.ChallengeInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Verify/V2/Service/Entity/ChallengeList.php000064400000015372150515725700017374 0ustar00solution = ['serviceSid' => $serviceSid, 'identity' => $identity, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Entities/' . \rawurlencode($identity) . '/Challenges'; } /** * Create the ChallengeInstance * * @param string $factorSid Factor Sid. * @param array|Options $options Optional Arguments * @return ChallengeInstance Created ChallengeInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $factorSid, array $options = []): ChallengeInstance { $options = new Values($options); $data = Values::of([ 'FactorSid' => $factorSid, 'ExpirationDate' => Serialize::iso8601DateTime($options['expirationDate']), 'Details.Message' => $options['detailsMessage'], 'Details.Fields' => Serialize::map($options['detailsFields'], function($e) { return Serialize::jsonObject($e); }), 'HiddenDetails' => Serialize::jsonObject($options['hiddenDetails']), 'AuthPayload' => $options['authPayload'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ChallengeInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['identity'] ); } /** * Streams ChallengeInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ChallengeInstance 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 ChallengeInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of ChallengeInstance 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 ChallengePage Page of ChallengeInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ChallengePage { $options = new Values($options); $params = Values::of([ 'FactorSid' => $options['factorSid'], 'Status' => $options['status'], 'Order' => $options['order'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ChallengePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ChallengeInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ChallengePage Page of ChallengeInstance */ public function getPage(string $targetUrl): ChallengePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ChallengePage($this->version, $response, $this->solution); } /** * Constructs a ChallengeContext * * @param string $sid A string that uniquely identifies this Challenge. */ public function getContext(string $sid): ChallengeContext { return new ChallengeContext( $this->version, $this->solution['serviceSid'], $this->solution['identity'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.ChallengeList]'; } }src/Twilio/Rest/Verify/V2/Service/Entity/Challenge/NotificationPage.php000064400000002735150515725700021762 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return NotificationInstance \Twilio\Rest\Verify\V2\Service\Entity\Challenge\NotificationInstance */ public function buildInstance(array $payload): NotificationInstance { return new NotificationInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['identity'], $this->solution['challengeSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.NotificationPage]'; } }src/Twilio/Rest/Verify/V2/Service/Entity/Challenge/NotificationInstance.php000064400000005616150515725700022653 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'entitySid' => Values::array_get($payload, 'entity_sid'), 'identity' => Values::array_get($payload, 'identity'), 'challengeSid' => Values::array_get($payload, 'challenge_sid'), 'priority' => Values::array_get($payload, 'priority'), 'ttl' => Values::array_get($payload, 'ttl'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'identity' => $identity, 'challengeSid' => $challengeSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Verify.V2.NotificationInstance]'; } }src/Twilio/Rest/Verify/V2/Service/Entity/Challenge/NotificationOptions.php000064400000003350150515725700022533 0ustar00options['ttl'] = $ttl; } /** * How long, in seconds, the notification is valid. Can be an integer between 0 and 300. Default is 300. Delivery is attempted until the TTL elapses, even if the device is offline. 0 means that the notification delivery is attempted immediately, only once, and is not stored for future delivery. * * @param int $ttl How long, in seconds, the notification is valid. * @return $this Fluent Builder */ public function setTtl(int $ttl): self { $this->options['ttl'] = $ttl; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Verify.V2.CreateNotificationOptions ' . $options . ']'; } }src/Twilio/Rest/Verify/V2/Service/Entity/Challenge/NotificationList.php000064400000004256150515725700022021 0ustar00solution = [ 'serviceSid' => $serviceSid, 'identity' => $identity, 'challengeSid' => $challengeSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Entities/' . \rawurlencode($identity) . '/Challenges/' . \rawurlencode($challengeSid) . '/Notifications'; } /** * Create the NotificationInstance * * @param array|Options $options Optional Arguments * @return NotificationInstance Created NotificationInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): NotificationInstance { $options = new Values($options); $data = Values::of(['Ttl' => $options['ttl'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new NotificationInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['identity'], $this->solution['challengeSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.NotificationList]'; } }src/Twilio/Rest/Verify/V2/Service/Entity/NewFactorOptions.php000064400000024623150515725700020121 0ustar00options['bindingAlg'] = $bindingAlg; $this->options['bindingPublicKey'] = $bindingPublicKey; $this->options['configAppId'] = $configAppId; $this->options['configNotificationPlatform'] = $configNotificationPlatform; $this->options['configNotificationToken'] = $configNotificationToken; $this->options['configSdkVersion'] = $configSdkVersion; $this->options['bindingSecret'] = $bindingSecret; $this->options['configTimeStep'] = $configTimeStep; $this->options['configSkew'] = $configSkew; $this->options['configCodeLength'] = $configCodeLength; $this->options['configAlg'] = $configAlg; } /** * The algorithm used when `factor_type` is `push`. Algorithm supported: `ES256` * * @param string $bindingAlg The algorithm used when `factor_type` is `push` * @return $this Fluent Builder */ public function setBindingAlg(string $bindingAlg): self { $this->options['bindingAlg'] = $bindingAlg; return $this; } /** * The Ecdsa public key in PKIX, ASN.1 DER format encoded in Base64. Required when `factor_type` is `push` * * @param string $bindingPublicKey The public key encoded in Base64 * @return $this Fluent Builder */ public function setBindingPublicKey(string $bindingPublicKey): self { $this->options['bindingPublicKey'] = $bindingPublicKey; return $this; } /** * The ID that uniquely identifies your app in the Google or Apple store, such as `com.example.myapp`. It can be up to 100 characters long. Required when `factor_type` is `push`. * * @param string $configAppId The ID that uniquely identifies your app in the * Google or Apple store * @return $this Fluent Builder */ public function setConfigAppId(string $configAppId): self { $this->options['configAppId'] = $configAppId; return $this; } /** * The transport technology used to generate the Notification Token. Can be `apn`, `fcm` or `none`. Required when `factor_type` is `push`. * * @param string $configNotificationPlatform The transport technology used to * generate the Notification Token * @return $this Fluent Builder */ public function setConfigNotificationPlatform(string $configNotificationPlatform): self { $this->options['configNotificationPlatform'] = $configNotificationPlatform; return $this; } /** * For APN, the device token. For FCM, the registration token. It is used to send the push notifications. Must be between 32 and 255 characters long. Required when `factor_type` is `push`. * * @param string $configNotificationToken For APN, the device token. For FCM, * the registration token * @return $this Fluent Builder */ public function setConfigNotificationToken(string $configNotificationToken): self { $this->options['configNotificationToken'] = $configNotificationToken; return $this; } /** * The Verify Push SDK version used to configure the factor Required when `factor_type` is `push` * * @param string $configSdkVersion The Verify Push SDK version used to * configure the factor * @return $this Fluent Builder */ public function setConfigSdkVersion(string $configSdkVersion): self { $this->options['configSdkVersion'] = $configSdkVersion; return $this; } /** * The shared secret for TOTP factors encoded in Base32. This can be provided when creating the Factor, otherwise it will be generated. Used when `factor_type` is `totp` * * @param string $bindingSecret The shared secret in Base32 * @return $this Fluent Builder */ public function setBindingSecret(string $bindingSecret): self { $this->options['bindingSecret'] = $bindingSecret; return $this; } /** * Defines how often, in seconds, are TOTP codes generated. i.e, a new TOTP code is generated every time_step seconds. Must be between 20 and 60 seconds, inclusive. The default value is defined at the service level in the property `totp.time_step`. Defaults to 30 seconds if not configured. Used when `factor_type` is `totp` * * @param int $configTimeStep How often, in seconds, are TOTP codes generated * @return $this Fluent Builder */ public function setConfigTimeStep(int $configTimeStep): self { $this->options['configTimeStep'] = $configTimeStep; return $this; } /** * The number of time-steps, past and future, that are valid for validation of TOTP codes. Must be between 0 and 2, inclusive. The default value is defined at the service level in the property `totp.skew`. If not configured defaults to 1. Used when `factor_type` is `totp` * * @param int $configSkew The number of past and future time-steps valid at a * given time * @return $this Fluent Builder */ public function setConfigSkew(int $configSkew): self { $this->options['configSkew'] = $configSkew; return $this; } /** * Number of digits for generated TOTP codes. Must be between 3 and 8, inclusive. The default value is defined at the service level in the property `totp.code_length`. If not configured defaults to 6. Used when `factor_type` is `totp` * * @param int $configCodeLength Number of digits for generated TOTP codes * @return $this Fluent Builder */ public function setConfigCodeLength(int $configCodeLength): self { $this->options['configCodeLength'] = $configCodeLength; return $this; } /** * The algorithm used to derive the TOTP codes. Can be `sha1`, `sha256` or `sha512`. Defaults to `sha1`. Used when `factor_type` is `totp` * * @param string $configAlg The algorithm used to derive the TOTP codes * @return $this Fluent Builder */ public function setConfigAlg(string $configAlg): self { $this->options['configAlg'] = $configAlg; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Verify.V2.CreateNewFactorOptions ' . $options . ']'; } }src/Twilio/Rest/Verify/V2/Service/Entity/FactorOptions.php000064400000020415150515725700017442 0ustar00options['authPayload'] = $authPayload; $this->options['friendlyName'] = $friendlyName; $this->options['configNotificationToken'] = $configNotificationToken; $this->options['configSdkVersion'] = $configSdkVersion; $this->options['configTimeStep'] = $configTimeStep; $this->options['configSkew'] = $configSkew; $this->options['configCodeLength'] = $configCodeLength; $this->options['configAlg'] = $configAlg; $this->options['configNotificationPlatform'] = $configNotificationPlatform; } /** * The optional payload needed to verify the Factor for the first time. E.g. for a TOTP, the numeric code. * * @param string $authPayload Optional payload to verify the Factor for the * first time * @return $this Fluent Builder */ public function setAuthPayload(string $authPayload): self { $this->options['authPayload'] = $authPayload; return $this; } /** * The new friendly name of this Factor. It can be up to 64 characters. * * @param string $friendlyName The friendly name of this Factor * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * For APN, the device token. For FCM, the registration token. It is used to send the push notifications. Required when `factor_type` is `push`. If specified, this value must be between 32 and 255 characters long. * * @param string $configNotificationToken For APN, the device token. For FCM, * the registration token * @return $this Fluent Builder */ public function setConfigNotificationToken(string $configNotificationToken): self { $this->options['configNotificationToken'] = $configNotificationToken; return $this; } /** * The Verify Push SDK version used to configure the factor * * @param string $configSdkVersion The Verify Push SDK version used to * configure the factor * @return $this Fluent Builder */ public function setConfigSdkVersion(string $configSdkVersion): self { $this->options['configSdkVersion'] = $configSdkVersion; return $this; } /** * Defines how often, in seconds, are TOTP codes generated. i.e, a new TOTP code is generated every time_step seconds. Must be between 20 and 60 seconds, inclusive * * @param int $configTimeStep How often, in seconds, are TOTP codes generated * @return $this Fluent Builder */ public function setConfigTimeStep(int $configTimeStep): self { $this->options['configTimeStep'] = $configTimeStep; return $this; } /** * The number of time-steps, past and future, that are valid for validation of TOTP codes. Must be between 0 and 2, inclusive * * @param int $configSkew The number of past and future time-steps valid at a * given time * @return $this Fluent Builder */ public function setConfigSkew(int $configSkew): self { $this->options['configSkew'] = $configSkew; return $this; } /** * Number of digits for generated TOTP codes. Must be between 3 and 8, inclusive * * @param int $configCodeLength Number of digits for generated TOTP codes * @return $this Fluent Builder */ public function setConfigCodeLength(int $configCodeLength): self { $this->options['configCodeLength'] = $configCodeLength; return $this; } /** * The algorithm used to derive the TOTP codes. Can be `sha1`, `sha256` or `sha512` * * @param string $configAlg The algorithm used to derive the TOTP codes * @return $this Fluent Builder */ public function setConfigAlg(string $configAlg): self { $this->options['configAlg'] = $configAlg; return $this; } /** * The transport technology used to generate the Notification Token. Can be `apn`, `fcm` or `none`. Required when `factor_type` is `push`. * * @param string $configNotificationPlatform The transport technology used to * generate the Notification Token * @return $this Fluent Builder */ public function setConfigNotificationPlatform(string $configNotificationPlatform): self { $this->options['configNotificationPlatform'] = $configNotificationPlatform; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Verify.V2.UpdateFactorOptions ' . $options . ']'; } }src/Twilio/Rest/Verify/V2/Service/Entity/ChallengePage.php000064400000002612150515725700017326 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ChallengeInstance \Twilio\Rest\Verify\V2\Service\Entity\ChallengeInstance */ public function buildInstance(array $payload): ChallengeInstance { return new ChallengeInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['identity'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.ChallengePage]'; } }src/Twilio/Rest/Verify/V2/Service/Entity/FactorList.php000064400000012006150515725700016717 0ustar00solution = ['serviceSid' => $serviceSid, 'identity' => $identity, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Entities/' . \rawurlencode($identity) . '/Factors'; } /** * Streams FactorInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads FactorInstance 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 FactorInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of FactorInstance 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 FactorPage Page of FactorInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): FactorPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new FactorPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of FactorInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return FactorPage Page of FactorInstance */ public function getPage(string $targetUrl): FactorPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new FactorPage($this->version, $response, $this->solution); } /** * Constructs a FactorContext * * @param string $sid A string that uniquely identifies this Factor. */ public function getContext(string $sid): FactorContext { return new FactorContext( $this->version, $this->solution['serviceSid'], $this->solution['identity'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.FactorList]'; } }src/Twilio/Rest/Verify/V2/Service/Entity/FactorContext.php000064400000006752150515725700017443 0ustar00solution = ['serviceSid' => $serviceSid, 'identity' => $identity, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Entities/' . \rawurlencode($identity) . '/Factors/' . \rawurlencode($sid) . ''; } /** * Delete the FactorInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Fetch the FactorInstance * * @return FactorInstance Fetched FactorInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FactorInstance { $payload = $this->version->fetch('GET', $this->uri); return new FactorInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['identity'], $this->solution['sid'] ); } /** * Update the FactorInstance * * @param array|Options $options Optional Arguments * @return FactorInstance Updated FactorInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): FactorInstance { $options = new Values($options); $data = Values::of([ 'AuthPayload' => $options['authPayload'], 'FriendlyName' => $options['friendlyName'], 'Config.NotificationToken' => $options['configNotificationToken'], 'Config.SdkVersion' => $options['configSdkVersion'], 'Config.TimeStep' => $options['configTimeStep'], 'Config.Skew' => $options['configSkew'], 'Config.CodeLength' => $options['configCodeLength'], 'Config.Alg' => $options['configAlg'], 'Config.NotificationPlatform' => $options['configNotificationPlatform'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new FactorInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['identity'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Verify.V2.FactorContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Verify/V2/Service/AccessTokenInstance.php000064400000003463150515725700017267 0ustar00properties = ['token' => Values::array_get($payload, 'token'), ]; $this->solution = ['serviceSid' => $serviceSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Verify.V2.AccessTokenInstance]'; } }src/Twilio/Rest/Verify/V2/Service/WebhookInstance.php000064400000011240150515725700016453 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'eventTypes' => Values::array_get($payload, 'event_types'), 'status' => Values::array_get($payload, 'status'), 'version' => Values::array_get($payload, 'version'), 'webhookUrl' => Values::array_get($payload, 'webhook_url'), 'webhookMethod' => Values::array_get($payload, 'webhook_method'), '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 = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return WebhookContext Context for this WebhookInstance */ protected function proxy(): WebhookContext { if (!$this->context) { $this->context = new WebhookContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Update the WebhookInstance * * @param array|Options $options Optional Arguments * @return WebhookInstance Updated WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): WebhookInstance { return $this->proxy()->update($options); } /** * Delete the WebhookInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Fetch the WebhookInstance * * @return WebhookInstance Fetched WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): WebhookInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Verify.V2.WebhookInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Verify/V2/Service/VerificationList.php000064400000005550150515725700016655 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Verifications'; } /** * Create the VerificationInstance * * @param string $to The phone number or email to verify * @param string $channel The verification method to use * @param array|Options $options Optional Arguments * @return VerificationInstance Created VerificationInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $to, string $channel, array $options = []): VerificationInstance { $options = new Values($options); $data = Values::of([ 'To' => $to, 'Channel' => $channel, 'CustomFriendlyName' => $options['customFriendlyName'], 'CustomMessage' => $options['customMessage'], 'SendDigits' => $options['sendDigits'], 'Locale' => $options['locale'], 'CustomCode' => $options['customCode'], 'Amount' => $options['amount'], 'Payee' => $options['payee'], 'RateLimits' => Serialize::jsonObject($options['rateLimits']), 'ChannelConfiguration' => Serialize::jsonObject($options['channelConfiguration']), 'AppHash' => $options['appHash'], 'TemplateSid' => $options['templateSid'], 'TemplateCustomSubstitutions' => $options['templateCustomSubstitutions'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new VerificationInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Constructs a VerificationContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): VerificationContext { return new VerificationContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.VerificationList]'; } }src/Twilio/Rest/Verify/V2/Service/EntityContext.php000064400000011503150515725700016213 0ustar00solution = ['serviceSid' => $serviceSid, 'identity' => $identity, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Entities/' . \rawurlencode($identity) . ''; } /** * Delete the EntityInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Fetch the EntityInstance * * @return EntityInstance Fetched EntityInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): EntityInstance { $payload = $this->version->fetch('GET', $this->uri); return new EntityInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['identity'] ); } /** * Access the factors */ protected function getFactors(): FactorList { if (!$this->_factors) { $this->_factors = new FactorList( $this->version, $this->solution['serviceSid'], $this->solution['identity'] ); } return $this->_factors; } /** * Access the newFactors */ protected function getNewFactors(): NewFactorList { if (!$this->_newFactors) { $this->_newFactors = new NewFactorList( $this->version, $this->solution['serviceSid'], $this->solution['identity'] ); } return $this->_newFactors; } /** * Access the challenges */ protected function getChallenges(): ChallengeList { if (!$this->_challenges) { $this->_challenges = new ChallengeList( $this->version, $this->solution['serviceSid'], $this->solution['identity'] ); } return $this->_challenges; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Verify.V2.EntityContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Verify/V2/Service/RateLimitInstance.php000064400000011067150515725700016756 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'description' => Values::array_get($payload, 'description'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return RateLimitContext Context for this RateLimitInstance */ protected function proxy(): RateLimitContext { if (!$this->context) { $this->context = new RateLimitContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Update the RateLimitInstance * * @param array|Options $options Optional Arguments * @return RateLimitInstance Updated RateLimitInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): RateLimitInstance { return $this->proxy()->update($options); } /** * Fetch the RateLimitInstance * * @return RateLimitInstance Fetched RateLimitInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RateLimitInstance { return $this->proxy()->fetch(); } /** * Delete the RateLimitInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the buckets */ protected function getBuckets(): BucketList { return $this->proxy()->buckets; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Verify.V2.RateLimitInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Verify/V2/Service/WebhookOptions.php000064400000013761150515725700016354 0ustar00options['status'] = $status; $this->options['version'] = $version; } /** * The webhook status. Default value is `enabled`. One of: `enabled` or `disabled` * * @param string $status The webhook status * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * The webhook version. Default value is `v2` which includes all the latest fields. Version `v1` is legacy and may be removed in the future. * * @param string $version The webhook version * @return $this Fluent Builder */ public function setVersion(string $version): self { $this->options['version'] = $version; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Verify.V2.CreateWebhookOptions ' . $options . ']'; } } class UpdateWebhookOptions extends Options { /** * @param string $friendlyName The string that you assigned to describe the * webhook * @param string[] $eventTypes The array of events that this Webhook is * subscribed to. * @param string $webhookUrl The URL associated with this Webhook. * @param string $status The webhook status * @param string $version The webhook version */ public function __construct(string $friendlyName = Values::NONE, array $eventTypes = Values::ARRAY_NONE, string $webhookUrl = Values::NONE, string $status = Values::NONE, string $version = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['eventTypes'] = $eventTypes; $this->options['webhookUrl'] = $webhookUrl; $this->options['status'] = $status; $this->options['version'] = $version; } /** * The string that you assigned to describe the webhook. **This value should not contain PII.** * * @param string $friendlyName The string that you assigned to describe the * webhook * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The array of events that this Webhook is subscribed to. Possible event types: `*, factor.deleted, factor.created, factor.verified, challenge.approved, challenge.denied` * * @param string[] $eventTypes The array of events that this Webhook is * subscribed to. * @return $this Fluent Builder */ public function setEventTypes(array $eventTypes): self { $this->options['eventTypes'] = $eventTypes; return $this; } /** * The URL associated with this Webhook. * * @param string $webhookUrl The URL associated with this Webhook. * @return $this Fluent Builder */ public function setWebhookUrl(string $webhookUrl): self { $this->options['webhookUrl'] = $webhookUrl; return $this; } /** * The webhook status. Default value is `enabled`. One of: `enabled` or `disabled` * * @param string $status The webhook status * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * The webhook version. Default value is `v2` which includes all the latest fields. Version `v1` is legacy and may be removed in the future. * * @param string $version The webhook version * @return $this Fluent Builder */ public function setVersion(string $version): self { $this->options['version'] = $version; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Verify.V2.UpdateWebhookOptions ' . $options . ']'; } }src/Twilio/Rest/Verify/V2/Service/RateLimitOptions.php000064400000005053150515725700016643 0ustar00options['description'] = $description; } /** * Description of this Rate Limit * * @param string $description Description of this Rate Limit * @return $this Fluent Builder */ public function setDescription(string $description): self { $this->options['description'] = $description; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Verify.V2.CreateRateLimitOptions ' . $options . ']'; } } class UpdateRateLimitOptions extends Options { /** * @param string $description Description of this Rate Limit */ public function __construct(string $description = Values::NONE) { $this->options['description'] = $description; } /** * Description of this Rate Limit * * @param string $description Description of this Rate Limit * @return $this Fluent Builder */ public function setDescription(string $description): self { $this->options['description'] = $description; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Verify.V2.UpdateRateLimitOptions ' . $options . ']'; } }src/Twilio/Rest/Verify/V2/Service/AccessTokenPage.php000064400000002461150515725700016374 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return AccessTokenInstance \Twilio\Rest\Verify\V2\Service\AccessTokenInstance */ public function buildInstance(array $payload): AccessTokenInstance { return new AccessTokenInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.AccessTokenPage]'; } }src/Twilio/Rest/Verify/V2/Service/RateLimit/BucketList.php000064400000013363150515725700017343 0ustar00solution = ['serviceSid' => $serviceSid, 'rateLimitSid' => $rateLimitSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/RateLimits/' . \rawurlencode($rateLimitSid) . '/Buckets'; } /** * Create the BucketInstance * * @param int $max Max number of requests. * @param int $interval Number of seconds that the rate limit will be enforced * over. * @return BucketInstance Created BucketInstance * @throws TwilioException When an HTTP error occurs. */ public function create(int $max, int $interval): BucketInstance { $data = Values::of(['Max' => $max, 'Interval' => $interval, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new BucketInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['rateLimitSid'] ); } /** * Streams BucketInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads BucketInstance 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 BucketInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of BucketInstance 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 BucketPage Page of BucketInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): BucketPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new BucketPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of BucketInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return BucketPage Page of BucketInstance */ public function getPage(string $targetUrl): BucketPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new BucketPage($this->version, $response, $this->solution); } /** * Constructs a BucketContext * * @param string $sid A string that uniquely identifies this Bucket. */ public function getContext(string $sid): BucketContext { return new BucketContext( $this->version, $this->solution['serviceSid'], $this->solution['rateLimitSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.BucketList]'; } }src/Twilio/Rest/Verify/V2/Service/RateLimit/BucketInstance.php000064400000010757150515725700020200 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'rateLimitSid' => Values::array_get($payload, 'rate_limit_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'max' => Values::array_get($payload, 'max'), 'interval' => Values::array_get($payload, 'interval'), '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 = [ 'serviceSid' => $serviceSid, 'rateLimitSid' => $rateLimitSid, '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 BucketContext Context for this BucketInstance */ protected function proxy(): BucketContext { if (!$this->context) { $this->context = new BucketContext( $this->version, $this->solution['serviceSid'], $this->solution['rateLimitSid'], $this->solution['sid'] ); } return $this->context; } /** * Update the BucketInstance * * @param array|Options $options Optional Arguments * @return BucketInstance Updated BucketInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): BucketInstance { return $this->proxy()->update($options); } /** * Fetch the BucketInstance * * @return BucketInstance Fetched BucketInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): BucketInstance { return $this->proxy()->fetch(); } /** * Delete the BucketInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Verify.V2.BucketInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Verify/V2/Service/RateLimit/BucketPage.php000064400000002421150515725700017275 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return BucketInstance \Twilio\Rest\Verify\V2\Service\RateLimit\BucketInstance */ public function buildInstance(array $payload): BucketInstance { return new BucketInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['rateLimitSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.BucketPage]'; } }src/Twilio/Rest/Verify/V2/Service/RateLimit/BucketOptions.php000064400000003762150515725700020065 0ustar00options['max'] = $max; $this->options['interval'] = $interval; } /** * Maximum number of requests permitted in during the interval. * * @param int $max Max number of requests. * @return $this Fluent Builder */ public function setMax(int $max): self { $this->options['max'] = $max; return $this; } /** * Number of seconds that the rate limit will be enforced over. * * @param int $interval Number of seconds that the rate limit will be enforced * over. * @return $this Fluent Builder */ public function setInterval(int $interval): self { $this->options['interval'] = $interval; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Verify.V2.UpdateBucketOptions ' . $options . ']'; } }src/Twilio/Rest/Verify/V2/Service/RateLimit/BucketContext.php000064400000005715150515725700020056 0ustar00solution = ['serviceSid' => $serviceSid, 'rateLimitSid' => $rateLimitSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/RateLimits/' . \rawurlencode($rateLimitSid) . '/Buckets/' . \rawurlencode($sid) . ''; } /** * Update the BucketInstance * * @param array|Options $options Optional Arguments * @return BucketInstance Updated BucketInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): BucketInstance { $options = new Values($options); $data = Values::of(['Max' => $options['max'], 'Interval' => $options['interval'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new BucketInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['rateLimitSid'], $this->solution['sid'] ); } /** * Fetch the BucketInstance * * @return BucketInstance Fetched BucketInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): BucketInstance { $payload = $this->version->fetch('GET', $this->uri); return new BucketInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['rateLimitSid'], $this->solution['sid'] ); } /** * Delete the BucketInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Verify.V2.BucketContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Verify/V2/Service/MessagingConfigurationContext.php000064400000005775150515725700021422 0ustar00solution = ['serviceSid' => $serviceSid, 'country' => $country, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/MessagingConfigurations/' . \rawurlencode($country) . ''; } /** * Update the MessagingConfigurationInstance * * @param string $messagingServiceSid The SID of the Messaging Service used for * this configuration. * @return MessagingConfigurationInstance Updated MessagingConfigurationInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $messagingServiceSid): MessagingConfigurationInstance { $data = Values::of(['MessagingServiceSid' => $messagingServiceSid, ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new MessagingConfigurationInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['country'] ); } /** * Fetch the MessagingConfigurationInstance * * @return MessagingConfigurationInstance Fetched MessagingConfigurationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MessagingConfigurationInstance { $payload = $this->version->fetch('GET', $this->uri); return new MessagingConfigurationInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['country'] ); } /** * Delete the MessagingConfigurationInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Verify.V2.MessagingConfigurationContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Verify/V2/Service/VerificationInstance.php000064400000011050150515725700017476 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'to' => Values::array_get($payload, 'to'), 'channel' => Values::array_get($payload, 'channel'), 'status' => Values::array_get($payload, 'status'), 'valid' => Values::array_get($payload, 'valid'), 'lookup' => Values::array_get($payload, 'lookup'), 'amount' => Values::array_get($payload, 'amount'), 'payee' => Values::array_get($payload, 'payee'), 'sendCodeAttempts' => Values::array_get($payload, 'send_code_attempts'), '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 = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return VerificationContext Context for this VerificationInstance */ protected function proxy(): VerificationContext { if (!$this->context) { $this->context = new VerificationContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Update the VerificationInstance * * @param string $status The new status of the resource * @return VerificationInstance Updated VerificationInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $status): VerificationInstance { return $this->proxy()->update($status); } /** * Fetch the VerificationInstance * * @return VerificationInstance Fetched VerificationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): VerificationInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Verify.V2.VerificationInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Verify/V2/Service/EntityInstance.php000064400000011121150515725700016327 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'identity' => Values::array_get($payload, 'identity'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'identity' => $identity ?: $this->properties['identity'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return EntityContext Context for this EntityInstance */ protected function proxy(): EntityContext { if (!$this->context) { $this->context = new EntityContext( $this->version, $this->solution['serviceSid'], $this->solution['identity'] ); } return $this->context; } /** * Delete the EntityInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Fetch the EntityInstance * * @return EntityInstance Fetched EntityInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): EntityInstance { return $this->proxy()->fetch(); } /** * Access the factors */ protected function getFactors(): FactorList { return $this->proxy()->factors; } /** * Access the newFactors */ protected function getNewFactors(): NewFactorList { return $this->proxy()->newFactors; } /** * Access the challenges */ protected function getChallenges(): ChallengeList { return $this->proxy()->challenges; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Verify.V2.EntityInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Verify/V2/Service/RateLimitList.php000064400000013135150515725700016123 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/RateLimits'; } /** * Create the RateLimitInstance * * @param string $uniqueName A unique, developer assigned name of this Rate * Limit. * @param array|Options $options Optional Arguments * @return RateLimitInstance Created RateLimitInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $uniqueName, array $options = []): RateLimitInstance { $options = new Values($options); $data = Values::of(['UniqueName' => $uniqueName, 'Description' => $options['description'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new RateLimitInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Streams RateLimitInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads RateLimitInstance 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 RateLimitInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of RateLimitInstance 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 RateLimitPage Page of RateLimitInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): RateLimitPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new RateLimitPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of RateLimitInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return RateLimitPage Page of RateLimitInstance */ public function getPage(string $targetUrl): RateLimitPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new RateLimitPage($this->version, $response, $this->solution); } /** * Constructs a RateLimitContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): RateLimitContext { return new RateLimitContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.RateLimitList]'; } }src/Twilio/Rest/Verify/V2/Service/VerificationCheckList.php000064400000003706150515725700017614 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/VerificationCheck'; } /** * Create the VerificationCheckInstance * * @param string $code The verification string * @param array|Options $options Optional Arguments * @return VerificationCheckInstance Created VerificationCheckInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $code, array $options = []): VerificationCheckInstance { $options = new Values($options); $data = Values::of([ 'Code' => $code, 'To' => $options['to'], 'VerificationSid' => $options['verificationSid'], 'Amount' => $options['amount'], 'Payee' => $options['payee'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new VerificationCheckInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.VerificationCheckList]'; } }src/Twilio/Rest/Verify/V2/Service/RateLimitContext.php000064400000010640150515725700016632 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/RateLimits/' . \rawurlencode($sid) . ''; } /** * Update the RateLimitInstance * * @param array|Options $options Optional Arguments * @return RateLimitInstance Updated RateLimitInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): RateLimitInstance { $options = new Values($options); $data = Values::of(['Description' => $options['description'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new RateLimitInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Fetch the RateLimitInstance * * @return RateLimitInstance Fetched RateLimitInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RateLimitInstance { $payload = $this->version->fetch('GET', $this->uri); return new RateLimitInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Delete the RateLimitInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the buckets */ protected function getBuckets(): BucketList { if (!$this->_buckets) { $this->_buckets = new BucketList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_buckets; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Verify.V2.RateLimitContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Verify/V2/Service/RateLimitPage.php000064400000002264150515725700016065 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return RateLimitInstance \Twilio\Rest\Verify\V2\Service\RateLimitInstance */ public function buildInstance(array $payload): RateLimitInstance { return new RateLimitInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.RateLimitPage]'; } }src/Twilio/Rest/Verify/V2/Service/VerificationOptions.php000064400000025503150515725700017375 0ustar00options['customFriendlyName'] = $customFriendlyName; $this->options['customMessage'] = $customMessage; $this->options['sendDigits'] = $sendDigits; $this->options['locale'] = $locale; $this->options['customCode'] = $customCode; $this->options['amount'] = $amount; $this->options['payee'] = $payee; $this->options['rateLimits'] = $rateLimits; $this->options['channelConfiguration'] = $channelConfiguration; $this->options['appHash'] = $appHash; $this->options['templateSid'] = $templateSid; $this->options['templateCustomSubstitutions'] = $templateCustomSubstitutions; } /** * A custom user defined friendly name that overwrites the existing one in the verification message * * @param string $customFriendlyName A custom user defined friendly name * @return $this Fluent Builder */ public function setCustomFriendlyName(string $customFriendlyName): self { $this->options['customFriendlyName'] = $customFriendlyName; return $this; } /** * The text of a custom message to use for the verification. * * @param string $customMessage The text of a custom message to use for the * verification * @return $this Fluent Builder */ public function setCustomMessage(string $customMessage): self { $this->options['customMessage'] = $customMessage; return $this; } /** * The digits to send after a phone call is answered, for example, to dial an extension. For more information, see the Programmable Voice documentation of [sendDigits](https://www.twilio.com/docs/voice/twiml/number#attributes-sendDigits). * * @param string $sendDigits The digits to send after a phone call is answered * @return $this Fluent Builder */ public function setSendDigits(string $sendDigits): self { $this->options['sendDigits'] = $sendDigits; return $this; } /** * The locale to use for the verification SMS, WhatsApp or call. Can be: `af`, `ar`, `ca`, `cs`, `da`, `de`, `el`, `en`, `en-GB`, `es`, `fi`, `fr`, `he`, `hi`, `hr`, `hu`, `id`, `it`, `ja`, `ko`, `ms`, `nb`, `nl`, `pl`, `pt`, `pr-BR`, `ro`, `ru`, `sv`, `th`, `tl`, `tr`, `vi`, `zh`, `zh-CN`, or `zh-HK.` * * @param string $locale The locale to use for the verification SMS, WhatsApp * or call * @return $this Fluent Builder */ public function setLocale(string $locale): self { $this->options['locale'] = $locale; return $this; } /** * A pre-generated code to use for verification. The code can be between 4 and 10 characters, inclusive. * * @param string $customCode A pre-generated code * @return $this Fluent Builder */ public function setCustomCode(string $customCode): self { $this->options['customCode'] = $customCode; return $this; } /** * The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. * * @param string $amount The amount of the associated PSD2 compliant * transaction. * @return $this Fluent Builder */ public function setAmount(string $amount): self { $this->options['amount'] = $amount; return $this; } /** * The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. * * @param string $payee The payee of the associated PSD2 compliant transaction * @return $this Fluent Builder */ public function setPayee(string $payee): self { $this->options['payee'] = $payee; return $this; } /** * The custom key-value pairs of Programmable Rate Limits. Keys correspond to `unique_name` fields defined when [creating your Rate Limit](https://www.twilio.com/docs/verify/api/service-rate-limits). Associated value pairs represent values in the request that you are rate limiting on. You may include multiple Rate Limit values in each request. * * @param array $rateLimits The custom key-value pairs of Programmable Rate * Limits. * @return $this Fluent Builder */ public function setRateLimits(array $rateLimits): self { $this->options['rateLimits'] = $rateLimits; return $this; } /** * [`email`](https://www.twilio.com/docs/verify/email) channel configuration in json format. Must include 'from' and 'from_name'. * * @param array $channelConfiguration Channel specific configuration in json * format. * @return $this Fluent Builder */ public function setChannelConfiguration(array $channelConfiguration): self { $this->options['channelConfiguration'] = $channelConfiguration; return $this; } /** * Your [App Hash](https://developers.google.com/identity/sms-retriever/verify#computing_your_apps_hash_string) to be appended at the end of your verification SMS body. Applies only to SMS. Example SMS body: `<#> Your AppName verification code is: 1234 He42w354ol9`. * * @param string $appHash Your App Hash to be appended at the end of an SMS. * @return $this Fluent Builder */ public function setAppHash(string $appHash): self { $this->options['appHash'] = $appHash; return $this; } /** * The message [template](https://www.twilio.com/docs/verify/api/templates). If provided, will override the default template for the Service. SMS channel only. * * @param string $templateSid The verification template SMS messages. * @return $this Fluent Builder */ public function setTemplateSid(string $templateSid): self { $this->options['templateSid'] = $templateSid; return $this; } /** * A stringified JSON object in which the keys are the template's special variables and the values are the variables substitutions. * * @param string $templateCustomSubstitutions The values of the special * variables declared on the message * template. * @return $this Fluent Builder */ public function setTemplateCustomSubstitutions(string $templateCustomSubstitutions): self { $this->options['templateCustomSubstitutions'] = $templateCustomSubstitutions; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Verify.V2.CreateVerificationOptions ' . $options . ']'; } }src/Twilio/Rest/Verify/V2/Service/WebhookPage.php000064400000002431150515725700015565 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return WebhookInstance \Twilio\Rest\Verify\V2\Service\WebhookInstance */ public function buildInstance(array $payload): WebhookInstance { return new WebhookInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.WebhookPage]'; } }src/Twilio/Rest/Verify/V2/Service/WebhookList.php000064400000014044150515725700015627 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Webhooks'; } /** * Create the WebhookInstance * * @param string $friendlyName The string that you assigned to describe the * webhook * @param string[] $eventTypes The array of events that this Webhook is * subscribed to. * @param string $webhookUrl The URL associated with this Webhook. * @param array|Options $options Optional Arguments * @return WebhookInstance Created WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, array $eventTypes, string $webhookUrl, array $options = []): WebhookInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $friendlyName, 'EventTypes' => Serialize::map($eventTypes, function($e) { return $e; }), 'WebhookUrl' => $webhookUrl, 'Status' => $options['status'], 'Version' => $options['version'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new WebhookInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Streams WebhookInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads WebhookInstance 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 WebhookInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of WebhookInstance 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 WebhookPage Page of WebhookInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): WebhookPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new WebhookPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of WebhookInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return WebhookPage Page of WebhookInstance */ public function getPage(string $targetUrl): WebhookPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new WebhookPage($this->version, $response, $this->solution); } /** * Constructs a WebhookContext * * @param string $sid The unique string that identifies the resource to fetch */ public function getContext(string $sid): WebhookContext { return new WebhookContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.WebhookList]'; } }src/Twilio/Rest/Verify/V2/Service/VerificationCheckPage.php000064400000002344150515725700017552 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return VerificationCheckInstance \Twilio\Rest\Verify\V2\Service\VerificationCheckInstance */ public function buildInstance(array $payload): VerificationCheckInstance { return new VerificationCheckInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.VerificationCheckPage]'; } }src/Twilio/Rest/Verify/V2/Service/VerificationPage.php000064400000002306150515725700016612 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return VerificationInstance \Twilio\Rest\Verify\V2\Service\VerificationInstance */ public function buildInstance(array $payload): VerificationInstance { return new VerificationInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.VerificationPage]'; } }src/Twilio/Rest/Verify/V2/Service/EntityPage.php000064400000002423150515725700015444 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return EntityInstance \Twilio\Rest\Verify\V2\Service\EntityInstance */ public function buildInstance(array $payload): EntityInstance { return new EntityInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.EntityPage]'; } }src/Twilio/Rest/Verify/V2/Service/WebhookContext.php000064400000006027150515725700016342 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Webhooks/' . \rawurlencode($sid) . ''; } /** * Update the WebhookInstance * * @param array|Options $options Optional Arguments * @return WebhookInstance Updated WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): WebhookInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'EventTypes' => Serialize::map($options['eventTypes'], function($e) { return $e; }), 'WebhookUrl' => $options['webhookUrl'], 'Status' => $options['status'], 'Version' => $options['version'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new WebhookInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Delete the WebhookInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Fetch the WebhookInstance * * @return WebhookInstance Fetched WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): WebhookInstance { $payload = $this->version->fetch('GET', $this->uri); return new WebhookInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Verify.V2.WebhookContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Verify/V2/Service/VerificationCheckInstance.php000064400000005431150515725700020442 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'to' => Values::array_get($payload, 'to'), 'channel' => Values::array_get($payload, 'channel'), 'status' => Values::array_get($payload, 'status'), 'valid' => Values::array_get($payload, 'valid'), 'amount' => Values::array_get($payload, 'amount'), 'payee' => Values::array_get($payload, 'payee'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), ]; $this->solution = ['serviceSid' => $serviceSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Verify.V2.VerificationCheckInstance]'; } }src/Twilio/Rest/Verify/V2/Service/AccessTokenList.php000064400000003767150515725700016445 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/AccessTokens'; } /** * Create the AccessTokenInstance * * @param string $identity Unique external identifier of the Entity * @param string $factorType The Type of this Factor * @param array|Options $options Optional Arguments * @return AccessTokenInstance Created AccessTokenInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $identity, string $factorType, array $options = []): AccessTokenInstance { $options = new Values($options); $data = Values::of([ 'Identity' => $identity, 'FactorType' => $factorType, 'FactorFriendlyName' => $options['factorFriendlyName'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new AccessTokenInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.AccessTokenList]'; } }src/Twilio/Rest/Verify/V2/FormPage.php000064400000002330150515725700013470 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return FormInstance \Twilio\Rest\Verify\V2\FormInstance */ public function buildInstance(array $payload): FormInstance { return new FormInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.FormPage]'; } }src/Twilio/Rest/Verify/V2/TemplateOptions.php000064400000002660150515725700015125 0ustar00options['friendlyName'] = $friendlyName; } /** * String filter used to query templates with a given friendly name * * @param string $friendlyName Filter templates using friendly name * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Verify.V2.ReadTemplateOptions ' . $options . ']'; } }src/Twilio/Rest/Verify/V2/ServiceContext.php000064400000020114150515725700014735 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($sid) . ''; } /** * Fetch the ServiceInstance * * @return ServiceInstance Fetched ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ServiceInstance { $payload = $this->version->fetch('GET', $this->uri); return new ServiceInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the ServiceInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the ServiceInstance * * @param array|Options $options Optional Arguments * @return ServiceInstance Updated ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ServiceInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'CodeLength' => $options['codeLength'], 'LookupEnabled' => Serialize::booleanToString($options['lookupEnabled']), 'SkipSmsToLandlines' => Serialize::booleanToString($options['skipSmsToLandlines']), 'DtmfInputRequired' => Serialize::booleanToString($options['dtmfInputRequired']), 'TtsName' => $options['ttsName'], 'Psd2Enabled' => Serialize::booleanToString($options['psd2Enabled']), 'DoNotShareWarningEnabled' => Serialize::booleanToString($options['doNotShareWarningEnabled']), 'CustomCodeEnabled' => Serialize::booleanToString($options['customCodeEnabled']), 'Push.IncludeDate' => Serialize::booleanToString($options['pushIncludeDate']), 'Push.ApnCredentialSid' => $options['pushApnCredentialSid'], 'Push.FcmCredentialSid' => $options['pushFcmCredentialSid'], 'Totp.Issuer' => $options['totpIssuer'], 'Totp.TimeStep' => $options['totpTimeStep'], 'Totp.CodeLength' => $options['totpCodeLength'], 'Totp.Skew' => $options['totpSkew'], 'DefaultTemplateSid' => $options['defaultTemplateSid'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ServiceInstance($this->version, $payload, $this->solution['sid']); } /** * Access the verifications */ protected function getVerifications(): VerificationList { if (!$this->_verifications) { $this->_verifications = new VerificationList($this->version, $this->solution['sid']); } return $this->_verifications; } /** * Access the verificationChecks */ protected function getVerificationChecks(): VerificationCheckList { if (!$this->_verificationChecks) { $this->_verificationChecks = new VerificationCheckList($this->version, $this->solution['sid']); } return $this->_verificationChecks; } /** * Access the rateLimits */ protected function getRateLimits(): RateLimitList { if (!$this->_rateLimits) { $this->_rateLimits = new RateLimitList($this->version, $this->solution['sid']); } return $this->_rateLimits; } /** * Access the messagingConfigurations */ protected function getMessagingConfigurations(): MessagingConfigurationList { if (!$this->_messagingConfigurations) { $this->_messagingConfigurations = new MessagingConfigurationList( $this->version, $this->solution['sid'] ); } return $this->_messagingConfigurations; } /** * Access the entities */ protected function getEntities(): EntityList { if (!$this->_entities) { $this->_entities = new EntityList($this->version, $this->solution['sid']); } return $this->_entities; } /** * Access the webhooks */ protected function getWebhooks(): WebhookList { if (!$this->_webhooks) { $this->_webhooks = new WebhookList($this->version, $this->solution['sid']); } return $this->_webhooks; } /** * Access the accessTokens */ protected function getAccessTokens(): AccessTokenList { if (!$this->_accessTokens) { $this->_accessTokens = new AccessTokenList($this->version, $this->solution['sid']); } return $this->_accessTokens; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Verify.V2.ServiceContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Verify/V2/VerificationAttemptContext.php000064400000003037150515725700017323 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Attempts/' . \rawurlencode($sid) . ''; } /** * Fetch the VerificationAttemptInstance * * @return VerificationAttemptInstance Fetched VerificationAttemptInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): VerificationAttemptInstance { $payload = $this->version->fetch('GET', $this->uri); return new VerificationAttemptInstance($this->version, $payload, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Verify.V2.VerificationAttemptContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Verify/V2/ServiceOptions.php000064400000075032150515725700014755 0ustar00options['codeLength'] = $codeLength; $this->options['lookupEnabled'] = $lookupEnabled; $this->options['skipSmsToLandlines'] = $skipSmsToLandlines; $this->options['dtmfInputRequired'] = $dtmfInputRequired; $this->options['ttsName'] = $ttsName; $this->options['psd2Enabled'] = $psd2Enabled; $this->options['doNotShareWarningEnabled'] = $doNotShareWarningEnabled; $this->options['customCodeEnabled'] = $customCodeEnabled; $this->options['pushIncludeDate'] = $pushIncludeDate; $this->options['pushApnCredentialSid'] = $pushApnCredentialSid; $this->options['pushFcmCredentialSid'] = $pushFcmCredentialSid; $this->options['totpIssuer'] = $totpIssuer; $this->options['totpTimeStep'] = $totpTimeStep; $this->options['totpCodeLength'] = $totpCodeLength; $this->options['totpSkew'] = $totpSkew; $this->options['defaultTemplateSid'] = $defaultTemplateSid; } /** * The length of the verification code to generate. Must be an integer value between 4 and 10, inclusive. * * @param int $codeLength The length of the verification code to generate * @return $this Fluent Builder */ public function setCodeLength(int $codeLength): self { $this->options['codeLength'] = $codeLength; return $this; } /** * Whether to perform a lookup with each verification started and return info about the phone number. * * @param bool $lookupEnabled Whether to perform a lookup with each verification * @return $this Fluent Builder */ public function setLookupEnabled(bool $lookupEnabled): self { $this->options['lookupEnabled'] = $lookupEnabled; return $this; } /** * Whether to skip sending SMS verifications to landlines. Requires `lookup_enabled`. * * @param bool $skipSmsToLandlines Whether to skip sending SMS verifications to * landlines * @return $this Fluent Builder */ public function setSkipSmsToLandlines(bool $skipSmsToLandlines): self { $this->options['skipSmsToLandlines'] = $skipSmsToLandlines; return $this; } /** * Whether to ask the user to press a number before delivering the verify code in a phone call. * * @param bool $dtmfInputRequired Whether to ask the user to press a number * before delivering the verify code in a phone * call * @return $this Fluent Builder */ public function setDtmfInputRequired(bool $dtmfInputRequired): self { $this->options['dtmfInputRequired'] = $dtmfInputRequired; return $this; } /** * The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. * * @param string $ttsName The name of an alternative text-to-speech service to * use in phone calls * @return $this Fluent Builder */ public function setTtsName(string $ttsName): self { $this->options['ttsName'] = $ttsName; return $this; } /** * Whether to pass PSD2 transaction parameters when starting a verification. * * @param bool $psd2Enabled Whether to pass PSD2 transaction parameters when * starting a verification * @return $this Fluent Builder */ public function setPsd2Enabled(bool $psd2Enabled): self { $this->options['psd2Enabled'] = $psd2Enabled; return $this; } /** * Whether to add a security warning at the end of an SMS verification body. Disabled by default and applies only to SMS. Example SMS body: `Your AppName verification code is: 1234. Don’t share this code with anyone; our employees will never ask for the code` * * @param bool $doNotShareWarningEnabled Whether to add a security warning at * the end of an SMS. * @return $this Fluent Builder */ public function setDoNotShareWarningEnabled(bool $doNotShareWarningEnabled): self { $this->options['doNotShareWarningEnabled'] = $doNotShareWarningEnabled; return $this; } /** * Whether to allow sending verifications with a custom code instead of a randomly generated one. Not available for all customers. * * @param bool $customCodeEnabled Whether to allow sending verifications with a * custom code. * @return $this Fluent Builder */ public function setCustomCodeEnabled(bool $customCodeEnabled): self { $this->options['customCodeEnabled'] = $customCodeEnabled; return $this; } /** * Optional configuration for the Push factors. If true, include the date in the Challenge's reponse. Otherwise, the date is omitted from the response. See [Challenge](https://www.twilio.com/docs/verify/api/challenge) resource’s details parameter for more info. Default: true * * @param bool $pushIncludeDate Optional. Include the date in the Challenge's * reponse. Default: true * @return $this Fluent Builder */ public function setPushIncludeDate(bool $pushIncludeDate): self { $this->options['pushIncludeDate'] = $pushIncludeDate; return $this; } /** * Optional configuration for the Push factors. Set the APN Credential for this service. This will allow to send push notifications to iOS devices. See [Credential Resource](https://www.twilio.com/docs/notify/api/credential-resource) * * @param string $pushApnCredentialSid Optional. Set APN Credential for this * service. * @return $this Fluent Builder */ public function setPushApnCredentialSid(string $pushApnCredentialSid): self { $this->options['pushApnCredentialSid'] = $pushApnCredentialSid; return $this; } /** * Optional configuration for the Push factors. Set the FCM Credential for this service. This will allow to send push notifications to Android devices. See [Credential Resource](https://www.twilio.com/docs/notify/api/credential-resource) * * @param string $pushFcmCredentialSid Optional. Set FCM Credential for this * service. * @return $this Fluent Builder */ public function setPushFcmCredentialSid(string $pushFcmCredentialSid): self { $this->options['pushFcmCredentialSid'] = $pushFcmCredentialSid; return $this; } /** * Optional configuration for the TOTP factors. Set TOTP Issuer for this service. This will allow to configure the issuer of the TOTP URI. Defaults to the service friendly name if not provided. * * @param string $totpIssuer Optional. Set TOTP Issuer for this service. * @return $this Fluent Builder */ public function setTotpIssuer(string $totpIssuer): self { $this->options['totpIssuer'] = $totpIssuer; return $this; } /** * Optional configuration for the TOTP factors. Defines how often, in seconds, are TOTP codes generated. i.e, a new TOTP code is generated every time_step seconds. Must be between 20 and 60 seconds, inclusive. Defaults to 30 seconds * * @param int $totpTimeStep Optional. How often, in seconds, are TOTP codes * generated * @return $this Fluent Builder */ public function setTotpTimeStep(int $totpTimeStep): self { $this->options['totpTimeStep'] = $totpTimeStep; return $this; } /** * Optional configuration for the TOTP factors. Number of digits for generated TOTP codes. Must be between 3 and 8, inclusive. Defaults to 6 * * @param int $totpCodeLength Optional. Number of digits for generated TOTP * codes * @return $this Fluent Builder */ public function setTotpCodeLength(int $totpCodeLength): self { $this->options['totpCodeLength'] = $totpCodeLength; return $this; } /** * Optional configuration for the TOTP factors. The number of time-steps, past and future, that are valid for validation of TOTP codes. Must be between 0 and 2, inclusive. Defaults to 1 * * @param int $totpSkew Optional. The number of past and future time-steps * valid at a given time * @return $this Fluent Builder */ public function setTotpSkew(int $totpSkew): self { $this->options['totpSkew'] = $totpSkew; return $this; } /** * The default message [template](https://www.twilio.com/docs/verify/api/templates). Will be used for all SMS verifications unless explicitly overriden. SMS channel only. * * @param string $defaultTemplateSid The verification template SMS messages. * @return $this Fluent Builder */ public function setDefaultTemplateSid(string $defaultTemplateSid): self { $this->options['defaultTemplateSid'] = $defaultTemplateSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Verify.V2.CreateServiceOptions ' . $options . ']'; } } class UpdateServiceOptions extends Options { /** * @param string $friendlyName A string to describe the verification service * @param int $codeLength The length of the verification code to generate * @param bool $lookupEnabled Whether to perform a lookup with each verification * @param bool $skipSmsToLandlines Whether to skip sending SMS verifications to * landlines * @param bool $dtmfInputRequired Whether to ask the user to press a number * before delivering the verify code in a phone * call * @param string $ttsName The name of an alternative text-to-speech service to * use in phone calls * @param bool $psd2Enabled Whether to pass PSD2 transaction parameters when * starting a verification * @param bool $doNotShareWarningEnabled Whether to add a privacy warning at * the end of an SMS. * @param bool $customCodeEnabled Whether to allow sending verifications with a * custom code. * @param bool $pushIncludeDate Optional. Include the date in the Challenge's * reponse. Default: true * @param string $pushApnCredentialSid Optional. Set APN Credential for this * service. * @param string $pushFcmCredentialSid Optional. Set FCM Credential for this * service. * @param string $totpIssuer Optional. Set TOTP Issuer for this service. * @param int $totpTimeStep Optional. How often, in seconds, are TOTP codes * generated * @param int $totpCodeLength Optional. Number of digits for generated TOTP * codes * @param int $totpSkew Optional. The number of past and future time-steps * valid at a given time * @param string $defaultTemplateSid The verification template SMS messages. */ public function __construct(string $friendlyName = Values::NONE, int $codeLength = Values::NONE, bool $lookupEnabled = Values::NONE, bool $skipSmsToLandlines = Values::NONE, bool $dtmfInputRequired = Values::NONE, string $ttsName = Values::NONE, bool $psd2Enabled = Values::NONE, bool $doNotShareWarningEnabled = Values::NONE, bool $customCodeEnabled = Values::NONE, bool $pushIncludeDate = Values::NONE, string $pushApnCredentialSid = Values::NONE, string $pushFcmCredentialSid = Values::NONE, string $totpIssuer = Values::NONE, int $totpTimeStep = Values::NONE, int $totpCodeLength = Values::NONE, int $totpSkew = Values::NONE, string $defaultTemplateSid = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['codeLength'] = $codeLength; $this->options['lookupEnabled'] = $lookupEnabled; $this->options['skipSmsToLandlines'] = $skipSmsToLandlines; $this->options['dtmfInputRequired'] = $dtmfInputRequired; $this->options['ttsName'] = $ttsName; $this->options['psd2Enabled'] = $psd2Enabled; $this->options['doNotShareWarningEnabled'] = $doNotShareWarningEnabled; $this->options['customCodeEnabled'] = $customCodeEnabled; $this->options['pushIncludeDate'] = $pushIncludeDate; $this->options['pushApnCredentialSid'] = $pushApnCredentialSid; $this->options['pushFcmCredentialSid'] = $pushFcmCredentialSid; $this->options['totpIssuer'] = $totpIssuer; $this->options['totpTimeStep'] = $totpTimeStep; $this->options['totpCodeLength'] = $totpCodeLength; $this->options['totpSkew'] = $totpSkew; $this->options['defaultTemplateSid'] = $defaultTemplateSid; } /** * A descriptive string that you create to describe the verification service. It can be up to 30 characters long. **This value should not contain PII.** * * @param string $friendlyName A string to describe the verification service * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The length of the verification code to generate. Must be an integer value between 4 and 10, inclusive. * * @param int $codeLength The length of the verification code to generate * @return $this Fluent Builder */ public function setCodeLength(int $codeLength): self { $this->options['codeLength'] = $codeLength; return $this; } /** * Whether to perform a lookup with each verification started and return info about the phone number. * * @param bool $lookupEnabled Whether to perform a lookup with each verification * @return $this Fluent Builder */ public function setLookupEnabled(bool $lookupEnabled): self { $this->options['lookupEnabled'] = $lookupEnabled; return $this; } /** * Whether to skip sending SMS verifications to landlines. Requires `lookup_enabled`. * * @param bool $skipSmsToLandlines Whether to skip sending SMS verifications to * landlines * @return $this Fluent Builder */ public function setSkipSmsToLandlines(bool $skipSmsToLandlines): self { $this->options['skipSmsToLandlines'] = $skipSmsToLandlines; return $this; } /** * Whether to ask the user to press a number before delivering the verify code in a phone call. * * @param bool $dtmfInputRequired Whether to ask the user to press a number * before delivering the verify code in a phone * call * @return $this Fluent Builder */ public function setDtmfInputRequired(bool $dtmfInputRequired): self { $this->options['dtmfInputRequired'] = $dtmfInputRequired; return $this; } /** * The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. * * @param string $ttsName The name of an alternative text-to-speech service to * use in phone calls * @return $this Fluent Builder */ public function setTtsName(string $ttsName): self { $this->options['ttsName'] = $ttsName; return $this; } /** * Whether to pass PSD2 transaction parameters when starting a verification. * * @param bool $psd2Enabled Whether to pass PSD2 transaction parameters when * starting a verification * @return $this Fluent Builder */ public function setPsd2Enabled(bool $psd2Enabled): self { $this->options['psd2Enabled'] = $psd2Enabled; return $this; } /** * Whether to add a privacy warning at the end of an SMS. **Disabled by default and applies only for SMS.** * * @param bool $doNotShareWarningEnabled Whether to add a privacy warning at * the end of an SMS. * @return $this Fluent Builder */ public function setDoNotShareWarningEnabled(bool $doNotShareWarningEnabled): self { $this->options['doNotShareWarningEnabled'] = $doNotShareWarningEnabled; return $this; } /** * Whether to allow sending verifications with a custom code instead of a randomly generated one. Not available for all customers. * * @param bool $customCodeEnabled Whether to allow sending verifications with a * custom code. * @return $this Fluent Builder */ public function setCustomCodeEnabled(bool $customCodeEnabled): self { $this->options['customCodeEnabled'] = $customCodeEnabled; return $this; } /** * Optional configuration for the Push factors. If true, include the date in the Challenge's reponse. Otherwise, the date is omitted from the response. See [Challenge](https://www.twilio.com/docs/verify/api/challenge) resource’s details parameter for more info. Default: true * * @param bool $pushIncludeDate Optional. Include the date in the Challenge's * reponse. Default: true * @return $this Fluent Builder */ public function setPushIncludeDate(bool $pushIncludeDate): self { $this->options['pushIncludeDate'] = $pushIncludeDate; return $this; } /** * Optional configuration for the Push factors. Set the APN Credential for this service. This will allow to send push notifications to iOS devices. See [Credential Resource](https://www.twilio.com/docs/notify/api/credential-resource) * * @param string $pushApnCredentialSid Optional. Set APN Credential for this * service. * @return $this Fluent Builder */ public function setPushApnCredentialSid(string $pushApnCredentialSid): self { $this->options['pushApnCredentialSid'] = $pushApnCredentialSid; return $this; } /** * Optional configuration for the Push factors. Set the FCM Credential for this service. This will allow to send push notifications to Android devices. See [Credential Resource](https://www.twilio.com/docs/notify/api/credential-resource) * * @param string $pushFcmCredentialSid Optional. Set FCM Credential for this * service. * @return $this Fluent Builder */ public function setPushFcmCredentialSid(string $pushFcmCredentialSid): self { $this->options['pushFcmCredentialSid'] = $pushFcmCredentialSid; return $this; } /** * Optional configuration for the TOTP factors. Set TOTP Issuer for this service. This will allow to configure the issuer of the TOTP URI. * * @param string $totpIssuer Optional. Set TOTP Issuer for this service. * @return $this Fluent Builder */ public function setTotpIssuer(string $totpIssuer): self { $this->options['totpIssuer'] = $totpIssuer; return $this; } /** * Optional configuration for the TOTP factors. Defines how often, in seconds, are TOTP codes generated. i.e, a new TOTP code is generated every time_step seconds. Must be between 20 and 60 seconds, inclusive. Defaults to 30 seconds * * @param int $totpTimeStep Optional. How often, in seconds, are TOTP codes * generated * @return $this Fluent Builder */ public function setTotpTimeStep(int $totpTimeStep): self { $this->options['totpTimeStep'] = $totpTimeStep; return $this; } /** * Optional configuration for the TOTP factors. Number of digits for generated TOTP codes. Must be between 3 and 8, inclusive. Defaults to 6 * * @param int $totpCodeLength Optional. Number of digits for generated TOTP * codes * @return $this Fluent Builder */ public function setTotpCodeLength(int $totpCodeLength): self { $this->options['totpCodeLength'] = $totpCodeLength; return $this; } /** * Optional configuration for the TOTP factors. The number of time-steps, past and future, that are valid for validation of TOTP codes. Must be between 0 and 2, inclusive. Defaults to 1 * * @param int $totpSkew Optional. The number of past and future time-steps * valid at a given time * @return $this Fluent Builder */ public function setTotpSkew(int $totpSkew): self { $this->options['totpSkew'] = $totpSkew; return $this; } /** * The default message [template](https://www.twilio.com/docs/verify/api/templates). Will be used for all SMS verifications unless explicitly overriden. SMS channel only. * * @param string $defaultTemplateSid The verification template SMS messages. * @return $this Fluent Builder */ public function setDefaultTemplateSid(string $defaultTemplateSid): self { $this->options['defaultTemplateSid'] = $defaultTemplateSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Verify.V2.UpdateServiceOptions ' . $options . ']'; } }src/Twilio/Rest/Verify/V2/FormList.php000064400000002061150515725700013530 0ustar00solution = []; } /** * Constructs a FormContext * * @param string $formType The Type of this Form */ public function getContext(string $formType): FormContext { return new FormContext($this->version, $formType); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.FormList]'; } }src/Twilio/Rest/Verify/V2/ServicePage.php000064400000002171150515725700014170 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ServiceInstance \Twilio\Rest\Verify\V2\ServiceInstance */ public function buildInstance(array $payload): ServiceInstance { return new ServiceInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.ServicePage]'; } }src/Twilio/Rest/Verify/V2/TemplateInstance.php000064400000003606150515725700015237 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'translations' => Values::array_get($payload, 'translations'), ]; $this->solution = []; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Verify.V2.TemplateInstance]'; } }src/Twilio/Rest/Verify/V2/VerificationAttemptInstance.php000064400000007142150515725700017444 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'conversionStatus' => Values::array_get($payload, 'conversion_status'), 'channel' => Values::array_get($payload, 'channel'), 'channelData' => Values::array_get($payload, 'channel_data'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['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 VerificationAttemptContext Context for this * VerificationAttemptInstance */ protected function proxy(): VerificationAttemptContext { if (!$this->context) { $this->context = new VerificationAttemptContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the VerificationAttemptInstance * * @return VerificationAttemptInstance Fetched VerificationAttemptInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): VerificationAttemptInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Verify.V2.VerificationAttemptInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Verify/V2/VerificationAttemptPage.php000064400000002301150515725700016544 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return VerificationAttemptInstance \Twilio\Rest\Verify\V2\VerificationAttemptInstance */ public function buildInstance(array $payload): VerificationAttemptInstance { return new VerificationAttemptInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.VerificationAttemptPage]'; } }src/Twilio/Rest/Verify/V2/FormInstance.php000064400000005655150515725700014375 0ustar00properties = [ 'formType' => Values::array_get($payload, 'form_type'), 'forms' => Values::array_get($payload, 'forms'), 'formMeta' => Values::array_get($payload, 'form_meta'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['formType' => $formType ?: $this->properties['formType'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return FormContext Context for this FormInstance */ protected function proxy(): FormContext { if (!$this->context) { $this->context = new FormContext($this->version, $this->solution['formType']); } return $this->context; } /** * Fetch the FormInstance * * @return FormInstance Fetched FormInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FormInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Verify.V2.FormInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Verify/V2/FormContext.php000064400000003057150515725700014247 0ustar00solution = ['formType' => $formType, ]; $this->uri = '/Forms/' . \rawurlencode($formType) . ''; } /** * Fetch the FormInstance * * @return FormInstance Fetched FormInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FormInstance { $payload = $this->version->fetch('GET', $this->uri); return new FormInstance($this->version, $payload, $this->solution['formType']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Verify.V2.FormContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Verify/V2/ServiceList.php000064400000014611150515725700014231 0ustar00solution = []; $this->uri = '/Services'; } /** * Create the ServiceInstance * * @param string $friendlyName A string to describe the verification service * @param array|Options $options Optional Arguments * @return ServiceInstance Created ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, array $options = []): ServiceInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $friendlyName, 'CodeLength' => $options['codeLength'], 'LookupEnabled' => Serialize::booleanToString($options['lookupEnabled']), 'SkipSmsToLandlines' => Serialize::booleanToString($options['skipSmsToLandlines']), 'DtmfInputRequired' => Serialize::booleanToString($options['dtmfInputRequired']), 'TtsName' => $options['ttsName'], 'Psd2Enabled' => Serialize::booleanToString($options['psd2Enabled']), 'DoNotShareWarningEnabled' => Serialize::booleanToString($options['doNotShareWarningEnabled']), 'CustomCodeEnabled' => Serialize::booleanToString($options['customCodeEnabled']), 'Push.IncludeDate' => Serialize::booleanToString($options['pushIncludeDate']), 'Push.ApnCredentialSid' => $options['pushApnCredentialSid'], 'Push.FcmCredentialSid' => $options['pushFcmCredentialSid'], 'Totp.Issuer' => $options['totpIssuer'], 'Totp.TimeStep' => $options['totpTimeStep'], 'Totp.CodeLength' => $options['totpCodeLength'], 'Totp.Skew' => $options['totpSkew'], 'DefaultTemplateSid' => $options['defaultTemplateSid'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ServiceInstance($this->version, $payload); } /** * Streams ServiceInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ServiceInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return ServiceInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of ServiceInstance records from the API. * Request is executed immediately * * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return ServicePage Page of ServiceInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ServicePage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ServicePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ServiceInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ServicePage Page of ServiceInstance */ public function getPage(string $targetUrl): ServicePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ServicePage($this->version, $response, $this->solution); } /** * Constructs a ServiceContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): ServiceContext { return new ServiceContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Verify.V2.ServiceList]'; } }src/Twilio/Rest/Verify/V2/VerificationAttemptOptions.php000064400000006417150515725700017337 0ustar00options['dateCreatedAfter'] = $dateCreatedAfter; $this->options['dateCreatedBefore'] = $dateCreatedBefore; $this->options['channelDataTo'] = $channelDataTo; } /** * Datetime filter used to query Verification Attempts created after this datetime. * * @param \DateTime $dateCreatedAfter Filter verification attempts after this * date * @return $this Fluent Builder */ public function setDateCreatedAfter(\DateTime $dateCreatedAfter): self { $this->options['dateCreatedAfter'] = $dateCreatedAfter; return $this; } /** * Datetime filter used to query Verification Attempts created before this datetime. * * @param \DateTime $dateCreatedBefore Filter verification attempts befor this * date * @return $this Fluent Builder */ public function setDateCreatedBefore(\DateTime $dateCreatedBefore): self { $this->options['dateCreatedBefore'] = $dateCreatedBefore; return $this; } /** * Destination of a verification. Depending on the type of channel, it could be a phone number in E.164 format or an email address. * * @param string $channelDataTo Destination of a verification * @return $this Fluent Builder */ public function setChannelDataTo(string $channelDataTo): self { $this->options['channelDataTo'] = $channelDataTo; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Verify.V2.ReadVerificationAttemptOptions ' . $options . ']'; } }src/Twilio/Rest/Events.php000064400000007636150515725700011517 0ustar00baseUrl = 'https://events.twilio.com'; } /** * @return V1 Version v1 of events */ protected function getV1(): V1 { 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 TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } protected function getEventTypes(): \Twilio\Rest\Events\V1\EventTypeList { return $this->v1->eventTypes; } /** * @param string $type A string that uniquely identifies this Event Type. */ protected function contextEventTypes(string $type): \Twilio\Rest\Events\V1\EventTypeContext { return $this->v1->eventTypes($type); } protected function getSchemas(): \Twilio\Rest\Events\V1\SchemaList { return $this->v1->schemas; } /** * @param string $id The unique identifier of the schema. */ protected function contextSchemas(string $id): \Twilio\Rest\Events\V1\SchemaContext { return $this->v1->schemas($id); } protected function getSinks(): \Twilio\Rest\Events\V1\SinkList { return $this->v1->sinks; } /** * @param string $sid A string that uniquely identifies this Sink. */ protected function contextSinks(string $sid): \Twilio\Rest\Events\V1\SinkContext { return $this->v1->sinks($sid); } protected function getSubscriptions(): \Twilio\Rest\Events\V1\SubscriptionList { return $this->v1->subscriptions; } /** * @param string $sid A string that uniquely identifies this Subscription. */ protected function contextSubscriptions(string $sid): \Twilio\Rest\Events\V1\SubscriptionContext { return $this->v1->subscriptions($sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Events]'; } }src/Twilio/Rest/Numbers/V2.php000064400000004331150515725700012142 0ustar00version = 'v2'; } protected function getRegulatoryCompliance(): RegulatoryComplianceList { if (!$this->_regulatoryCompliance) { $this->_regulatoryCompliance = new RegulatoryComplianceList($this); } return $this->_regulatoryCompliance; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Numbers.V2]'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliancePage.php000064400000002312150515725700017064 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return RegulatoryComplianceInstance \Twilio\Rest\Numbers\V2\RegulatoryComplianceInstance */ public function buildInstance(array $payload): RegulatoryComplianceInstance { return new RegulatoryComplianceInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Numbers.V2.RegulatoryCompliancePage]'; } }src/Twilio/Rest/Numbers/V2/RegulatoryComplianceInstance.php000064400000002706150515725700017763 0ustar00solution = []; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Numbers.V2.RegulatoryComplianceInstance]'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/RegulationList.php000064400000012163150515725700021241 0ustar00solution = []; $this->uri = '/RegulatoryCompliance/Regulations'; } /** * Streams RegulationInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads RegulationInstance 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 RegulationInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of RegulationInstance 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 RegulationPage Page of RegulationInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): RegulationPage { $options = new Values($options); $params = Values::of([ 'EndUserType' => $options['endUserType'], 'IsoCountry' => $options['isoCountry'], 'NumberType' => $options['numberType'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new RegulationPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of RegulationInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return RegulationPage Page of RegulationInstance */ public function getPage(string $targetUrl): RegulationPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new RegulationPage($this->version, $response, $this->solution); } /** * Constructs a RegulationContext * * @param string $sid The unique string that identifies the Regulation resource */ public function getContext(string $sid): RegulationContext { return new RegulationContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Numbers.V2.RegulationList]'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/SupportingDocumentOptions.php000064400000010011150515725700023507 0ustar00options['attributes'] = $attributes; } /** * The set of parameters that are the attributes of the Supporting Documents resource which are derived Supporting Document Types. * * @param array $attributes The set of parameters that compose the Supporting * Documents resource * @return $this Fluent Builder */ public function setAttributes(array $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Numbers.V2.CreateSupportingDocumentOptions ' . $options . ']'; } } class UpdateSupportingDocumentOptions extends Options { /** * @param string $friendlyName The string that you assigned to describe the * resource * @param array $attributes The set of parameters that compose the Supporting * Document resource */ public function __construct(string $friendlyName = Values::NONE, array $attributes = Values::ARRAY_NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['attributes'] = $attributes; } /** * The string that you assigned to describe the resource. * * @param string $friendlyName The string that you assigned to describe the * resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The set of parameters that are the attributes of the Supporting Document resource which are derived Supporting Document Types. * * @param array $attributes The set of parameters that compose the Supporting * Document resource * @return $this Fluent Builder */ public function setAttributes(array $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Numbers.V2.UpdateSupportingDocumentOptions ' . $options . ']'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/SupportingDocumentList.php000064400000013420150515725700022776 0ustar00solution = []; $this->uri = '/RegulatoryCompliance/SupportingDocuments'; } /** * Create the SupportingDocumentInstance * * @param string $friendlyName The string that you assigned to describe the * resource * @param string $type The type of the Supporting Document * @param array|Options $options Optional Arguments * @return SupportingDocumentInstance Created SupportingDocumentInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, string $type, array $options = []): SupportingDocumentInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $friendlyName, 'Type' => $type, 'Attributes' => Serialize::jsonObject($options['attributes']), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new SupportingDocumentInstance($this->version, $payload); } /** * Streams SupportingDocumentInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads SupportingDocumentInstance 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 SupportingDocumentInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of SupportingDocumentInstance 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 SupportingDocumentPage Page of SupportingDocumentInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SupportingDocumentPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new SupportingDocumentPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of SupportingDocumentInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return SupportingDocumentPage Page of SupportingDocumentInstance */ public function getPage(string $targetUrl): SupportingDocumentPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new SupportingDocumentPage($this->version, $response, $this->solution); } /** * Constructs a SupportingDocumentContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): SupportingDocumentContext { return new SupportingDocumentContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Numbers.V2.SupportingDocumentList]'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/EndUserTypeList.php000064400000011240150515725700021332 0ustar00solution = []; $this->uri = '/RegulatoryCompliance/EndUserTypes'; } /** * Streams EndUserTypeInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads EndUserTypeInstance 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 EndUserTypeInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of EndUserTypeInstance 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 EndUserTypePage Page of EndUserTypeInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): EndUserTypePage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new EndUserTypePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of EndUserTypeInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return EndUserTypePage Page of EndUserTypeInstance */ public function getPage(string $targetUrl): EndUserTypePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new EndUserTypePage($this->version, $response, $this->solution); } /** * Constructs a EndUserTypeContext * * @param string $sid The unique string that identifies the End-User Type * resource */ public function getContext(string $sid): EndUserTypeContext { return new EndUserTypeContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Numbers.V2.EndUserTypeList]'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/BundleInstance.php000064400000012635150515725700021176 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'regulationSid' => Values::array_get($payload, 'regulation_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'status' => Values::array_get($payload, 'status'), 'validUntil' => Deserialize::dateTime(Values::array_get($payload, 'valid_until')), 'email' => Values::array_get($payload, 'email'), 'statusCallback' => Values::array_get($payload, 'status_callback'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 BundleContext Context for this BundleInstance */ protected function proxy(): BundleContext { if (!$this->context) { $this->context = new BundleContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the BundleInstance * * @return BundleInstance Fetched BundleInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): BundleInstance { return $this->proxy()->fetch(); } /** * Update the BundleInstance * * @param array|Options $options Optional Arguments * @return BundleInstance Updated BundleInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): BundleInstance { return $this->proxy()->update($options); } /** * Delete the BundleInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the evaluations */ protected function getEvaluations(): EvaluationList { return $this->proxy()->evaluations; } /** * Access the itemAssignments */ protected function getItemAssignments(): ItemAssignmentList { return $this->proxy()->itemAssignments; } /** * Access the bundleCopies */ protected function getBundleCopies(): BundleCopyList { return $this->proxy()->bundleCopies; } /** * Access the replaceItems */ protected function getReplaceItems(): ReplaceItemsList { return $this->proxy()->replaceItems; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Numbers.V2.BundleInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/RegulationOptions.php000064400000005377150515725700021772 0ustar00options['endUserType'] = $endUserType; $this->options['isoCountry'] = $isoCountry; $this->options['numberType'] = $numberType; } /** * The type of End User the regulation requires - can be `individual` or `business`. * * @param string $endUserType The type of End User of the Regulation resource * @return $this Fluent Builder */ public function setEndUserType(string $endUserType): self { $this->options['endUserType'] = $endUserType; return $this; } /** * The ISO country code of the phone number's country. * * @param string $isoCountry The ISO country code of the phone number's country * @return $this Fluent Builder */ public function setIsoCountry(string $isoCountry): self { $this->options['isoCountry'] = $isoCountry; return $this; } /** * The type of phone number that the regulatory requiremnt is restricting. * * @param string $numberType The type of phone number being regulated * @return $this Fluent Builder */ public function setNumberType(string $numberType): self { $this->options['numberType'] = $numberType; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Numbers.V2.ReadRegulationOptions ' . $options . ']'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/SupportingDocumentTypeContext.php000064400000003272150515725700024355 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/RegulatoryCompliance/SupportingDocumentTypes/' . \rawurlencode($sid) . ''; } /** * Fetch the SupportingDocumentTypeInstance * * @return SupportingDocumentTypeInstance Fetched SupportingDocumentTypeInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SupportingDocumentTypeInstance { $payload = $this->version->fetch('GET', $this->uri); return new SupportingDocumentTypeInstance($this->version, $payload, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Numbers.V2.SupportingDocumentTypeContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/SupportingDocumentPage.php000064400000002350150515725700022737 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SupportingDocumentInstance \Twilio\Rest\Numbers\V2\RegulatoryCompliance\SupportingDocumentInstance */ public function buildInstance(array $payload): SupportingDocumentInstance { return new SupportingDocumentInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Numbers.V2.SupportingDocumentPage]'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/EndUserContext.php000064400000004747150515725700021217 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/RegulatoryCompliance/EndUsers/' . \rawurlencode($sid) . ''; } /** * Fetch the EndUserInstance * * @return EndUserInstance Fetched EndUserInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): EndUserInstance { $payload = $this->version->fetch('GET', $this->uri); return new EndUserInstance($this->version, $payload, $this->solution['sid']); } /** * Update the EndUserInstance * * @param array|Options $options Optional Arguments * @return EndUserInstance Updated EndUserInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): EndUserInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'Attributes' => Serialize::jsonObject($options['attributes']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new EndUserInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the EndUserInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Numbers.V2.EndUserContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/BundleOptions.php000064400000026555150515725700021073 0ustar00options['statusCallback'] = $statusCallback; $this->options['regulationSid'] = $regulationSid; $this->options['isoCountry'] = $isoCountry; $this->options['endUserType'] = $endUserType; $this->options['numberType'] = $numberType; } /** * The URL we call to inform your application of status changes. * * @param string $statusCallback The URL we call to inform your application of * status changes. * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * The unique string of a regulation that is associated to the Bundle resource. * * @param string $regulationSid The unique string of a regulation. * @return $this Fluent Builder */ public function setRegulationSid(string $regulationSid): self { $this->options['regulationSid'] = $regulationSid; return $this; } /** * The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Bundle's phone number country ownership request. * * @param string $isoCountry The ISO country code of the country * @return $this Fluent Builder */ public function setIsoCountry(string $isoCountry): self { $this->options['isoCountry'] = $isoCountry; return $this; } /** * The [type of End User](https://www.twilio.com/docs/phone-numbers/regulatory/api/end-user-types) of the Bundle resource. * * @param string $endUserType The type of End User of the Bundle resource * @return $this Fluent Builder */ public function setEndUserType(string $endUserType): self { $this->options['endUserType'] = $endUserType; return $this; } /** * The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `toll free`. * * @param string $numberType The type of phone number * @return $this Fluent Builder */ public function setNumberType(string $numberType): self { $this->options['numberType'] = $numberType; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Numbers.V2.CreateBundleOptions ' . $options . ']'; } } class ReadBundleOptions extends Options { /** * @param string $status The verification status of the Bundle resource * @param string $friendlyName The string that you assigned to describe the * resource * @param string $regulationSid The unique string of a regulation. * @param string $isoCountry The ISO country code of the country * @param string $numberType The type of phone number */ public function __construct(string $status = Values::NONE, string $friendlyName = Values::NONE, string $regulationSid = Values::NONE, string $isoCountry = Values::NONE, string $numberType = Values::NONE) { $this->options['status'] = $status; $this->options['friendlyName'] = $friendlyName; $this->options['regulationSid'] = $regulationSid; $this->options['isoCountry'] = $isoCountry; $this->options['numberType'] = $numberType; } /** * The verification status of the Bundle resource. * * @param string $status The verification status of the Bundle resource * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * The string that you assigned to describe the resource. * * @param string $friendlyName The string that you assigned to describe the * resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The unique string of a regulation that is associated to the Bundle resource. * * @param string $regulationSid The unique string of a regulation. * @return $this Fluent Builder */ public function setRegulationSid(string $regulationSid): self { $this->options['regulationSid'] = $regulationSid; return $this; } /** * The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Bundle's phone number country ownership request. * * @param string $isoCountry The ISO country code of the country * @return $this Fluent Builder */ public function setIsoCountry(string $isoCountry): self { $this->options['isoCountry'] = $isoCountry; return $this; } /** * The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `toll free`. * * @param string $numberType The type of phone number * @return $this Fluent Builder */ public function setNumberType(string $numberType): self { $this->options['numberType'] = $numberType; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Numbers.V2.ReadBundleOptions ' . $options . ']'; } } class UpdateBundleOptions extends Options { /** * @param string $status The verification status of the Bundle resource * @param string $statusCallback The URL we call to inform your application of * status changes. * @param string $friendlyName The string that you assigned to describe the * resource * @param string $email The email address */ public function __construct(string $status = Values::NONE, string $statusCallback = Values::NONE, string $friendlyName = Values::NONE, string $email = Values::NONE) { $this->options['status'] = $status; $this->options['statusCallback'] = $statusCallback; $this->options['friendlyName'] = $friendlyName; $this->options['email'] = $email; } /** * The verification status of the Bundle resource. * * @param string $status The verification status of the Bundle resource * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * The URL we call to inform your application of status changes. * * @param string $statusCallback The URL we call to inform your application of * status changes. * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * The string that you assigned to describe the resource. * * @param string $friendlyName The string that you assigned to describe the * resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The email address that will receive updates when the Bundle resource changes status. * * @param string $email The email address * @return $this Fluent Builder */ public function setEmail(string $email): self { $this->options['email'] = $email; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Numbers.V2.UpdateBundleOptions ' . $options . ']'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/SupportingDocumentTypePage.php000064400000002400150515725700023575 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return SupportingDocumentTypeInstance \Twilio\Rest\Numbers\V2\RegulatoryCompliance\SupportingDocumentTypeInstance */ public function buildInstance(array $payload): SupportingDocumentTypeInstance { return new SupportingDocumentTypeInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Numbers.V2.SupportingDocumentTypePage]'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/EndUserTypePage.php000064400000002276150515725700021304 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return EndUserTypeInstance \Twilio\Rest\Numbers\V2\RegulatoryCompliance\EndUserTypeInstance */ public function buildInstance(array $payload): EndUserTypeInstance { return new EndUserTypeInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Numbers.V2.EndUserTypePage]'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/BundlePage.php000064400000002240150515725700020275 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return BundleInstance \Twilio\Rest\Numbers\V2\RegulatoryCompliance\BundleInstance */ public function buildInstance(array $payload): BundleInstance { return new BundleInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Numbers.V2.BundlePage]'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/RegulationPage.php000064400000002270150515725700021200 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return RegulationInstance \Twilio\Rest\Numbers\V2\RegulatoryCompliance\RegulationInstance */ public function buildInstance(array $payload): RegulationInstance { return new RegulationInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Numbers.V2.RegulationPage]'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/BundleContext.php000064400000013143150515725700021051 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/RegulatoryCompliance/Bundles/' . \rawurlencode($sid) . ''; } /** * Fetch the BundleInstance * * @return BundleInstance Fetched BundleInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): BundleInstance { $payload = $this->version->fetch('GET', $this->uri); return new BundleInstance($this->version, $payload, $this->solution['sid']); } /** * Update the BundleInstance * * @param array|Options $options Optional Arguments * @return BundleInstance Updated BundleInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): BundleInstance { $options = new Values($options); $data = Values::of([ 'Status' => $options['status'], 'StatusCallback' => $options['statusCallback'], 'FriendlyName' => $options['friendlyName'], 'Email' => $options['email'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new BundleInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the BundleInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the evaluations */ protected function getEvaluations(): EvaluationList { if (!$this->_evaluations) { $this->_evaluations = new EvaluationList($this->version, $this->solution['sid']); } return $this->_evaluations; } /** * Access the itemAssignments */ protected function getItemAssignments(): ItemAssignmentList { if (!$this->_itemAssignments) { $this->_itemAssignments = new ItemAssignmentList($this->version, $this->solution['sid']); } return $this->_itemAssignments; } /** * Access the bundleCopies */ protected function getBundleCopies(): BundleCopyList { if (!$this->_bundleCopies) { $this->_bundleCopies = new BundleCopyList($this->version, $this->solution['sid']); } return $this->_bundleCopies; } /** * Access the replaceItems */ protected function getReplaceItems(): ReplaceItemsList { if (!$this->_replaceItems) { $this->_replaceItems = new ReplaceItemsList($this->version, $this->solution['sid']); } return $this->_replaceItems; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Numbers.V2.BundleContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/RegulationContext.php000064400000003046150515725700021752 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/RegulatoryCompliance/Regulations/' . \rawurlencode($sid) . ''; } /** * Fetch the RegulationInstance * * @return RegulationInstance Fetched RegulationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RegulationInstance { $payload = $this->version->fetch('GET', $this->uri); return new RegulationInstance($this->version, $payload, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Numbers.V2.RegulationContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/EndUserTypeContext.php000064400000003114150515725700022044 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/RegulatoryCompliance/EndUserTypes/' . \rawurlencode($sid) . ''; } /** * Fetch the EndUserTypeInstance * * @return EndUserTypeInstance Fetched EndUserTypeInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): EndUserTypeInstance { $payload = $this->version->fetch('GET', $this->uri); return new EndUserTypeInstance($this->version, $payload, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Numbers.V2.EndUserTypeContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/RegulationInstance.php000064400000006356150515725700022101 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'isoCountry' => Values::array_get($payload, 'iso_country'), 'numberType' => Values::array_get($payload, 'number_type'), 'endUserType' => Values::array_get($payload, 'end_user_type'), 'requirements' => Values::array_get($payload, 'requirements'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['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 RegulationContext Context for this RegulationInstance */ protected function proxy(): RegulationContext { if (!$this->context) { $this->context = new RegulationContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the RegulationInstance * * @return RegulationInstance Fetched RegulationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RegulationInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Numbers.V2.RegulationInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/EndUserOptions.php000064400000007436150515725700021224 0ustar00options['attributes'] = $attributes; } /** * The set of parameters that are the attributes of the End User resource which are derived End User Types. * * @param array $attributes The set of parameters that compose the End User * resource * @return $this Fluent Builder */ public function setAttributes(array $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Numbers.V2.CreateEndUserOptions ' . $options . ']'; } } class UpdateEndUserOptions extends Options { /** * @param string $friendlyName The string that you assigned to describe the * resource * @param array $attributes The set of parameters that compose the End User * resource */ public function __construct(string $friendlyName = Values::NONE, array $attributes = Values::ARRAY_NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['attributes'] = $attributes; } /** * The string that you assigned to describe the resource. * * @param string $friendlyName The string that you assigned to describe the * resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The set of parameters that are the attributes of the End User resource which are derived End User Types. * * @param array $attributes The set of parameters that compose the End User * resource * @return $this Fluent Builder */ public function setAttributes(array $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Numbers.V2.UpdateEndUserOptions ' . $options . ']'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/EndUserInstance.php000064400000007725150515725700021336 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'type' => Values::array_get($payload, 'type'), 'attributes' => Values::array_get($payload, 'attributes'), '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 = ['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 EndUserContext Context for this EndUserInstance */ protected function proxy(): EndUserContext { if (!$this->context) { $this->context = new EndUserContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the EndUserInstance * * @return EndUserInstance Fetched EndUserInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): EndUserInstance { return $this->proxy()->fetch(); } /** * Update the EndUserInstance * * @param array|Options $options Optional Arguments * @return EndUserInstance Updated EndUserInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): EndUserInstance { return $this->proxy()->update($options); } /** * Delete the EndUserInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Numbers.V2.EndUserInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/EndUserList.php000064400000012776150515725700020507 0ustar00solution = []; $this->uri = '/RegulatoryCompliance/EndUsers'; } /** * Create the EndUserInstance * * @param string $friendlyName The string that you assigned to describe the * resource * @param string $type The type of end user of the Bundle resource * @param array|Options $options Optional Arguments * @return EndUserInstance Created EndUserInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, string $type, array $options = []): EndUserInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $friendlyName, 'Type' => $type, 'Attributes' => Serialize::jsonObject($options['attributes']), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new EndUserInstance($this->version, $payload); } /** * Streams EndUserInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads EndUserInstance 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 EndUserInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of EndUserInstance 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 EndUserPage Page of EndUserInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): EndUserPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new EndUserPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of EndUserInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return EndUserPage Page of EndUserInstance */ public function getPage(string $targetUrl): EndUserPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new EndUserPage($this->version, $response, $this->solution); } /** * Constructs a EndUserContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): EndUserContext { return new EndUserContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Numbers.V2.EndUserList]'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/Bundle/ReplaceItemsInstance.php000064400000005552150515725700023553 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'regulationSid' => Values::array_get($payload, 'regulation_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'status' => Values::array_get($payload, 'status'), 'validUntil' => Deserialize::dateTime(Values::array_get($payload, 'valid_until')), 'email' => Values::array_get($payload, 'email'), 'statusCallback' => Values::array_get($payload, 'status_callback'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), ]; $this->solution = ['bundleSid' => $bundleSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Numbers.V2.ReplaceItemsInstance]'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/Bundle/EvaluationInstance.php000064400000007115150515725700023302 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'regulationSid' => Values::array_get($payload, 'regulation_sid'), 'bundleSid' => Values::array_get($payload, 'bundle_sid'), 'status' => Values::array_get($payload, 'status'), 'results' => Values::array_get($payload, 'results'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['bundleSid' => $bundleSid, '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 EvaluationContext Context for this EvaluationInstance */ protected function proxy(): EvaluationContext { if (!$this->context) { $this->context = new EvaluationContext( $this->version, $this->solution['bundleSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the EvaluationInstance * * @return EvaluationInstance Fetched EvaluationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): EvaluationInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Numbers.V2.EvaluationInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/Bundle/BundleCopyInstance.php000064400000005544150515725700023243 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'regulationSid' => Values::array_get($payload, 'regulation_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'status' => Values::array_get($payload, 'status'), 'validUntil' => Deserialize::dateTime(Values::array_get($payload, 'valid_until')), 'email' => Values::array_get($payload, 'email'), 'statusCallback' => Values::array_get($payload, 'status_callback'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), ]; $this->solution = ['bundleSid' => $bundleSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Numbers.V2.BundleCopyInstance]'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/Bundle/ItemAssignmentList.php000064400000013000150515725700023257 0ustar00solution = ['bundleSid' => $bundleSid, ]; $this->uri = '/RegulatoryCompliance/Bundles/' . \rawurlencode($bundleSid) . '/ItemAssignments'; } /** * Create the ItemAssignmentInstance * * @param string $objectSid The sid of an object bag * @return ItemAssignmentInstance Created ItemAssignmentInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $objectSid): ItemAssignmentInstance { $data = Values::of(['ObjectSid' => $objectSid, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ItemAssignmentInstance($this->version, $payload, $this->solution['bundleSid']); } /** * Streams ItemAssignmentInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ItemAssignmentInstance 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 ItemAssignmentInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of ItemAssignmentInstance 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 ItemAssignmentPage Page of ItemAssignmentInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ItemAssignmentPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ItemAssignmentPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ItemAssignmentInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ItemAssignmentPage Page of ItemAssignmentInstance */ public function getPage(string $targetUrl): ItemAssignmentPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ItemAssignmentPage($this->version, $response, $this->solution); } /** * Constructs a ItemAssignmentContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): ItemAssignmentContext { return new ItemAssignmentContext($this->version, $this->solution['bundleSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Numbers.V2.ItemAssignmentList]'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/Bundle/ItemAssignmentPage.php000064400000002374150515725700023234 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ItemAssignmentInstance \Twilio\Rest\Numbers\V2\RegulatoryCompliance\Bundle\ItemAssignmentInstance */ public function buildInstance(array $payload): ItemAssignmentInstance { return new ItemAssignmentInstance($this->version, $payload, $this->solution['bundleSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Numbers.V2.ItemAssignmentPage]'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/Bundle/ItemAssignmentContext.php000064400000004137150515725700024003 0ustar00solution = ['bundleSid' => $bundleSid, 'sid' => $sid, ]; $this->uri = '/RegulatoryCompliance/Bundles/' . \rawurlencode($bundleSid) . '/ItemAssignments/' . \rawurlencode($sid) . ''; } /** * Fetch the ItemAssignmentInstance * * @return ItemAssignmentInstance Fetched ItemAssignmentInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ItemAssignmentInstance { $payload = $this->version->fetch('GET', $this->uri); return new ItemAssignmentInstance( $this->version, $payload, $this->solution['bundleSid'], $this->solution['sid'] ); } /** * Delete the ItemAssignmentInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Numbers.V2.ItemAssignmentContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/Bundle/EvaluationPage.php000064400000002344150515725700022411 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return EvaluationInstance \Twilio\Rest\Numbers\V2\RegulatoryCompliance\Bundle\EvaluationInstance */ public function buildInstance(array $payload): EvaluationInstance { return new EvaluationInstance($this->version, $payload, $this->solution['bundleSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Numbers.V2.EvaluationPage]'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/Bundle/ReplaceItemsList.php000064400000003421150515725700022713 0ustar00solution = ['bundleSid' => $bundleSid, ]; $this->uri = '/RegulatoryCompliance/Bundles/' . \rawurlencode($bundleSid) . '/ReplaceItems'; } /** * Create the ReplaceItemsInstance * * @param string $fromBundleSid The source bundle sid to copy the item * assignments from * @return ReplaceItemsInstance Created ReplaceItemsInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $fromBundleSid): ReplaceItemsInstance { $data = Values::of(['FromBundleSid' => $fromBundleSid, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ReplaceItemsInstance($this->version, $payload, $this->solution['bundleSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Numbers.V2.ReplaceItemsList]'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/Bundle/ItemAssignmentInstance.php000064400000007334150515725700024125 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'bundleSid' => Values::array_get($payload, 'bundle_sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'objectSid' => Values::array_get($payload, 'object_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['bundleSid' => $bundleSid, '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 ItemAssignmentContext Context for this ItemAssignmentInstance */ protected function proxy(): ItemAssignmentContext { if (!$this->context) { $this->context = new ItemAssignmentContext( $this->version, $this->solution['bundleSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the ItemAssignmentInstance * * @return ItemAssignmentInstance Fetched ItemAssignmentInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ItemAssignmentInstance { return $this->proxy()->fetch(); } /** * Delete the ItemAssignmentInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Numbers.V2.ItemAssignmentInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/Bundle/EvaluationList.php000064400000012356150515725700022454 0ustar00solution = ['bundleSid' => $bundleSid, ]; $this->uri = '/RegulatoryCompliance/Bundles/' . \rawurlencode($bundleSid) . '/Evaluations'; } /** * Create the EvaluationInstance * * @return EvaluationInstance Created EvaluationInstance * @throws TwilioException When an HTTP error occurs. */ public function create(): EvaluationInstance { $payload = $this->version->create('POST', $this->uri); return new EvaluationInstance($this->version, $payload, $this->solution['bundleSid']); } /** * Streams EvaluationInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads EvaluationInstance 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 EvaluationInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of EvaluationInstance 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 EvaluationPage Page of EvaluationInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): EvaluationPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new EvaluationPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of EvaluationInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return EvaluationPage Page of EvaluationInstance */ public function getPage(string $targetUrl): EvaluationPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new EvaluationPage($this->version, $response, $this->solution); } /** * Constructs a EvaluationContext * * @param string $sid The unique string that identifies the Evaluation resource */ public function getContext(string $sid): EvaluationContext { return new EvaluationContext($this->version, $this->solution['bundleSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Numbers.V2.EvaluationList]'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/Bundle/BundleCopyPage.php000064400000002525150515725700022347 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return BundleCopyInstance \Twilio\Rest\Numbers\V2\RegulatoryCompliance\Bundle\BundleCopyInstance */ public function buildInstance(array $payload): BundleCopyInstance { return new BundleCopyInstance($this->version, $payload, $this->solution['bundleSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Numbers.V2.BundleCopyPage]'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/Bundle/ReplaceItemsPage.php000064400000002541150515725700022656 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ReplaceItemsInstance \Twilio\Rest\Numbers\V2\RegulatoryCompliance\Bundle\ReplaceItemsInstance */ public function buildInstance(array $payload): ReplaceItemsInstance { return new ReplaceItemsInstance($this->version, $payload, $this->solution['bundleSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Numbers.V2.ReplaceItemsPage]'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/Bundle/EvaluationContext.php000064400000003445150515725700023164 0ustar00solution = ['bundleSid' => $bundleSid, 'sid' => $sid, ]; $this->uri = '/RegulatoryCompliance/Bundles/' . \rawurlencode($bundleSid) . '/Evaluations/' . \rawurlencode($sid) . ''; } /** * Fetch the EvaluationInstance * * @return EvaluationInstance Fetched EvaluationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): EvaluationInstance { $payload = $this->version->fetch('GET', $this->uri); return new EvaluationInstance( $this->version, $payload, $this->solution['bundleSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Numbers.V2.EvaluationContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/Bundle/BundleCopyOptions.php000064400000003375150515725700023132 0ustar00options['friendlyName'] = $friendlyName; } /** * The string that you assigned to describe the copied bundle. * * @param string $friendlyName The string that you assigned to describe the * copied bundle * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Numbers.V2.CreateBundleCopyOptions ' . $options . ']'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/Bundle/BundleCopyList.php000064400000003370150515725700022405 0ustar00solution = ['bundleSid' => $bundleSid, ]; $this->uri = '/RegulatoryCompliance/Bundles/' . \rawurlencode($bundleSid) . '/Copies'; } /** * Create the BundleCopyInstance * * @param array|Options $options Optional Arguments * @return BundleCopyInstance Created BundleCopyInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): BundleCopyInstance { $options = new Values($options); $data = Values::of(['FriendlyName' => $options['friendlyName'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new BundleCopyInstance($this->version, $payload, $this->solution['bundleSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Numbers.V2.BundleCopyList]'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/BundleList.php000064400000014333150515725700020342 0ustar00solution = []; $this->uri = '/RegulatoryCompliance/Bundles'; } /** * Create the BundleInstance * * @param string $friendlyName The string that you assigned to describe the * resource * @param string $email The email address * @param array|Options $options Optional Arguments * @return BundleInstance Created BundleInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, string $email, array $options = []): BundleInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $friendlyName, 'Email' => $email, 'StatusCallback' => $options['statusCallback'], 'RegulationSid' => $options['regulationSid'], 'IsoCountry' => $options['isoCountry'], 'EndUserType' => $options['endUserType'], 'NumberType' => $options['numberType'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new BundleInstance($this->version, $payload); } /** * Streams BundleInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads BundleInstance 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 BundleInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of BundleInstance 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 BundlePage Page of BundleInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): BundlePage { $options = new Values($options); $params = Values::of([ 'Status' => $options['status'], 'FriendlyName' => $options['friendlyName'], 'RegulationSid' => $options['regulationSid'], 'IsoCountry' => $options['isoCountry'], 'NumberType' => $options['numberType'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new BundlePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of BundleInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return BundlePage Page of BundleInstance */ public function getPage(string $targetUrl): BundlePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new BundlePage($this->version, $response, $this->solution); } /** * Constructs a BundleContext * * @param string $sid The unique string that identifies the resource. */ public function getContext(string $sid): BundleContext { return new BundleContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Numbers.V2.BundleList]'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/EndUserPage.php000064400000002246150515725700020437 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return EndUserInstance \Twilio\Rest\Numbers\V2\RegulatoryCompliance\EndUserInstance */ public function buildInstance(array $payload): EndUserInstance { return new EndUserInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Numbers.V2.EndUserPage]'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/EndUserTypeInstance.php000064400000006065150515725700022174 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'machineName' => Values::array_get($payload, 'machine_name'), 'fields' => Values::array_get($payload, 'fields'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['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 EndUserTypeContext Context for this EndUserTypeInstance */ protected function proxy(): EndUserTypeContext { if (!$this->context) { $this->context = new EndUserTypeContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the EndUserTypeInstance * * @return EndUserTypeInstance Fetched EndUserTypeInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): EndUserTypeInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Numbers.V2.EndUserTypeInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/SupportingDocumentContext.php000064400000005214150515725700023511 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/RegulatoryCompliance/SupportingDocuments/' . \rawurlencode($sid) . ''; } /** * Fetch the SupportingDocumentInstance * * @return SupportingDocumentInstance Fetched SupportingDocumentInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SupportingDocumentInstance { $payload = $this->version->fetch('GET', $this->uri); return new SupportingDocumentInstance($this->version, $payload, $this->solution['sid']); } /** * Update the SupportingDocumentInstance * * @param array|Options $options Optional Arguments * @return SupportingDocumentInstance Updated SupportingDocumentInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SupportingDocumentInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'Attributes' => Serialize::jsonObject($options['attributes']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new SupportingDocumentInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the SupportingDocumentInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Numbers.V2.SupportingDocumentContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/SupportingDocumentTypeList.php000064400000011634150515725700023645 0ustar00solution = []; $this->uri = '/RegulatoryCompliance/SupportingDocumentTypes'; } /** * Streams SupportingDocumentTypeInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads SupportingDocumentTypeInstance 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 SupportingDocumentTypeInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of SupportingDocumentTypeInstance 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 SupportingDocumentTypePage Page of SupportingDocumentTypeInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): SupportingDocumentTypePage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new SupportingDocumentTypePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of SupportingDocumentTypeInstance records from the * API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return SupportingDocumentTypePage Page of SupportingDocumentTypeInstance */ public function getPage(string $targetUrl): SupportingDocumentTypePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new SupportingDocumentTypePage($this->version, $response, $this->solution); } /** * Constructs a SupportingDocumentTypeContext * * @param string $sid The unique string that identifies the Supporting Document * Type resource */ public function getContext(string $sid): SupportingDocumentTypeContext { return new SupportingDocumentTypeContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Numbers.V2.SupportingDocumentTypeList]'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/SupportingDocumentTypeInstance.php000064400000006346150515725700024502 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'machineName' => Values::array_get($payload, 'machine_name'), 'fields' => Values::array_get($payload, 'fields'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['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 SupportingDocumentTypeContext Context for this * SupportingDocumentTypeInstance */ protected function proxy(): SupportingDocumentTypeContext { if (!$this->context) { $this->context = new SupportingDocumentTypeContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the SupportingDocumentTypeInstance * * @return SupportingDocumentTypeInstance Fetched SupportingDocumentTypeInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SupportingDocumentTypeInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Numbers.V2.SupportingDocumentTypeInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Numbers/V2/RegulatoryCompliance/SupportingDocumentInstance.php000064400000010502150515725700023625 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'mimeType' => Values::array_get($payload, 'mime_type'), 'status' => Values::array_get($payload, 'status'), 'type' => Values::array_get($payload, 'type'), 'attributes' => Values::array_get($payload, 'attributes'), '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 = ['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 SupportingDocumentContext Context for this SupportingDocumentInstance */ protected function proxy(): SupportingDocumentContext { if (!$this->context) { $this->context = new SupportingDocumentContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the SupportingDocumentInstance * * @return SupportingDocumentInstance Fetched SupportingDocumentInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): SupportingDocumentInstance { return $this->proxy()->fetch(); } /** * Update the SupportingDocumentInstance * * @param array|Options $options Optional Arguments * @return SupportingDocumentInstance Updated SupportingDocumentInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): SupportingDocumentInstance { return $this->proxy()->update($options); } /** * Delete the SupportingDocumentInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Numbers.V2.SupportingDocumentInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Numbers/V2/RegulatoryComplianceList.php000064400000012065150515725700017131 0ustar00solution = []; } /** * Access the bundles */ protected function getBundles(): BundleList { if (!$this->_bundles) { $this->_bundles = new BundleList($this->version); } return $this->_bundles; } /** * Access the endUsers */ protected function getEndUsers(): EndUserList { if (!$this->_endUsers) { $this->_endUsers = new EndUserList($this->version); } return $this->_endUsers; } /** * Access the endUserTypes */ protected function getEndUserTypes(): EndUserTypeList { if (!$this->_endUserTypes) { $this->_endUserTypes = new EndUserTypeList($this->version); } return $this->_endUserTypes; } /** * Access the regulations */ protected function getRegulations(): RegulationList { if (!$this->_regulations) { $this->_regulations = new RegulationList($this->version); } return $this->_regulations; } /** * Access the supportingDocuments */ protected function getSupportingDocuments(): SupportingDocumentList { if (!$this->_supportingDocuments) { $this->_supportingDocuments = new SupportingDocumentList($this->version); } return $this->_supportingDocuments; } /** * Access the supportingDocumentTypes */ protected function getSupportingDocumentTypes(): SupportingDocumentTypeList { if (!$this->_supportingDocumentTypes) { $this->_supportingDocumentTypes = new SupportingDocumentTypeList($this->version); } return $this->_supportingDocumentTypes; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return \Twilio\ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Numbers.V2.RegulatoryComplianceList]'; } }src/Twilio/Rest/Monitor.php000064400000005653150515725700011677 0ustar00baseUrl = 'https://monitor.twilio.com'; } /** * @return V1 Version v1 of monitor */ protected function getV1(): V1 { 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 TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } protected function getAlerts(): \Twilio\Rest\Monitor\V1\AlertList { return $this->v1->alerts; } /** * @param string $sid The SID that identifies the resource to fetch */ protected function contextAlerts(string $sid): \Twilio\Rest\Monitor\V1\AlertContext { return $this->v1->alerts($sid); } protected function getEvents(): \Twilio\Rest\Monitor\V1\EventList { return $this->v1->events; } /** * @param string $sid The SID that identifies the resource to fetch */ protected function contextEvents(string $sid): \Twilio\Rest\Monitor\V1\EventContext { return $this->v1->events($sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Monitor]'; } }src/Twilio/Rest/Studio.php000064400000005661150515725700011516 0ustar00baseUrl = 'https://studio.twilio.com'; } /** * @return V1 Version v1 of studio */ protected function getV1(): V1 { if (!$this->_v1) { $this->_v1 = new V1($this); } return $this->_v1; } /** * @return V2 Version v2 of studio */ protected function getV2(): V2 { if (!$this->_v2) { $this->_v2 = new V2($this); } return $this->_v2; } /** * Magic getter to lazy load version * * @param string $name Version to return * @return \Twilio\Version The requested version * @throws TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } protected function getFlows(): \Twilio\Rest\Studio\V2\FlowList { return $this->v2->flows; } /** * @param string $sid The SID that identifies the resource to fetch */ protected function contextFlows(string $sid): \Twilio\Rest\Studio\V2\FlowContext { return $this->v2->flows($sid); } protected function getFlowValidate(): \Twilio\Rest\Studio\V2\FlowValidateList { return $this->v2->flowValidate; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Studio]'; } }src/Twilio/Rest/Accounts.php000064400000006221150515725700012017 0ustar00baseUrl = 'https://accounts.twilio.com'; } /** * @return V1 Version v1 of accounts */ protected function getV1(): V1 { 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 TwilioException For unknown versions */ public function __get(string $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 TwilioException For unknown resource */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } protected function getAuthTokenPromotion(): \Twilio\Rest\Accounts\V1\AuthTokenPromotionList { return $this->v1->authTokenPromotion; } protected function contextAuthTokenPromotion(): \Twilio\Rest\Accounts\V1\AuthTokenPromotionContext { return $this->v1->authTokenPromotion(); } protected function getCredentials(): \Twilio\Rest\Accounts\V1\CredentialList { return $this->v1->credentials; } protected function getSecondaryAuthToken(): \Twilio\Rest\Accounts\V1\SecondaryAuthTokenList { return $this->v1->secondaryAuthToken; } protected function contextSecondaryAuthToken(): \Twilio\Rest\Accounts\V1\SecondaryAuthTokenContext { return $this->v1->secondaryAuthToken(); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Accounts]'; } }src/Twilio/Rest/Conversations/V1/ParticipantConversationOptions.php000064400000005563150515725700021620 0ustar00options['identity'] = $identity; $this->options['address'] = $address; } /** * A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. * * @param string $identity A unique string identifier for the conversation * participant as Conversation User. * @return $this Fluent Builder */ public function setIdentity(string $identity): self { $this->options['identity'] = $identity; return $this; } /** * A unique string identifier for the conversation participant who's not a Conversation User. This parameter could be found in messaging_binding.address field of Participant resource. It should be url-encoded. * * @param string $address A unique string identifier for the conversation * participant who's not a Conversation User. * @return $this Fluent Builder */ public function setAddress(string $address): self { $this->options['address'] = $address; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.ReadParticipantConversationOptions ' . $options . ']'; } }src/Twilio/Rest/Conversations/V1/ServiceInstance.php000064400000011725150515725700016455 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'sid' => Values::array_get($payload, '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'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 ServiceContext Context for this ServiceInstance */ protected function proxy(): ServiceContext { if (!$this->context) { $this->context = new ServiceContext($this->version, $this->solution['sid']); } return $this->context; } /** * Delete the ServiceInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Fetch the ServiceInstance * * @return ServiceInstance Fetched ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ServiceInstance { return $this->proxy()->fetch(); } /** * Access the conversations */ protected function getConversations(): ConversationList { return $this->proxy()->conversations; } /** * Access the bindings */ protected function getBindings(): BindingList { return $this->proxy()->bindings; } /** * Access the users */ protected function getUsers(): UserList { return $this->proxy()->users; } /** * Access the roles */ protected function getRoles(): RoleList { return $this->proxy()->roles; } /** * Access the configuration */ protected function getConfiguration(): ConfigurationList { return $this->proxy()->configuration; } /** * Access the participantConversations */ protected function getParticipantConversations(): ParticipantConversationList { return $this->proxy()->participantConversations; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.ServiceInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/UserPage.php000064400000002174150515725700015101 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return UserInstance \Twilio\Rest\Conversations\V1\UserInstance */ public function buildInstance(array $payload): UserInstance { return new UserInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.UserPage]'; } }src/Twilio/Rest/Conversations/V1/Configuration/WebhookInstance.php000064400000006625150515725700021265 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'method' => Values::array_get($payload, 'method'), 'filters' => Values::array_get($payload, 'filters'), 'preWebhookUrl' => Values::array_get($payload, 'pre_webhook_url'), 'postWebhookUrl' => Values::array_get($payload, 'post_webhook_url'), 'target' => Values::array_get($payload, 'target'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = []; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return WebhookContext Context for this WebhookInstance */ protected function proxy(): WebhookContext { if (!$this->context) { $this->context = new WebhookContext($this->version); } return $this->context; } /** * Fetch the WebhookInstance * * @return WebhookInstance Fetched WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): WebhookInstance { return $this->proxy()->fetch(); } /** * Update the WebhookInstance * * @param array|Options $options Optional Arguments * @return WebhookInstance Updated WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): WebhookInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.WebhookInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Configuration/WebhookOptions.php000064400000011274150515725700021150 0ustar00options['method'] = $method; $this->options['filters'] = $filters; $this->options['preWebhookUrl'] = $preWebhookUrl; $this->options['postWebhookUrl'] = $postWebhookUrl; $this->options['target'] = $target; } /** * The HTTP method to be used when sending a webhook request. * * @param string $method The HTTP method to be used when sending a webhook * request. * @return $this Fluent Builder */ public function setMethod(string $method): self { $this->options['method'] = $method; return $this; } /** * The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved` * * @param string[] $filters The list of webhook event triggers that are enabled * for this Service. * @return $this Fluent Builder */ public function setFilters(array $filters): self { $this->options['filters'] = $filters; return $this; } /** * The absolute url the pre-event webhook request should be sent to. * * @param string $preWebhookUrl The absolute url the pre-event webhook request * should be sent to. * @return $this Fluent Builder */ public function setPreWebhookUrl(string $preWebhookUrl): self { $this->options['preWebhookUrl'] = $preWebhookUrl; return $this; } /** * The absolute url the post-event webhook request should be sent to. * * @param string $postWebhookUrl The absolute url the post-event webhook * request should be sent to. * @return $this Fluent Builder */ public function setPostWebhookUrl(string $postWebhookUrl): self { $this->options['postWebhookUrl'] = $postWebhookUrl; return $this; } /** * The routing target of the webhook. * * @param string $target The routing target of the webhook. * @return $this Fluent Builder */ public function setTarget(string $target): self { $this->options['target'] = $target; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.UpdateWebhookOptions ' . $options . ']'; } }src/Twilio/Rest/Conversations/V1/Configuration/WebhookPage.php000064400000002252150515725700020365 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return WebhookInstance \Twilio\Rest\Conversations\V1\Configuration\WebhookInstance */ public function buildInstance(array $payload): WebhookInstance { return new WebhookInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.WebhookPage]'; } }src/Twilio/Rest/Conversations/V1/Configuration/WebhookList.php000064400000001627150515725700020431 0ustar00solution = []; } /** * Constructs a WebhookContext */ public function getContext(): WebhookContext { return new WebhookContext($this->version); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.WebhookList]'; } }src/Twilio/Rest/Conversations/V1/Configuration/WebhookContext.php000064400000004310150515725700021132 0ustar00solution = []; $this->uri = '/Configuration/Webhooks'; } /** * Fetch the WebhookInstance * * @return WebhookInstance Fetched WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): WebhookInstance { $payload = $this->version->fetch('GET', $this->uri); return new WebhookInstance($this->version, $payload); } /** * Update the WebhookInstance * * @param array|Options $options Optional Arguments * @return WebhookInstance Updated WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): WebhookInstance { $options = new Values($options); $data = Values::of([ 'Method' => $options['method'], 'Filters' => Serialize::map($options['filters'], function($e) { return $e; }), 'PreWebhookUrl' => $options['preWebhookUrl'], 'PostWebhookUrl' => $options['postWebhookUrl'], 'Target' => $options['target'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new WebhookInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.WebhookContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/CredentialList.php000064400000013272150515725700016275 0ustar00solution = []; $this->uri = '/Credentials'; } /** * Create the CredentialInstance * * @param string $type The type of push-notification service the credential is * for. * @param array|Options $options Optional Arguments * @return CredentialInstance Created CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $type, array $options = []): CredentialInstance { $options = new Values($options); $data = Values::of([ 'Type' => $type, 'FriendlyName' => $options['friendlyName'], 'Certificate' => $options['certificate'], 'PrivateKey' => $options['privateKey'], 'Sandbox' => Serialize::booleanToString($options['sandbox']), 'ApiKey' => $options['apiKey'], 'Secret' => $options['secret'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new CredentialInstance($this->version, $payload); } /** * Streams CredentialInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads CredentialInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return CredentialInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of CredentialInstance records from the API. * Request is executed immediately * * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return CredentialPage Page of CredentialInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): CredentialPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new CredentialPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of CredentialInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return CredentialPage Page of CredentialInstance */ public function getPage(string $targetUrl): CredentialPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new CredentialPage($this->version, $response, $this->solution); } /** * Constructs a CredentialContext * * @param string $sid A 34 character string that uniquely identifies this * resource. */ public function getContext(string $sid): CredentialContext { return new CredentialContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.CredentialList]'; } }src/Twilio/Rest/Conversations/V1/UserContext.php000064400000010704150515725700015647 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Users/' . \rawurlencode($sid) . ''; } /** * Update the UserInstance * * @param array|Options $options Optional Arguments * @return UserInstance Updated UserInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): UserInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'Attributes' => $options['attributes'], 'RoleSid' => $options['roleSid'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->update('POST', $this->uri, [], $data, $headers); return new UserInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the UserInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { $options = new Values($options); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); return $this->version->delete('DELETE', $this->uri, [], [], $headers); } /** * Fetch the UserInstance * * @return UserInstance Fetched UserInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): UserInstance { $payload = $this->version->fetch('GET', $this->uri); return new UserInstance($this->version, $payload, $this->solution['sid']); } /** * Access the userConversations */ protected function getUserConversations(): UserConversationList { if (!$this->_userConversations) { $this->_userConversations = new UserConversationList($this->version, $this->solution['sid']); } return $this->_userConversations; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.UserContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/RoleList.php000064400000012426150515725700015124 0ustar00solution = []; $this->uri = '/Roles'; } /** * Create the RoleInstance * * @param string $friendlyName A string to describe the new resource * @param string $type The type of role * @param string[] $permission A permission the role should have * @return RoleInstance Created RoleInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, string $type, array $permission): RoleInstance { $data = Values::of([ 'FriendlyName' => $friendlyName, 'Type' => $type, 'Permission' => Serialize::map($permission, function($e) { return $e; }), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new RoleInstance($this->version, $payload); } /** * Streams RoleInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads RoleInstance 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 RoleInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of RoleInstance 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 RolePage Page of RoleInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): RolePage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new RolePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of RoleInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return RolePage Page of RoleInstance */ public function getPage(string $targetUrl): RolePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new RolePage($this->version, $response, $this->solution); } /** * Constructs a RoleContext * * @param string $sid The SID of the Role resource to fetch */ public function getContext(string $sid): RoleContext { return new RoleContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.RoleList]'; } }src/Twilio/Rest/Conversations/V1/Conversation/Message/DeliveryReceiptContext.php000064400000004336150515725700024072 0ustar00solution = [ 'conversationSid' => $conversationSid, 'messageSid' => $messageSid, 'sid' => $sid, ]; $this->uri = '/Conversations/' . \rawurlencode($conversationSid) . '/Messages/' . \rawurlencode($messageSid) . '/Receipts/' . \rawurlencode($sid) . ''; } /** * Fetch the DeliveryReceiptInstance * * @return DeliveryReceiptInstance Fetched DeliveryReceiptInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): DeliveryReceiptInstance { $payload = $this->version->fetch('GET', $this->uri); return new DeliveryReceiptInstance( $this->version, $payload, $this->solution['conversationSid'], $this->solution['messageSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.DeliveryReceiptContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Conversation/Message/DeliveryReceiptInstance.php000064400000010571150515725700024210 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'conversationSid' => Values::array_get($payload, 'conversation_sid'), 'sid' => Values::array_get($payload, 'sid'), 'messageSid' => Values::array_get($payload, 'message_sid'), 'channelMessageSid' => Values::array_get($payload, 'channel_message_sid'), 'participantSid' => Values::array_get($payload, 'participant_sid'), 'status' => Values::array_get($payload, 'status'), 'errorCode' => Values::array_get($payload, 'error_code'), '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 = [ 'conversationSid' => $conversationSid, 'messageSid' => $messageSid, '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 DeliveryReceiptContext Context for this DeliveryReceiptInstance */ protected function proxy(): DeliveryReceiptContext { if (!$this->context) { $this->context = new DeliveryReceiptContext( $this->version, $this->solution['conversationSid'], $this->solution['messageSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the DeliveryReceiptInstance * * @return DeliveryReceiptInstance Fetched DeliveryReceiptInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): DeliveryReceiptInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.DeliveryReceiptInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Conversation/Message/DeliveryReceiptList.php000064400000012451150515725700023356 0ustar00solution = ['conversationSid' => $conversationSid, 'messageSid' => $messageSid, ]; $this->uri = '/Conversations/' . \rawurlencode($conversationSid) . '/Messages/' . \rawurlencode($messageSid) . '/Receipts'; } /** * Streams DeliveryReceiptInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads DeliveryReceiptInstance 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 DeliveryReceiptInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of DeliveryReceiptInstance 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 DeliveryReceiptPage Page of DeliveryReceiptInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): DeliveryReceiptPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new DeliveryReceiptPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of DeliveryReceiptInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return DeliveryReceiptPage Page of DeliveryReceiptInstance */ public function getPage(string $targetUrl): DeliveryReceiptPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new DeliveryReceiptPage($this->version, $response, $this->solution); } /** * Constructs a DeliveryReceiptContext * * @param string $sid A 34 character string that uniquely identifies this * resource. */ public function getContext(string $sid): DeliveryReceiptContext { return new DeliveryReceiptContext( $this->version, $this->solution['conversationSid'], $this->solution['messageSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.DeliveryReceiptList]'; } }src/Twilio/Rest/Conversations/V1/Conversation/Message/DeliveryReceiptPage.php000064400000002545150515725700023322 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return DeliveryReceiptInstance \Twilio\Rest\Conversations\V1\Conversation\Message\DeliveryReceiptInstance */ public function buildInstance(array $payload): DeliveryReceiptInstance { return new DeliveryReceiptInstance( $this->version, $payload, $this->solution['conversationSid'], $this->solution['messageSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.DeliveryReceiptPage]'; } }src/Twilio/Rest/Conversations/V1/Conversation/ParticipantContext.php000064400000007473150515725700021672 0ustar00solution = ['conversationSid' => $conversationSid, 'sid' => $sid, ]; $this->uri = '/Conversations/' . \rawurlencode($conversationSid) . '/Participants/' . \rawurlencode($sid) . ''; } /** * Update the ParticipantInstance * * @param array|Options $options Optional Arguments * @return ParticipantInstance Updated ParticipantInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ParticipantInstance { $options = new Values($options); $data = Values::of([ 'DateCreated' => Serialize::iso8601DateTime($options['dateCreated']), 'DateUpdated' => Serialize::iso8601DateTime($options['dateUpdated']), 'Attributes' => $options['attributes'], 'RoleSid' => $options['roleSid'], 'MessagingBinding.ProxyAddress' => $options['messagingBindingProxyAddress'], 'MessagingBinding.ProjectedAddress' => $options['messagingBindingProjectedAddress'], 'Identity' => $options['identity'], 'LastReadMessageIndex' => $options['lastReadMessageIndex'], 'LastReadTimestamp' => $options['lastReadTimestamp'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->update('POST', $this->uri, [], $data, $headers); return new ParticipantInstance( $this->version, $payload, $this->solution['conversationSid'], $this->solution['sid'] ); } /** * Delete the ParticipantInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { $options = new Values($options); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); return $this->version->delete('DELETE', $this->uri, [], [], $headers); } /** * Fetch the ParticipantInstance * * @return ParticipantInstance Fetched ParticipantInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ParticipantInstance { $payload = $this->version->fetch('GET', $this->uri); return new ParticipantInstance( $this->version, $payload, $this->solution['conversationSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.ParticipantContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Conversation/ParticipantPage.php000064400000002344150515725700021112 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ParticipantInstance \Twilio\Rest\Conversations\V1\Conversation\ParticipantInstance */ public function buildInstance(array $payload): ParticipantInstance { return new ParticipantInstance($this->version, $payload, $this->solution['conversationSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.ParticipantPage]'; } }src/Twilio/Rest/Conversations/V1/Conversation/ParticipantList.php000064400000014355150515725700021156 0ustar00solution = ['conversationSid' => $conversationSid, ]; $this->uri = '/Conversations/' . \rawurlencode($conversationSid) . '/Participants'; } /** * Create the ParticipantInstance * * @param array|Options $options Optional Arguments * @return ParticipantInstance Created ParticipantInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): ParticipantInstance { $options = new Values($options); $data = Values::of([ 'Identity' => $options['identity'], 'MessagingBinding.Address' => $options['messagingBindingAddress'], 'MessagingBinding.ProxyAddress' => $options['messagingBindingProxyAddress'], 'DateCreated' => Serialize::iso8601DateTime($options['dateCreated']), 'DateUpdated' => Serialize::iso8601DateTime($options['dateUpdated']), 'Attributes' => $options['attributes'], 'MessagingBinding.ProjectedAddress' => $options['messagingBindingProjectedAddress'], 'RoleSid' => $options['roleSid'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->create('POST', $this->uri, [], $data, $headers); return new ParticipantInstance($this->version, $payload, $this->solution['conversationSid']); } /** * Streams ParticipantInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ParticipantInstance 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 ParticipantInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of ParticipantInstance 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 ParticipantPage Page of ParticipantInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ParticipantPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ParticipantPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ParticipantInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ParticipantPage Page of ParticipantInstance */ public function getPage(string $targetUrl): ParticipantPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ParticipantPage($this->version, $response, $this->solution); } /** * Constructs a ParticipantContext * * @param string $sid A 34 character string that uniquely identifies this * resource. */ public function getContext(string $sid): ParticipantContext { return new ParticipantContext($this->version, $this->solution['conversationSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.ParticipantList]'; } }src/Twilio/Rest/Conversations/V1/Conversation/WebhookInstance.php000064400000010535150515725700021123 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'conversationSid' => Values::array_get($payload, 'conversation_sid'), 'target' => Values::array_get($payload, 'target'), 'url' => Values::array_get($payload, 'url'), 'configuration' => Values::array_get($payload, 'configuration'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), ]; $this->solution = [ 'conversationSid' => $conversationSid, '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 WebhookContext Context for this WebhookInstance */ protected function proxy(): WebhookContext { if (!$this->context) { $this->context = new WebhookContext( $this->version, $this->solution['conversationSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the WebhookInstance * * @return WebhookInstance Fetched WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): WebhookInstance { return $this->proxy()->fetch(); } /** * Update the WebhookInstance * * @param array|Options $options Optional Arguments * @return WebhookInstance Updated WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): WebhookInstance { return $this->proxy()->update($options); } /** * Delete the WebhookInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.WebhookInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Conversation/MessageInstance.php000064400000012363150515725700021112 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'conversationSid' => Values::array_get($payload, 'conversation_sid'), 'sid' => Values::array_get($payload, 'sid'), 'index' => Values::array_get($payload, 'index'), 'author' => Values::array_get($payload, 'author'), 'body' => Values::array_get($payload, 'body'), 'media' => Values::array_get($payload, 'media'), 'attributes' => Values::array_get($payload, 'attributes'), 'participantSid' => Values::array_get($payload, 'participant_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'url' => Values::array_get($payload, 'url'), 'delivery' => Values::array_get($payload, 'delivery'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = [ 'conversationSid' => $conversationSid, '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 MessageContext Context for this MessageInstance */ protected function proxy(): MessageContext { if (!$this->context) { $this->context = new MessageContext( $this->version, $this->solution['conversationSid'], $this->solution['sid'] ); } return $this->context; } /** * Update the MessageInstance * * @param array|Options $options Optional Arguments * @return MessageInstance Updated MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): MessageInstance { return $this->proxy()->update($options); } /** * Delete the MessageInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { return $this->proxy()->delete($options); } /** * Fetch the MessageInstance * * @return MessageInstance Fetched MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MessageInstance { return $this->proxy()->fetch(); } /** * Access the deliveryReceipts */ protected function getDeliveryReceipts(): DeliveryReceiptList { return $this->proxy()->deliveryReceipts; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.MessageInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Conversation/WebhookOptions.php000064400000027045150515725700021016 0ustar00options['configurationUrl'] = $configurationUrl; $this->options['configurationMethod'] = $configurationMethod; $this->options['configurationFilters'] = $configurationFilters; $this->options['configurationTriggers'] = $configurationTriggers; $this->options['configurationFlowSid'] = $configurationFlowSid; $this->options['configurationReplayAfter'] = $configurationReplayAfter; } /** * The absolute url the webhook request should be sent to. * * @param string $configurationUrl The absolute url the webhook request should * be sent to. * @return $this Fluent Builder */ public function setConfigurationUrl(string $configurationUrl): self { $this->options['configurationUrl'] = $configurationUrl; return $this; } /** * The HTTP method to be used when sending a webhook request. * * @param string $configurationMethod The HTTP method to be used when sending a * webhook request. * @return $this Fluent Builder */ public function setConfigurationMethod(string $configurationMethod): self { $this->options['configurationMethod'] = $configurationMethod; return $this; } /** * The list of events, firing webhook event for this Conversation. * * @param string[] $configurationFilters The list of events, firing webhook * event for this Conversation. * @return $this Fluent Builder */ public function setConfigurationFilters(array $configurationFilters): self { $this->options['configurationFilters'] = $configurationFilters; return $this; } /** * The list of keywords, firing webhook event for this Conversation. * * @param string[] $configurationTriggers The list of keywords, firing webhook * event for this Conversation. * @return $this Fluent Builder */ public function setConfigurationTriggers(array $configurationTriggers): self { $this->options['configurationTriggers'] = $configurationTriggers; return $this; } /** * The studio flow SID, where the webhook should be sent to. * * @param string $configurationFlowSid The studio flow SID, where the webhook * should be sent to. * @return $this Fluent Builder */ public function setConfigurationFlowSid(string $configurationFlowSid): self { $this->options['configurationFlowSid'] = $configurationFlowSid; return $this; } /** * The message index for which and it's successors the webhook will be replayed. Not set by default * * @param int $configurationReplayAfter The message index for which and it's * successors the webhook will be replayed. * @return $this Fluent Builder */ public function setConfigurationReplayAfter(int $configurationReplayAfter): self { $this->options['configurationReplayAfter'] = $configurationReplayAfter; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.CreateWebhookOptions ' . $options . ']'; } } class UpdateWebhookOptions extends Options { /** * @param string $configurationUrl The absolute url the webhook request should * be sent to. * @param string $configurationMethod The HTTP method to be used when sending a * webhook request. * @param string[] $configurationFilters The list of events, firing webhook * event for this Conversation. * @param string[] $configurationTriggers The list of keywords, firing webhook * event for this Conversation. * @param string $configurationFlowSid The studio flow SID, where the webhook * should be sent to. */ public function __construct(string $configurationUrl = Values::NONE, string $configurationMethod = Values::NONE, array $configurationFilters = Values::ARRAY_NONE, array $configurationTriggers = Values::ARRAY_NONE, string $configurationFlowSid = Values::NONE) { $this->options['configurationUrl'] = $configurationUrl; $this->options['configurationMethod'] = $configurationMethod; $this->options['configurationFilters'] = $configurationFilters; $this->options['configurationTriggers'] = $configurationTriggers; $this->options['configurationFlowSid'] = $configurationFlowSid; } /** * The absolute url the webhook request should be sent to. * * @param string $configurationUrl The absolute url the webhook request should * be sent to. * @return $this Fluent Builder */ public function setConfigurationUrl(string $configurationUrl): self { $this->options['configurationUrl'] = $configurationUrl; return $this; } /** * The HTTP method to be used when sending a webhook request. * * @param string $configurationMethod The HTTP method to be used when sending a * webhook request. * @return $this Fluent Builder */ public function setConfigurationMethod(string $configurationMethod): self { $this->options['configurationMethod'] = $configurationMethod; return $this; } /** * The list of events, firing webhook event for this Conversation. * * @param string[] $configurationFilters The list of events, firing webhook * event for this Conversation. * @return $this Fluent Builder */ public function setConfigurationFilters(array $configurationFilters): self { $this->options['configurationFilters'] = $configurationFilters; return $this; } /** * The list of keywords, firing webhook event for this Conversation. * * @param string[] $configurationTriggers The list of keywords, firing webhook * event for this Conversation. * @return $this Fluent Builder */ public function setConfigurationTriggers(array $configurationTriggers): self { $this->options['configurationTriggers'] = $configurationTriggers; return $this; } /** * The studio flow SID, where the webhook should be sent to. * * @param string $configurationFlowSid The studio flow SID, where the webhook * should be sent to. * @return $this Fluent Builder */ public function setConfigurationFlowSid(string $configurationFlowSid): self { $this->options['configurationFlowSid'] = $configurationFlowSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.UpdateWebhookOptions ' . $options . ']'; } }src/Twilio/Rest/Conversations/V1/Conversation/MessageList.php000064400000014436150515725700020264 0ustar00solution = ['conversationSid' => $conversationSid, ]; $this->uri = '/Conversations/' . \rawurlencode($conversationSid) . '/Messages'; } /** * Create the MessageInstance * * @param array|Options $options Optional Arguments * @return MessageInstance Created MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): MessageInstance { $options = new Values($options); $data = Values::of([ 'Author' => $options['author'], 'Body' => $options['body'], 'DateCreated' => Serialize::iso8601DateTime($options['dateCreated']), 'DateUpdated' => Serialize::iso8601DateTime($options['dateUpdated']), 'Attributes' => $options['attributes'], 'MediaSid' => $options['mediaSid'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->create('POST', $this->uri, [], $data, $headers); return new MessageInstance($this->version, $payload, $this->solution['conversationSid']); } /** * Streams MessageInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads MessageInstance 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 MessageInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of MessageInstance 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 MessagePage Page of MessageInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): MessagePage { $options = new Values($options); $params = Values::of([ 'Order' => $options['order'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new MessagePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of MessageInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return MessagePage Page of MessageInstance */ public function getPage(string $targetUrl): MessagePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new MessagePage($this->version, $response, $this->solution); } /** * Constructs a MessageContext * * @param string $sid A 34 character string that uniquely identifies this * resource. */ public function getContext(string $sid): MessageContext { return new MessageContext($this->version, $this->solution['conversationSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.MessageList]'; } }src/Twilio/Rest/Conversations/V1/Conversation/MessageContext.php000064400000012354150515725700020772 0ustar00solution = ['conversationSid' => $conversationSid, 'sid' => $sid, ]; $this->uri = '/Conversations/' . \rawurlencode($conversationSid) . '/Messages/' . \rawurlencode($sid) . ''; } /** * Update the MessageInstance * * @param array|Options $options Optional Arguments * @return MessageInstance Updated MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): MessageInstance { $options = new Values($options); $data = Values::of([ 'Author' => $options['author'], 'Body' => $options['body'], 'DateCreated' => Serialize::iso8601DateTime($options['dateCreated']), 'DateUpdated' => Serialize::iso8601DateTime($options['dateUpdated']), 'Attributes' => $options['attributes'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->update('POST', $this->uri, [], $data, $headers); return new MessageInstance( $this->version, $payload, $this->solution['conversationSid'], $this->solution['sid'] ); } /** * Delete the MessageInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { $options = new Values($options); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); return $this->version->delete('DELETE', $this->uri, [], [], $headers); } /** * Fetch the MessageInstance * * @return MessageInstance Fetched MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MessageInstance { $payload = $this->version->fetch('GET', $this->uri); return new MessageInstance( $this->version, $payload, $this->solution['conversationSid'], $this->solution['sid'] ); } /** * Access the deliveryReceipts */ protected function getDeliveryReceipts(): DeliveryReceiptList { if (!$this->_deliveryReceipts) { $this->_deliveryReceipts = new DeliveryReceiptList( $this->version, $this->solution['conversationSid'], $this->solution['sid'] ); } return $this->_deliveryReceipts; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.MessageContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Conversation/MessageOptions.php000064400000032500150515725700020774 0ustar00options['author'] = $author; $this->options['body'] = $body; $this->options['dateCreated'] = $dateCreated; $this->options['dateUpdated'] = $dateUpdated; $this->options['attributes'] = $attributes; $this->options['mediaSid'] = $mediaSid; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The channel specific identifier of the message's author. Defaults to `system`. * * @param string $author The channel specific identifier of the message's * author. * @return $this Fluent Builder */ public function setAuthor(string $author): self { $this->options['author'] = $author; return $this; } /** * The content of the message, can be up to 1,600 characters long. * * @param string $body The content of the message. * @return $this Fluent Builder */ public function setBody(string $body): self { $this->options['body'] = $body; return $this; } /** * The date that this resource was created. * * @param \DateTime $dateCreated The date that this resource was created. * @return $this Fluent Builder */ public function setDateCreated(\DateTime $dateCreated): self { $this->options['dateCreated'] = $dateCreated; return $this; } /** * The date that this resource was last updated. `null` if the message has not been edited. * * @param \DateTime $dateUpdated The date that this resource was last updated. * @return $this Fluent Builder */ public function setDateUpdated(\DateTime $dateUpdated): self { $this->options['dateUpdated'] = $dateUpdated; return $this; } /** * A string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set "{}" will be returned. * * @param string $attributes A string metadata field you can use to store any * data you wish. * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The Media SID to be attached to the new Message. * * @param string $mediaSid The Media SID to be attached to the new Message. * @return $this Fluent Builder */ public function setMediaSid(string $mediaSid): self { $this->options['mediaSid'] = $mediaSid; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.CreateMessageOptions ' . $options . ']'; } } class UpdateMessageOptions extends Options { /** * @param string $author The channel specific identifier of the message's * author. * @param string $body The content of the message. * @param \DateTime $dateCreated The date that this resource was created. * @param \DateTime $dateUpdated The date that this resource was last updated. * @param string $attributes A string metadata field you can use to store any * data you wish. * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header */ public function __construct(string $author = Values::NONE, string $body = Values::NONE, \DateTime $dateCreated = Values::NONE, \DateTime $dateUpdated = Values::NONE, string $attributes = Values::NONE, string $xTwilioWebhookEnabled = Values::NONE) { $this->options['author'] = $author; $this->options['body'] = $body; $this->options['dateCreated'] = $dateCreated; $this->options['dateUpdated'] = $dateUpdated; $this->options['attributes'] = $attributes; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The channel specific identifier of the message's author. Defaults to `system`. * * @param string $author The channel specific identifier of the message's * author. * @return $this Fluent Builder */ public function setAuthor(string $author): self { $this->options['author'] = $author; return $this; } /** * The content of the message, can be up to 1,600 characters long. * * @param string $body The content of the message. * @return $this Fluent Builder */ public function setBody(string $body): self { $this->options['body'] = $body; return $this; } /** * The date that this resource was created. * * @param \DateTime $dateCreated The date that this resource was created. * @return $this Fluent Builder */ public function setDateCreated(\DateTime $dateCreated): self { $this->options['dateCreated'] = $dateCreated; return $this; } /** * The date that this resource was last updated. `null` if the message has not been edited. * * @param \DateTime $dateUpdated The date that this resource was last updated. * @return $this Fluent Builder */ public function setDateUpdated(\DateTime $dateUpdated): self { $this->options['dateUpdated'] = $dateUpdated; return $this; } /** * A string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set "{}" will be returned. * * @param string $attributes A string metadata field you can use to store any * data you wish. * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.UpdateMessageOptions ' . $options . ']'; } } class DeleteMessageOptions extends Options { /** * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header */ public function __construct(string $xTwilioWebhookEnabled = Values::NONE) { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.DeleteMessageOptions ' . $options . ']'; } } class ReadMessageOptions extends Options { /** * @param string $order The sort order of the returned messages */ public function __construct(string $order = Values::NONE) { $this->options['order'] = $order; } /** * The sort order of the returned messages. Can be: `asc` (ascending) or `desc` (descending), with `asc` as the default. * * @param string $order The sort order of the returned messages * @return $this Fluent Builder */ public function setOrder(string $order): self { $this->options['order'] = $order; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.ReadMessageOptions ' . $options . ']'; } }src/Twilio/Rest/Conversations/V1/Conversation/WebhookPage.php000064400000002314150515725700020227 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return WebhookInstance \Twilio\Rest\Conversations\V1\Conversation\WebhookInstance */ public function buildInstance(array $payload): WebhookInstance { return new WebhookInstance($this->version, $payload, $this->solution['conversationSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.WebhookPage]'; } }src/Twilio/Rest/Conversations/V1/Conversation/WebhookList.php000064400000014122150515725700020266 0ustar00solution = ['conversationSid' => $conversationSid, ]; $this->uri = '/Conversations/' . \rawurlencode($conversationSid) . '/Webhooks'; } /** * Streams WebhookInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads WebhookInstance 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 WebhookInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of WebhookInstance 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 WebhookPage Page of WebhookInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): WebhookPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new WebhookPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of WebhookInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return WebhookPage Page of WebhookInstance */ public function getPage(string $targetUrl): WebhookPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new WebhookPage($this->version, $response, $this->solution); } /** * Create the WebhookInstance * * @param string $target The target of this webhook. * @param array|Options $options Optional Arguments * @return WebhookInstance Created WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $target, array $options = []): WebhookInstance { $options = new Values($options); $data = Values::of([ 'Target' => $target, 'Configuration.Url' => $options['configurationUrl'], 'Configuration.Method' => $options['configurationMethod'], 'Configuration.Filters' => Serialize::map($options['configurationFilters'], function($e) { return $e; }), 'Configuration.Triggers' => Serialize::map($options['configurationTriggers'], function($e) { return $e; }), 'Configuration.FlowSid' => $options['configurationFlowSid'], 'Configuration.ReplayAfter' => $options['configurationReplayAfter'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new WebhookInstance($this->version, $payload, $this->solution['conversationSid']); } /** * Constructs a WebhookContext * * @param string $sid A 34 character string that uniquely identifies this * resource. */ public function getContext(string $sid): WebhookContext { return new WebhookContext($this->version, $this->solution['conversationSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.WebhookList]'; } }src/Twilio/Rest/Conversations/V1/Conversation/ParticipantOptions.php000064400000052363150515725700021677 0ustar00options['identity'] = $identity; $this->options['messagingBindingAddress'] = $messagingBindingAddress; $this->options['messagingBindingProxyAddress'] = $messagingBindingProxyAddress; $this->options['dateCreated'] = $dateCreated; $this->options['dateUpdated'] = $dateUpdated; $this->options['attributes'] = $attributes; $this->options['messagingBindingProjectedAddress'] = $messagingBindingProjectedAddress; $this->options['roleSid'] = $roleSid; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. * * @param string $identity A unique string identifier for the conversation * participant as Conversation User. * @return $this Fluent Builder */ public function setIdentity(string $identity): self { $this->options['identity'] = $identity; return $this; } /** * The address of the participant's device, e.g. a phone or WhatsApp number. Together with the Proxy address, this determines a participant uniquely. This field (with proxy_address) is only null when the participant is interacting from an SDK endpoint (see the 'identity' field). * * @param string $messagingBindingAddress The address of the participant's * device. * @return $this Fluent Builder */ public function setMessagingBindingAddress(string $messagingBindingAddress): self { $this->options['messagingBindingAddress'] = $messagingBindingAddress; return $this; } /** * The address of the Twilio phone number (or WhatsApp number) that the participant is in contact with. This field, together with participant address, is only null when the participant is interacting from an SDK endpoint (see the 'identity' field). * * @param string $messagingBindingProxyAddress The address of the Twilio phone * number that the participant is * in contact with. * @return $this Fluent Builder */ public function setMessagingBindingProxyAddress(string $messagingBindingProxyAddress): self { $this->options['messagingBindingProxyAddress'] = $messagingBindingProxyAddress; return $this; } /** * The date that this resource was created. * * @param \DateTime $dateCreated The date that this resource was created. * @return $this Fluent Builder */ public function setDateCreated(\DateTime $dateCreated): self { $this->options['dateCreated'] = $dateCreated; return $this; } /** * The date that this resource was last updated. * * @param \DateTime $dateUpdated The date that this resource was last updated. * @return $this Fluent Builder */ public function setDateUpdated(\DateTime $dateUpdated): self { $this->options['dateUpdated'] = $dateUpdated; return $this; } /** * An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set "{}" will be returned. * * @param string $attributes An optional string metadata field you can use to * store any data you wish. * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The address of the Twilio phone number that is used in Group MMS. Communication mask for the Conversation participant with Identity. * * @param string $messagingBindingProjectedAddress The address of the Twilio * phone number that is used in * Group MMS. * @return $this Fluent Builder */ public function setMessagingBindingProjectedAddress(string $messagingBindingProjectedAddress): self { $this->options['messagingBindingProjectedAddress'] = $messagingBindingProjectedAddress; return $this; } /** * The SID of a conversation-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the participant. * * @param string $roleSid The SID of a conversation-level Role to assign to the * participant * @return $this Fluent Builder */ public function setRoleSid(string $roleSid): self { $this->options['roleSid'] = $roleSid; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.CreateParticipantOptions ' . $options . ']'; } } class UpdateParticipantOptions extends Options { /** * @param \DateTime $dateCreated The date that this resource was created. * @param \DateTime $dateUpdated The date that this resource was last updated. * @param string $attributes An optional string metadata field you can use to * store any data you wish. * @param string $roleSid The SID of a conversation-level Role to assign to the * participant * @param string $messagingBindingProxyAddress The address of the Twilio phone * number that the participant is * in contact with. * @param string $messagingBindingProjectedAddress The address of the Twilio * phone number that is used in * Group MMS. * @param string $identity A unique string identifier for the conversation * participant as Conversation User. * @param int $lastReadMessageIndex Index of last “read” message in the * Conversation for the Participant. * @param string $lastReadTimestamp Timestamp of last “read” message in the * Conversation for the Participant. * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header */ public function __construct(\DateTime $dateCreated = Values::NONE, \DateTime $dateUpdated = Values::NONE, string $attributes = Values::NONE, string $roleSid = Values::NONE, string $messagingBindingProxyAddress = Values::NONE, string $messagingBindingProjectedAddress = Values::NONE, string $identity = Values::NONE, int $lastReadMessageIndex = Values::NONE, string $lastReadTimestamp = Values::NONE, string $xTwilioWebhookEnabled = Values::NONE) { $this->options['dateCreated'] = $dateCreated; $this->options['dateUpdated'] = $dateUpdated; $this->options['attributes'] = $attributes; $this->options['roleSid'] = $roleSid; $this->options['messagingBindingProxyAddress'] = $messagingBindingProxyAddress; $this->options['messagingBindingProjectedAddress'] = $messagingBindingProjectedAddress; $this->options['identity'] = $identity; $this->options['lastReadMessageIndex'] = $lastReadMessageIndex; $this->options['lastReadTimestamp'] = $lastReadTimestamp; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The date that this resource was created. * * @param \DateTime $dateCreated The date that this resource was created. * @return $this Fluent Builder */ public function setDateCreated(\DateTime $dateCreated): self { $this->options['dateCreated'] = $dateCreated; return $this; } /** * The date that this resource was last updated. * * @param \DateTime $dateUpdated The date that this resource was last updated. * @return $this Fluent Builder */ public function setDateUpdated(\DateTime $dateUpdated): self { $this->options['dateUpdated'] = $dateUpdated; return $this; } /** * An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set "{}" will be returned. * * @param string $attributes An optional string metadata field you can use to * store any data you wish. * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The SID of a conversation-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the participant. * * @param string $roleSid The SID of a conversation-level Role to assign to the * participant * @return $this Fluent Builder */ public function setRoleSid(string $roleSid): self { $this->options['roleSid'] = $roleSid; return $this; } /** * The address of the Twilio phone number that the participant is in contact with. 'null' value will remove it. * * @param string $messagingBindingProxyAddress The address of the Twilio phone * number that the participant is * in contact with. * @return $this Fluent Builder */ public function setMessagingBindingProxyAddress(string $messagingBindingProxyAddress): self { $this->options['messagingBindingProxyAddress'] = $messagingBindingProxyAddress; return $this; } /** * The address of the Twilio phone number that is used in Group MMS. 'null' value will remove it. * * @param string $messagingBindingProjectedAddress The address of the Twilio * phone number that is used in * Group MMS. * @return $this Fluent Builder */ public function setMessagingBindingProjectedAddress(string $messagingBindingProjectedAddress): self { $this->options['messagingBindingProjectedAddress'] = $messagingBindingProjectedAddress; return $this; } /** * A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. * * @param string $identity A unique string identifier for the conversation * participant as Conversation User. * @return $this Fluent Builder */ public function setIdentity(string $identity): self { $this->options['identity'] = $identity; return $this; } /** * Index of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. * * @param int $lastReadMessageIndex Index of last “read” message in the * Conversation for the Participant. * @return $this Fluent Builder */ public function setLastReadMessageIndex(int $lastReadMessageIndex): self { $this->options['lastReadMessageIndex'] = $lastReadMessageIndex; return $this; } /** * Timestamp of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. * * @param string $lastReadTimestamp Timestamp of last “read” message in the * Conversation for the Participant. * @return $this Fluent Builder */ public function setLastReadTimestamp(string $lastReadTimestamp): self { $this->options['lastReadTimestamp'] = $lastReadTimestamp; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.UpdateParticipantOptions ' . $options . ']'; } } class DeleteParticipantOptions extends Options { /** * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header */ public function __construct(string $xTwilioWebhookEnabled = Values::NONE) { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.DeleteParticipantOptions ' . $options . ']'; } }src/Twilio/Rest/Conversations/V1/Conversation/WebhookContext.php000064400000006346150515725700021010 0ustar00solution = ['conversationSid' => $conversationSid, 'sid' => $sid, ]; $this->uri = '/Conversations/' . \rawurlencode($conversationSid) . '/Webhooks/' . \rawurlencode($sid) . ''; } /** * Fetch the WebhookInstance * * @return WebhookInstance Fetched WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): WebhookInstance { $payload = $this->version->fetch('GET', $this->uri); return new WebhookInstance( $this->version, $payload, $this->solution['conversationSid'], $this->solution['sid'] ); } /** * Update the WebhookInstance * * @param array|Options $options Optional Arguments * @return WebhookInstance Updated WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): WebhookInstance { $options = new Values($options); $data = Values::of([ 'Configuration.Url' => $options['configurationUrl'], 'Configuration.Method' => $options['configurationMethod'], 'Configuration.Filters' => Serialize::map($options['configurationFilters'], function($e) { return $e; }), 'Configuration.Triggers' => Serialize::map($options['configurationTriggers'], function($e) { return $e; }), 'Configuration.FlowSid' => $options['configurationFlowSid'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new WebhookInstance( $this->version, $payload, $this->solution['conversationSid'], $this->solution['sid'] ); } /** * Delete the WebhookInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.WebhookContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Conversation/ParticipantInstance.php000064400000011715150515725700022004 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'conversationSid' => Values::array_get($payload, 'conversation_sid'), 'sid' => Values::array_get($payload, 'sid'), 'identity' => Values::array_get($payload, 'identity'), 'attributes' => Values::array_get($payload, 'attributes'), 'messagingBinding' => Values::array_get($payload, 'messaging_binding'), 'roleSid' => Values::array_get($payload, 'role_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'url' => Values::array_get($payload, 'url'), 'lastReadMessageIndex' => Values::array_get($payload, 'last_read_message_index'), 'lastReadTimestamp' => Values::array_get($payload, 'last_read_timestamp'), ]; $this->solution = [ 'conversationSid' => $conversationSid, '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 ParticipantContext Context for this ParticipantInstance */ protected function proxy(): ParticipantContext { if (!$this->context) { $this->context = new ParticipantContext( $this->version, $this->solution['conversationSid'], $this->solution['sid'] ); } return $this->context; } /** * Update the ParticipantInstance * * @param array|Options $options Optional Arguments * @return ParticipantInstance Updated ParticipantInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ParticipantInstance { return $this->proxy()->update($options); } /** * Delete the ParticipantInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { return $this->proxy()->delete($options); } /** * Fetch the ParticipantInstance * * @return ParticipantInstance Fetched ParticipantInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ParticipantInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.ParticipantInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Conversation/MessagePage.php000064400000002314150515725700020215 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return MessageInstance \Twilio\Rest\Conversations\V1\Conversation\MessageInstance */ public function buildInstance(array $payload): MessageInstance { return new MessageInstance($this->version, $payload, $this->solution['conversationSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.MessagePage]'; } }src/Twilio/Rest/Conversations/V1/UserOptions.php000064400000022160150515725700015655 0ustar00options['friendlyName'] = $friendlyName; $this->options['attributes'] = $attributes; $this->options['roleSid'] = $roleSid; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The string that you assigned to describe the resource. * * @param string $friendlyName The string that you assigned to describe the * resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The JSON Object string that stores application-specific data. If attributes have not been set, `{}` is returned. * * @param string $attributes The JSON Object string that stores * application-specific data * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The SID of a service-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the user. * * @param string $roleSid The SID of a service-level Role to assign to the user * @return $this Fluent Builder */ public function setRoleSid(string $roleSid): self { $this->options['roleSid'] = $roleSid; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.CreateUserOptions ' . $options . ']'; } } class UpdateUserOptions extends Options { /** * @param string $friendlyName The string that you assigned to describe the * resource * @param string $attributes The JSON Object string that stores * application-specific data * @param string $roleSid The SID of a service-level Role to assign to the user * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header */ public function __construct(string $friendlyName = Values::NONE, string $attributes = Values::NONE, string $roleSid = Values::NONE, string $xTwilioWebhookEnabled = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['attributes'] = $attributes; $this->options['roleSid'] = $roleSid; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The string that you assigned to describe the resource. * * @param string $friendlyName The string that you assigned to describe the * resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The JSON Object string that stores application-specific data. If attributes have not been set, `{}` is returned. * * @param string $attributes The JSON Object string that stores * application-specific data * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The SID of a service-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the user. * * @param string $roleSid The SID of a service-level Role to assign to the user * @return $this Fluent Builder */ public function setRoleSid(string $roleSid): self { $this->options['roleSid'] = $roleSid; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.UpdateUserOptions ' . $options . ']'; } } class DeleteUserOptions extends Options { /** * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header */ public function __construct(string $xTwilioWebhookEnabled = Values::NONE) { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.DeleteUserOptions ' . $options . ']'; } }src/Twilio/Rest/Conversations/V1/ConversationInstance.php000064400000012723150515725700017526 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'chatServiceSid' => Values::array_get($payload, 'chat_service_sid'), 'messagingServiceSid' => Values::array_get($payload, 'messaging_service_sid'), 'sid' => Values::array_get($payload, 'sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'attributes' => Values::array_get($payload, 'attributes'), 'state' => Values::array_get($payload, 'state'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'timers' => Values::array_get($payload, 'timers'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), 'bindings' => Values::array_get($payload, 'bindings'), ]; $this->solution = ['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 ConversationContext Context for this ConversationInstance */ protected function proxy(): ConversationContext { if (!$this->context) { $this->context = new ConversationContext($this->version, $this->solution['sid']); } return $this->context; } /** * Update the ConversationInstance * * @param array|Options $options Optional Arguments * @return ConversationInstance Updated ConversationInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ConversationInstance { return $this->proxy()->update($options); } /** * Delete the ConversationInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { return $this->proxy()->delete($options); } /** * Fetch the ConversationInstance * * @return ConversationInstance Fetched ConversationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ConversationInstance { return $this->proxy()->fetch(); } /** * Access the participants */ protected function getParticipants(): ParticipantList { return $this->proxy()->participants; } /** * Access the messages */ protected function getMessages(): MessageList { return $this->proxy()->messages; } /** * Access the webhooks */ protected function getWebhooks(): WebhookList { return $this->proxy()->webhooks; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.ConversationInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/RoleContext.php000064400000004436150515725700015637 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Roles/' . \rawurlencode($sid) . ''; } /** * Update the RoleInstance * * @param string[] $permission A permission the role should have * @return RoleInstance Updated RoleInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $permission): RoleInstance { $data = Values::of(['Permission' => Serialize::map($permission, function($e) { return $e; }), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new RoleInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the RoleInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Fetch the RoleInstance * * @return RoleInstance Fetched RoleInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RoleInstance { $payload = $this->version->fetch('GET', $this->uri); return new RoleInstance($this->version, $payload, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.RoleContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/RoleInstance.php000064400000010010150515725700015740 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'chatServiceSid' => Values::array_get($payload, 'chat_service_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'type' => Values::array_get($payload, 'type'), 'permissions' => Values::array_get($payload, 'permissions'), '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 = ['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 RoleContext Context for this RoleInstance */ protected function proxy(): RoleContext { if (!$this->context) { $this->context = new RoleContext($this->version, $this->solution['sid']); } return $this->context; } /** * Update the RoleInstance * * @param string[] $permission A permission the role should have * @return RoleInstance Updated RoleInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $permission): RoleInstance { return $this->proxy()->update($permission); } /** * Delete the RoleInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Fetch the RoleInstance * * @return RoleInstance Fetched RoleInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RoleInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.RoleInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/CredentialContext.php000064400000005410150515725700017001 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Credentials/' . \rawurlencode($sid) . ''; } /** * Update the CredentialInstance * * @param array|Options $options Optional Arguments * @return CredentialInstance Updated CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): CredentialInstance { $options = new Values($options); $data = Values::of([ 'Type' => $options['type'], 'FriendlyName' => $options['friendlyName'], 'Certificate' => $options['certificate'], 'PrivateKey' => $options['privateKey'], 'Sandbox' => Serialize::booleanToString($options['sandbox']), 'ApiKey' => $options['apiKey'], 'Secret' => $options['secret'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new CredentialInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the CredentialInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Fetch the CredentialInstance * * @return CredentialInstance Fetched CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CredentialInstance { $payload = $this->version->fetch('GET', $this->uri); return new CredentialInstance($this->version, $payload, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.CredentialContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/ConfigurationList.php000064400000005034150515725700017027 0ustar00solution = []; } /** * Access the webhooks */ protected function getWebhooks(): WebhookList { if (!$this->_webhooks) { $this->_webhooks = new WebhookList($this->version); } return $this->_webhooks; } /** * Constructs a ConfigurationContext */ public function getContext(): ConfigurationContext { return new ConfigurationContext($this->version); } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return \Twilio\ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Conversations.V1.ConfigurationList]'; } }src/Twilio/Rest/Conversations/V1/Service/BindingList.php000064400000012633150515725700017175 0ustar00solution = ['chatServiceSid' => $chatServiceSid, ]; $this->uri = '/Services/' . \rawurlencode($chatServiceSid) . '/Bindings'; } /** * Streams BindingInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param array|Options $options Optional Arguments * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads BindingInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param array|Options $options Optional Arguments * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return BindingInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of BindingInstance records from the API. * Request is executed immediately * * @param array|Options $options Optional Arguments * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return BindingPage Page of BindingInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): BindingPage { $options = new Values($options); $params = Values::of([ 'BindingType' => Serialize::map($options['bindingType'], function($e) { return $e; }), 'Identity' => Serialize::map($options['identity'], function($e) { return $e; }), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new BindingPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of BindingInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return BindingPage Page of BindingInstance */ public function getPage(string $targetUrl): BindingPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new BindingPage($this->version, $response, $this->solution); } /** * Constructs a BindingContext * * @param string $sid A 34 character string that uniquely identifies this * resource. */ public function getContext(string $sid): BindingContext { return new BindingContext($this->version, $this->solution['chatServiceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.BindingList]'; } }src/Twilio/Rest/Conversations/V1/Service/ParticipantConversationOptions.php000064400000005573150515725700023221 0ustar00options['identity'] = $identity; $this->options['address'] = $address; } /** * A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. * * @param string $identity A unique string identifier for the conversation * participant as Conversation User. * @return $this Fluent Builder */ public function setIdentity(string $identity): self { $this->options['identity'] = $identity; return $this; } /** * A unique string identifier for the conversation participant who's not a Conversation User. This parameter could be found in messaging_binding.address field of Participant resource. It should be url-encoded. * * @param string $address A unique string identifier for the conversation * participant who's not a Conversation User. * @return $this Fluent Builder */ public function setAddress(string $address): self { $this->options['address'] = $address; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.ReadParticipantConversationOptions ' . $options . ']'; } }src/Twilio/Rest/Conversations/V1/Service/BindingContext.php000064400000004203150515725700017700 0ustar00solution = ['chatServiceSid' => $chatServiceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($chatServiceSid) . '/Bindings/' . \rawurlencode($sid) . ''; } /** * Delete the BindingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Fetch the BindingInstance * * @return BindingInstance Fetched BindingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): BindingInstance { $payload = $this->version->fetch('GET', $this->uri); return new BindingInstance( $this->version, $payload, $this->solution['chatServiceSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.BindingContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Service/UserPage.php000064400000002257150515725700016503 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return UserInstance \Twilio\Rest\Conversations\V1\Service\UserInstance */ public function buildInstance(array $payload): UserInstance { return new UserInstance($this->version, $payload, $this->solution['chatServiceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.UserPage]'; } }src/Twilio/Rest/Conversations/V1/Service/Configuration/NotificationPage.php000064400000002373150515725700023021 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return NotificationInstance \Twilio\Rest\Conversations\V1\Service\Configuration\NotificationInstance */ public function buildInstance(array $payload): NotificationInstance { return new NotificationInstance($this->version, $payload, $this->solution['chatServiceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.NotificationPage]'; } }src/Twilio/Rest/Conversations/V1/Service/Configuration/NotificationContext.php000064400000006744150515725700023577 0ustar00solution = ['chatServiceSid' => $chatServiceSid, ]; $this->uri = '/Services/' . \rawurlencode($chatServiceSid) . '/Configuration/Notifications'; } /** * Update the NotificationInstance * * @param array|Options $options Optional Arguments * @return NotificationInstance Updated NotificationInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): NotificationInstance { $options = new Values($options); $data = Values::of([ 'LogEnabled' => Serialize::booleanToString($options['logEnabled']), 'NewMessage.Enabled' => Serialize::booleanToString($options['newMessageEnabled']), 'NewMessage.Template' => $options['newMessageTemplate'], 'NewMessage.Sound' => $options['newMessageSound'], 'NewMessage.BadgeCountEnabled' => Serialize::booleanToString($options['newMessageBadgeCountEnabled']), 'AddedToConversation.Enabled' => Serialize::booleanToString($options['addedToConversationEnabled']), 'AddedToConversation.Template' => $options['addedToConversationTemplate'], 'AddedToConversation.Sound' => $options['addedToConversationSound'], 'RemovedFromConversation.Enabled' => Serialize::booleanToString($options['removedFromConversationEnabled']), 'RemovedFromConversation.Template' => $options['removedFromConversationTemplate'], 'RemovedFromConversation.Sound' => $options['removedFromConversationSound'], 'NewMessage.WithMedia.Enabled' => Serialize::booleanToString($options['newMessageWithMediaEnabled']), 'NewMessage.WithMedia.Template' => $options['newMessageWithMediaTemplate'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new NotificationInstance($this->version, $payload, $this->solution['chatServiceSid']); } /** * Fetch the NotificationInstance * * @return NotificationInstance Fetched NotificationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): NotificationInstance { $payload = $this->version->fetch('GET', $this->uri); return new NotificationInstance($this->version, $payload, $this->solution['chatServiceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.NotificationContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Service/Configuration/NotificationInstance.php000064400000007363150515725700023715 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'chatServiceSid' => Values::array_get($payload, 'chat_service_sid'), 'newMessage' => Values::array_get($payload, 'new_message'), 'addedToConversation' => Values::array_get($payload, 'added_to_conversation'), 'removedFromConversation' => Values::array_get($payload, 'removed_from_conversation'), 'logEnabled' => Values::array_get($payload, 'log_enabled'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['chatServiceSid' => $chatServiceSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return NotificationContext Context for this NotificationInstance */ protected function proxy(): NotificationContext { if (!$this->context) { $this->context = new NotificationContext($this->version, $this->solution['chatServiceSid']); } return $this->context; } /** * Update the NotificationInstance * * @param array|Options $options Optional Arguments * @return NotificationInstance Updated NotificationInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): NotificationInstance { return $this->proxy()->update($options); } /** * Fetch the NotificationInstance * * @return NotificationInstance Fetched NotificationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): NotificationInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.NotificationInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Service/Configuration/NotificationOptions.php000064400000041731150515725700023601 0ustar00options['logEnabled'] = $logEnabled; $this->options['newMessageEnabled'] = $newMessageEnabled; $this->options['newMessageTemplate'] = $newMessageTemplate; $this->options['newMessageSound'] = $newMessageSound; $this->options['newMessageBadgeCountEnabled'] = $newMessageBadgeCountEnabled; $this->options['addedToConversationEnabled'] = $addedToConversationEnabled; $this->options['addedToConversationTemplate'] = $addedToConversationTemplate; $this->options['addedToConversationSound'] = $addedToConversationSound; $this->options['removedFromConversationEnabled'] = $removedFromConversationEnabled; $this->options['removedFromConversationTemplate'] = $removedFromConversationTemplate; $this->options['removedFromConversationSound'] = $removedFromConversationSound; $this->options['newMessageWithMediaEnabled'] = $newMessageWithMediaEnabled; $this->options['newMessageWithMediaTemplate'] = $newMessageWithMediaTemplate; } /** * Weather the notification logging is enabled. * * @param bool $logEnabled Weather the notification logging is enabled. * @return $this Fluent Builder */ public function setLogEnabled(bool $logEnabled): self { $this->options['logEnabled'] = $logEnabled; return $this; } /** * Whether to send a notification when a new message is added to a conversation. The default is `false`. * * @param bool $newMessageEnabled Whether to send a notification when a new * message is added to a conversation. * @return $this Fluent Builder */ public function setNewMessageEnabled(bool $newMessageEnabled): self { $this->options['newMessageEnabled'] = $newMessageEnabled; return $this; } /** * The template to use to create the notification text displayed when a new message is added to a conversation and `new_message.enabled` is `true`. * * @param string $newMessageTemplate The template to use to create the * notification text displayed when a new * message is added to a conversation. * @return $this Fluent Builder */ public function setNewMessageTemplate(string $newMessageTemplate): self { $this->options['newMessageTemplate'] = $newMessageTemplate; return $this; } /** * The name of the sound to play when a new message is added to a conversation and `new_message.enabled` is `true`. * * @param string $newMessageSound The name of the sound to play when a new * message is added to a conversation. * @return $this Fluent Builder */ public function setNewMessageSound(string $newMessageSound): self { $this->options['newMessageSound'] = $newMessageSound; return $this; } /** * Whether the new message badge is enabled. The default is `false`. * * @param bool $newMessageBadgeCountEnabled Whether the new message badge is * enabled. * @return $this Fluent Builder */ public function setNewMessageBadgeCountEnabled(bool $newMessageBadgeCountEnabled): self { $this->options['newMessageBadgeCountEnabled'] = $newMessageBadgeCountEnabled; return $this; } /** * Whether to send a notification when a participant is added to a conversation. The default is `false`. * * @param bool $addedToConversationEnabled Whether to send a notification when * a participant is added to a * conversation. * @return $this Fluent Builder */ public function setAddedToConversationEnabled(bool $addedToConversationEnabled): self { $this->options['addedToConversationEnabled'] = $addedToConversationEnabled; return $this; } /** * The template to use to create the notification text displayed when a participant is added to a conversation and `added_to_conversation.enabled` is `true`. * * @param string $addedToConversationTemplate The template to use to create the * notification text displayed when * a participant is added to a * conversation. * @return $this Fluent Builder */ public function setAddedToConversationTemplate(string $addedToConversationTemplate): self { $this->options['addedToConversationTemplate'] = $addedToConversationTemplate; return $this; } /** * The name of the sound to play when a participant is added to a conversation and `added_to_conversation.enabled` is `true`. * * @param string $addedToConversationSound The name of the sound to play when a * participant is added to a * conversation. * @return $this Fluent Builder */ public function setAddedToConversationSound(string $addedToConversationSound): self { $this->options['addedToConversationSound'] = $addedToConversationSound; return $this; } /** * Whether to send a notification to a user when they are removed from a conversation. The default is `false`. * * @param bool $removedFromConversationEnabled Whether to send a notification * to a user when they are removed * from a conversation. * @return $this Fluent Builder */ public function setRemovedFromConversationEnabled(bool $removedFromConversationEnabled): self { $this->options['removedFromConversationEnabled'] = $removedFromConversationEnabled; return $this; } /** * The template to use to create the notification text displayed to a user when they are removed from a conversation and `removed_from_conversation.enabled` is `true`. * * @param string $removedFromConversationTemplate The template to use to create * the notification text * displayed to a user when they * are removed. * @return $this Fluent Builder */ public function setRemovedFromConversationTemplate(string $removedFromConversationTemplate): self { $this->options['removedFromConversationTemplate'] = $removedFromConversationTemplate; return $this; } /** * The name of the sound to play to a user when they are removed from a conversation and `removed_from_conversation.enabled` is `true`. * * @param string $removedFromConversationSound The name of the sound to play to * a user when they are removed * from a conversation. * @return $this Fluent Builder */ public function setRemovedFromConversationSound(string $removedFromConversationSound): self { $this->options['removedFromConversationSound'] = $removedFromConversationSound; return $this; } /** * Whether to send a notification when a new message with media/file attachments is added to a conversation. The default is `false`. * * @param bool $newMessageWithMediaEnabled Whether to send a notification when * a new message with media/file * attachments is added to a * conversation. * @return $this Fluent Builder */ public function setNewMessageWithMediaEnabled(bool $newMessageWithMediaEnabled): self { $this->options['newMessageWithMediaEnabled'] = $newMessageWithMediaEnabled; return $this; } /** * The template to use to create the notification text displayed when a new message with media/file attachments is added to a conversation and `new_message.attachments.enabled` is `true`. * * @param string $newMessageWithMediaTemplate The template to use to create the * notification text displayed when * a new message with media/file * attachments is added to a * conversation. * @return $this Fluent Builder */ public function setNewMessageWithMediaTemplate(string $newMessageWithMediaTemplate): self { $this->options['newMessageWithMediaTemplate'] = $newMessageWithMediaTemplate; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.UpdateNotificationOptions ' . $options . ']'; } }src/Twilio/Rest/Conversations/V1/Service/Configuration/WebhookInstance.php000064400000007153150515725700022662 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'chatServiceSid' => Values::array_get($payload, 'chat_service_sid'), 'preWebhookUrl' => Values::array_get($payload, 'pre_webhook_url'), 'postWebhookUrl' => Values::array_get($payload, 'post_webhook_url'), 'filters' => Values::array_get($payload, 'filters'), 'method' => Values::array_get($payload, 'method'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['chatServiceSid' => $chatServiceSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return WebhookContext Context for this WebhookInstance */ protected function proxy(): WebhookContext { if (!$this->context) { $this->context = new WebhookContext($this->version, $this->solution['chatServiceSid']); } return $this->context; } /** * Update the WebhookInstance * * @param array|Options $options Optional Arguments * @return WebhookInstance Updated WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): WebhookInstance { return $this->proxy()->update($options); } /** * Fetch the WebhookInstance * * @return WebhookInstance Fetched WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): WebhookInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.WebhookInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Service/Configuration/WebhookOptions.php000064400000011350150515725700022543 0ustar00options['preWebhookUrl'] = $preWebhookUrl; $this->options['postWebhookUrl'] = $postWebhookUrl; $this->options['filters'] = $filters; $this->options['method'] = $method; } /** * The absolute url the pre-event webhook request should be sent to. * * @param string $preWebhookUrl The absolute url the pre-event webhook request * should be sent to. * @return $this Fluent Builder */ public function setPreWebhookUrl(string $preWebhookUrl): self { $this->options['preWebhookUrl'] = $preWebhookUrl; return $this; } /** * The absolute url the post-event webhook request should be sent to. * * @param string $postWebhookUrl The absolute url the post-event webhook * request should be sent to. * @return $this Fluent Builder */ public function setPostWebhookUrl(string $postWebhookUrl): self { $this->options['postWebhookUrl'] = $postWebhookUrl; return $this; } /** * The list of events that your configured webhook targets will receive. Events not configured here will not fire. Possible values are `onParticipantAdd`, `onParticipantAdded`, `onDeliveryUpdated`, `onConversationUpdated`, `onConversationRemove`, `onParticipantRemove`, `onConversationUpdate`, `onMessageAdd`, `onMessageRemoved`, `onParticipantUpdated`, `onConversationAdded`, `onMessageAdded`, `onConversationAdd`, `onConversationRemoved`, `onParticipantUpdate`, `onMessageRemove`, `onMessageUpdated`, `onParticipantRemoved`, `onMessageUpdate` or `onConversationStateUpdated`. * * @param string[] $filters The list of events that your configured webhook * targets will receive. Events not configured here * will not fire. * @return $this Fluent Builder */ public function setFilters(array $filters): self { $this->options['filters'] = $filters; return $this; } /** * The HTTP method to be used when sending a webhook request. One of `GET` or `POST`. * * @param string $method The HTTP method to be used when sending a webhook * request * @return $this Fluent Builder */ public function setMethod(string $method): self { $this->options['method'] = $method; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.UpdateWebhookOptions ' . $options . ']'; } }src/Twilio/Rest/Conversations/V1/Service/Configuration/NotificationList.php000064400000002161150515725700023053 0ustar00solution = ['chatServiceSid' => $chatServiceSid, ]; } /** * Constructs a NotificationContext */ public function getContext(): NotificationContext { return new NotificationContext($this->version, $this->solution['chatServiceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.NotificationList]'; } }src/Twilio/Rest/Conversations/V1/Service/Configuration/WebhookPage.php000064400000002335150515725700021767 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return WebhookInstance \Twilio\Rest\Conversations\V1\Service\Configuration\WebhookInstance */ public function buildInstance(array $payload): WebhookInstance { return new WebhookInstance($this->version, $payload, $this->solution['chatServiceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.WebhookPage]'; } }src/Twilio/Rest/Conversations/V1/Service/Configuration/WebhookList.php000064400000002123150515725700022021 0ustar00solution = ['chatServiceSid' => $chatServiceSid, ]; } /** * Constructs a WebhookContext */ public function getContext(): WebhookContext { return new WebhookContext($this->version, $this->solution['chatServiceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.WebhookList]'; } }src/Twilio/Rest/Conversations/V1/Service/Configuration/WebhookContext.php000064400000005044150515725700022537 0ustar00solution = ['chatServiceSid' => $chatServiceSid, ]; $this->uri = '/Services/' . \rawurlencode($chatServiceSid) . '/Configuration/Webhooks'; } /** * Update the WebhookInstance * * @param array|Options $options Optional Arguments * @return WebhookInstance Updated WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): WebhookInstance { $options = new Values($options); $data = Values::of([ 'PreWebhookUrl' => $options['preWebhookUrl'], 'PostWebhookUrl' => $options['postWebhookUrl'], 'Filters' => Serialize::map($options['filters'], function($e) { return $e; }), 'Method' => $options['method'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new WebhookInstance($this->version, $payload, $this->solution['chatServiceSid']); } /** * Fetch the WebhookInstance * * @return WebhookInstance Fetched WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): WebhookInstance { $payload = $this->version->fetch('GET', $this->uri); return new WebhookInstance($this->version, $payload, $this->solution['chatServiceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.WebhookContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Service/UserContext.php000064400000011746150515725700017256 0ustar00solution = ['chatServiceSid' => $chatServiceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($chatServiceSid) . '/Users/' . \rawurlencode($sid) . ''; } /** * Update the UserInstance * * @param array|Options $options Optional Arguments * @return UserInstance Updated UserInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): UserInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'Attributes' => $options['attributes'], 'RoleSid' => $options['roleSid'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->update('POST', $this->uri, [], $data, $headers); return new UserInstance( $this->version, $payload, $this->solution['chatServiceSid'], $this->solution['sid'] ); } /** * Delete the UserInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { $options = new Values($options); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); return $this->version->delete('DELETE', $this->uri, [], [], $headers); } /** * Fetch the UserInstance * * @return UserInstance Fetched UserInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): UserInstance { $payload = $this->version->fetch('GET', $this->uri); return new UserInstance( $this->version, $payload, $this->solution['chatServiceSid'], $this->solution['sid'] ); } /** * Access the userConversations */ protected function getUserConversations(): UserConversationList { if (!$this->_userConversations) { $this->_userConversations = new UserConversationList( $this->version, $this->solution['chatServiceSid'], $this->solution['sid'] ); } return $this->_userConversations; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.UserContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Service/RoleList.php000064400000013144150515725700016522 0ustar00solution = ['chatServiceSid' => $chatServiceSid, ]; $this->uri = '/Services/' . \rawurlencode($chatServiceSid) . '/Roles'; } /** * Create the RoleInstance * * @param string $friendlyName A string to describe the new resource * @param string $type The type of role * @param string[] $permission A permission the role should have * @return RoleInstance Created RoleInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, string $type, array $permission): RoleInstance { $data = Values::of([ 'FriendlyName' => $friendlyName, 'Type' => $type, 'Permission' => Serialize::map($permission, function($e) { return $e; }), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new RoleInstance($this->version, $payload, $this->solution['chatServiceSid']); } /** * Streams RoleInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads RoleInstance 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 RoleInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of RoleInstance 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 RolePage Page of RoleInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): RolePage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new RolePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of RoleInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return RolePage Page of RoleInstance */ public function getPage(string $targetUrl): RolePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new RolePage($this->version, $response, $this->solution); } /** * Constructs a RoleContext * * @param string $sid The SID of the Role resource to fetch */ public function getContext(string $sid): RoleContext { return new RoleContext($this->version, $this->solution['chatServiceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.RoleList]'; } }src/Twilio/Rest/Conversations/V1/Service/Conversation/Message/DeliveryReceiptContext.php000064400000005033150515725700025465 0ustar00solution = [ 'chatServiceSid' => $chatServiceSid, 'conversationSid' => $conversationSid, 'messageSid' => $messageSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($chatServiceSid) . '/Conversations/' . \rawurlencode($conversationSid) . '/Messages/' . \rawurlencode($messageSid) . '/Receipts/' . \rawurlencode($sid) . ''; } /** * Fetch the DeliveryReceiptInstance * * @return DeliveryReceiptInstance Fetched DeliveryReceiptInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): DeliveryReceiptInstance { $payload = $this->version->fetch('GET', $this->uri); return new DeliveryReceiptInstance( $this->version, $payload, $this->solution['chatServiceSid'], $this->solution['conversationSid'], $this->solution['messageSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.DeliveryReceiptContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Service/Conversation/Message/DeliveryReceiptInstance.php000064400000011406150515725700025606 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'chatServiceSid' => Values::array_get($payload, 'chat_service_sid'), 'conversationSid' => Values::array_get($payload, 'conversation_sid'), 'messageSid' => Values::array_get($payload, 'message_sid'), 'sid' => Values::array_get($payload, 'sid'), 'channelMessageSid' => Values::array_get($payload, 'channel_message_sid'), 'participantSid' => Values::array_get($payload, 'participant_sid'), 'status' => Values::array_get($payload, 'status'), 'errorCode' => Values::array_get($payload, 'error_code'), '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 = [ 'chatServiceSid' => $chatServiceSid, 'conversationSid' => $conversationSid, 'messageSid' => $messageSid, '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 DeliveryReceiptContext Context for this DeliveryReceiptInstance */ protected function proxy(): DeliveryReceiptContext { if (!$this->context) { $this->context = new DeliveryReceiptContext( $this->version, $this->solution['chatServiceSid'], $this->solution['conversationSid'], $this->solution['messageSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the DeliveryReceiptInstance * * @return DeliveryReceiptInstance Fetched DeliveryReceiptInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): DeliveryReceiptInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.DeliveryReceiptInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Service/Conversation/Message/DeliveryReceiptList.php000064400000013216150515725700024756 0ustar00solution = [ 'chatServiceSid' => $chatServiceSid, 'conversationSid' => $conversationSid, 'messageSid' => $messageSid, ]; $this->uri = '/Services/' . \rawurlencode($chatServiceSid) . '/Conversations/' . \rawurlencode($conversationSid) . '/Messages/' . \rawurlencode($messageSid) . '/Receipts'; } /** * Streams DeliveryReceiptInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads DeliveryReceiptInstance 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 DeliveryReceiptInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of DeliveryReceiptInstance 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 DeliveryReceiptPage Page of DeliveryReceiptInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): DeliveryReceiptPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new DeliveryReceiptPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of DeliveryReceiptInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return DeliveryReceiptPage Page of DeliveryReceiptInstance */ public function getPage(string $targetUrl): DeliveryReceiptPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new DeliveryReceiptPage($this->version, $response, $this->solution); } /** * Constructs a DeliveryReceiptContext * * @param string $sid A 34 character string that uniquely identifies this * resource. */ public function getContext(string $sid): DeliveryReceiptContext { return new DeliveryReceiptContext( $this->version, $this->solution['chatServiceSid'], $this->solution['conversationSid'], $this->solution['messageSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.DeliveryReceiptList]'; } }src/Twilio/Rest/Conversations/V1/Service/Conversation/Message/DeliveryReceiptPage.php000064400000002644150515725700024722 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return DeliveryReceiptInstance \Twilio\Rest\Conversations\V1\Service\Conversation\Message\DeliveryReceiptInstance */ public function buildInstance(array $payload): DeliveryReceiptInstance { return new DeliveryReceiptInstance( $this->version, $payload, $this->solution['chatServiceSid'], $this->solution['conversationSid'], $this->solution['messageSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.DeliveryReceiptPage]'; } }src/Twilio/Rest/Conversations/V1/Service/Conversation/ParticipantContext.php000064400000010310150515725700023252 0ustar00solution = [ 'chatServiceSid' => $chatServiceSid, 'conversationSid' => $conversationSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($chatServiceSid) . '/Conversations/' . \rawurlencode($conversationSid) . '/Participants/' . \rawurlencode($sid) . ''; } /** * Update the ParticipantInstance * * @param array|Options $options Optional Arguments * @return ParticipantInstance Updated ParticipantInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ParticipantInstance { $options = new Values($options); $data = Values::of([ 'DateCreated' => Serialize::iso8601DateTime($options['dateCreated']), 'DateUpdated' => Serialize::iso8601DateTime($options['dateUpdated']), 'Identity' => $options['identity'], 'Attributes' => $options['attributes'], 'RoleSid' => $options['roleSid'], 'MessagingBinding.ProxyAddress' => $options['messagingBindingProxyAddress'], 'MessagingBinding.ProjectedAddress' => $options['messagingBindingProjectedAddress'], 'LastReadMessageIndex' => $options['lastReadMessageIndex'], 'LastReadTimestamp' => $options['lastReadTimestamp'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->update('POST', $this->uri, [], $data, $headers); return new ParticipantInstance( $this->version, $payload, $this->solution['chatServiceSid'], $this->solution['conversationSid'], $this->solution['sid'] ); } /** * Delete the ParticipantInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { $options = new Values($options); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); return $this->version->delete('DELETE', $this->uri, [], [], $headers); } /** * Fetch the ParticipantInstance * * @return ParticipantInstance Fetched ParticipantInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ParticipantInstance { $payload = $this->version->fetch('GET', $this->uri); return new ParticipantInstance( $this->version, $payload, $this->solution['chatServiceSid'], $this->solution['conversationSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.ParticipantContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Service/Conversation/ParticipantPage.php000064400000002521150515725700022507 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ParticipantInstance \Twilio\Rest\Conversations\V1\Service\Conversation\ParticipantInstance */ public function buildInstance(array $payload): ParticipantInstance { return new ParticipantInstance( $this->version, $payload, $this->solution['chatServiceSid'], $this->solution['conversationSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.ParticipantPage]'; } }src/Twilio/Rest/Conversations/V1/Service/Conversation/ParticipantList.php000064400000015260150515725700022552 0ustar00solution = ['chatServiceSid' => $chatServiceSid, 'conversationSid' => $conversationSid, ]; $this->uri = '/Services/' . \rawurlencode($chatServiceSid) . '/Conversations/' . \rawurlencode($conversationSid) . '/Participants'; } /** * Create the ParticipantInstance * * @param array|Options $options Optional Arguments * @return ParticipantInstance Created ParticipantInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): ParticipantInstance { $options = new Values($options); $data = Values::of([ 'Identity' => $options['identity'], 'MessagingBinding.Address' => $options['messagingBindingAddress'], 'MessagingBinding.ProxyAddress' => $options['messagingBindingProxyAddress'], 'DateCreated' => Serialize::iso8601DateTime($options['dateCreated']), 'DateUpdated' => Serialize::iso8601DateTime($options['dateUpdated']), 'Attributes' => $options['attributes'], 'MessagingBinding.ProjectedAddress' => $options['messagingBindingProjectedAddress'], 'RoleSid' => $options['roleSid'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->create('POST', $this->uri, [], $data, $headers); return new ParticipantInstance( $this->version, $payload, $this->solution['chatServiceSid'], $this->solution['conversationSid'] ); } /** * Streams ParticipantInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ParticipantInstance 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 ParticipantInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of ParticipantInstance 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 ParticipantPage Page of ParticipantInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ParticipantPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ParticipantPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ParticipantInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ParticipantPage Page of ParticipantInstance */ public function getPage(string $targetUrl): ParticipantPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ParticipantPage($this->version, $response, $this->solution); } /** * Constructs a ParticipantContext * * @param string $sid A 34 character string that uniquely identifies this * resource. */ public function getContext(string $sid): ParticipantContext { return new ParticipantContext( $this->version, $this->solution['chatServiceSid'], $this->solution['conversationSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.ParticipantList]'; } }src/Twilio/Rest/Conversations/V1/Service/Conversation/WebhookInstance.php000064400000011352150515725700022521 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'chatServiceSid' => Values::array_get($payload, 'chat_service_sid'), 'conversationSid' => Values::array_get($payload, 'conversation_sid'), 'target' => Values::array_get($payload, 'target'), 'url' => Values::array_get($payload, 'url'), 'configuration' => Values::array_get($payload, 'configuration'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), ]; $this->solution = [ 'chatServiceSid' => $chatServiceSid, 'conversationSid' => $conversationSid, '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 WebhookContext Context for this WebhookInstance */ protected function proxy(): WebhookContext { if (!$this->context) { $this->context = new WebhookContext( $this->version, $this->solution['chatServiceSid'], $this->solution['conversationSid'], $this->solution['sid'] ); } return $this->context; } /** * Update the WebhookInstance * * @param array|Options $options Optional Arguments * @return WebhookInstance Updated WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): WebhookInstance { return $this->proxy()->update($options); } /** * Delete the WebhookInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Fetch the WebhookInstance * * @return WebhookInstance Fetched WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): WebhookInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.WebhookInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Service/Conversation/MessageInstance.php000064400000013210150515725700022502 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'chatServiceSid' => Values::array_get($payload, 'chat_service_sid'), 'conversationSid' => Values::array_get($payload, 'conversation_sid'), 'sid' => Values::array_get($payload, 'sid'), 'index' => Values::array_get($payload, 'index'), 'author' => Values::array_get($payload, 'author'), 'body' => Values::array_get($payload, 'body'), 'media' => Values::array_get($payload, 'media'), 'attributes' => Values::array_get($payload, 'attributes'), 'participantSid' => Values::array_get($payload, 'participant_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'delivery' => Values::array_get($payload, 'delivery'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = [ 'chatServiceSid' => $chatServiceSid, 'conversationSid' => $conversationSid, '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 MessageContext Context for this MessageInstance */ protected function proxy(): MessageContext { if (!$this->context) { $this->context = new MessageContext( $this->version, $this->solution['chatServiceSid'], $this->solution['conversationSid'], $this->solution['sid'] ); } return $this->context; } /** * Update the MessageInstance * * @param array|Options $options Optional Arguments * @return MessageInstance Updated MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): MessageInstance { return $this->proxy()->update($options); } /** * Delete the MessageInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { return $this->proxy()->delete($options); } /** * Fetch the MessageInstance * * @return MessageInstance Fetched MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MessageInstance { return $this->proxy()->fetch(); } /** * Access the deliveryReceipts */ protected function getDeliveryReceipts(): DeliveryReceiptList { return $this->proxy()->deliveryReceipts; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.MessageInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Service/Conversation/WebhookOptions.php000064400000027055150515725700022417 0ustar00options['configurationUrl'] = $configurationUrl; $this->options['configurationMethod'] = $configurationMethod; $this->options['configurationFilters'] = $configurationFilters; $this->options['configurationTriggers'] = $configurationTriggers; $this->options['configurationFlowSid'] = $configurationFlowSid; $this->options['configurationReplayAfter'] = $configurationReplayAfter; } /** * The absolute url the webhook request should be sent to. * * @param string $configurationUrl The absolute url the webhook request should * be sent to. * @return $this Fluent Builder */ public function setConfigurationUrl(string $configurationUrl): self { $this->options['configurationUrl'] = $configurationUrl; return $this; } /** * The HTTP method to be used when sending a webhook request. * * @param string $configurationMethod The HTTP method to be used when sending a * webhook request. * @return $this Fluent Builder */ public function setConfigurationMethod(string $configurationMethod): self { $this->options['configurationMethod'] = $configurationMethod; return $this; } /** * The list of events, firing webhook event for this Conversation. * * @param string[] $configurationFilters The list of events, firing webhook * event for this Conversation. * @return $this Fluent Builder */ public function setConfigurationFilters(array $configurationFilters): self { $this->options['configurationFilters'] = $configurationFilters; return $this; } /** * The list of keywords, firing webhook event for this Conversation. * * @param string[] $configurationTriggers The list of keywords, firing webhook * event for this Conversation. * @return $this Fluent Builder */ public function setConfigurationTriggers(array $configurationTriggers): self { $this->options['configurationTriggers'] = $configurationTriggers; return $this; } /** * The studio flow SID, where the webhook should be sent to. * * @param string $configurationFlowSid The studio flow SID, where the webhook * should be sent to. * @return $this Fluent Builder */ public function setConfigurationFlowSid(string $configurationFlowSid): self { $this->options['configurationFlowSid'] = $configurationFlowSid; return $this; } /** * The message index for which and it's successors the webhook will be replayed. Not set by default * * @param int $configurationReplayAfter The message index for which and it's * successors the webhook will be replayed. * @return $this Fluent Builder */ public function setConfigurationReplayAfter(int $configurationReplayAfter): self { $this->options['configurationReplayAfter'] = $configurationReplayAfter; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.CreateWebhookOptions ' . $options . ']'; } } class UpdateWebhookOptions extends Options { /** * @param string $configurationUrl The absolute url the webhook request should * be sent to. * @param string $configurationMethod The HTTP method to be used when sending a * webhook request. * @param string[] $configurationFilters The list of events, firing webhook * event for this Conversation. * @param string[] $configurationTriggers The list of keywords, firing webhook * event for this Conversation. * @param string $configurationFlowSid The studio flow SID, where the webhook * should be sent to. */ public function __construct(string $configurationUrl = Values::NONE, string $configurationMethod = Values::NONE, array $configurationFilters = Values::ARRAY_NONE, array $configurationTriggers = Values::ARRAY_NONE, string $configurationFlowSid = Values::NONE) { $this->options['configurationUrl'] = $configurationUrl; $this->options['configurationMethod'] = $configurationMethod; $this->options['configurationFilters'] = $configurationFilters; $this->options['configurationTriggers'] = $configurationTriggers; $this->options['configurationFlowSid'] = $configurationFlowSid; } /** * The absolute url the webhook request should be sent to. * * @param string $configurationUrl The absolute url the webhook request should * be sent to. * @return $this Fluent Builder */ public function setConfigurationUrl(string $configurationUrl): self { $this->options['configurationUrl'] = $configurationUrl; return $this; } /** * The HTTP method to be used when sending a webhook request. * * @param string $configurationMethod The HTTP method to be used when sending a * webhook request. * @return $this Fluent Builder */ public function setConfigurationMethod(string $configurationMethod): self { $this->options['configurationMethod'] = $configurationMethod; return $this; } /** * The list of events, firing webhook event for this Conversation. * * @param string[] $configurationFilters The list of events, firing webhook * event for this Conversation. * @return $this Fluent Builder */ public function setConfigurationFilters(array $configurationFilters): self { $this->options['configurationFilters'] = $configurationFilters; return $this; } /** * The list of keywords, firing webhook event for this Conversation. * * @param string[] $configurationTriggers The list of keywords, firing webhook * event for this Conversation. * @return $this Fluent Builder */ public function setConfigurationTriggers(array $configurationTriggers): self { $this->options['configurationTriggers'] = $configurationTriggers; return $this; } /** * The studio flow SID, where the webhook should be sent to. * * @param string $configurationFlowSid The studio flow SID, where the webhook * should be sent to. * @return $this Fluent Builder */ public function setConfigurationFlowSid(string $configurationFlowSid): self { $this->options['configurationFlowSid'] = $configurationFlowSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.UpdateWebhookOptions ' . $options . ']'; } }src/Twilio/Rest/Conversations/V1/Service/Conversation/MessageList.php000064400000015341150515725700021660 0ustar00solution = ['chatServiceSid' => $chatServiceSid, 'conversationSid' => $conversationSid, ]; $this->uri = '/Services/' . \rawurlencode($chatServiceSid) . '/Conversations/' . \rawurlencode($conversationSid) . '/Messages'; } /** * Create the MessageInstance * * @param array|Options $options Optional Arguments * @return MessageInstance Created MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): MessageInstance { $options = new Values($options); $data = Values::of([ 'Author' => $options['author'], 'Body' => $options['body'], 'DateCreated' => Serialize::iso8601DateTime($options['dateCreated']), 'DateUpdated' => Serialize::iso8601DateTime($options['dateUpdated']), 'Attributes' => $options['attributes'], 'MediaSid' => $options['mediaSid'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->create('POST', $this->uri, [], $data, $headers); return new MessageInstance( $this->version, $payload, $this->solution['chatServiceSid'], $this->solution['conversationSid'] ); } /** * Streams MessageInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads MessageInstance 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 MessageInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of MessageInstance 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 MessagePage Page of MessageInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): MessagePage { $options = new Values($options); $params = Values::of([ 'Order' => $options['order'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new MessagePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of MessageInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return MessagePage Page of MessageInstance */ public function getPage(string $targetUrl): MessagePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new MessagePage($this->version, $response, $this->solution); } /** * Constructs a MessageContext * * @param string $sid A 34 character string that uniquely identifies this * resource. */ public function getContext(string $sid): MessageContext { return new MessageContext( $this->version, $this->solution['chatServiceSid'], $this->solution['conversationSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.MessageList]'; } }src/Twilio/Rest/Conversations/V1/Service/Conversation/MessageContext.php000064400000013274150515725700022374 0ustar00solution = [ 'chatServiceSid' => $chatServiceSid, 'conversationSid' => $conversationSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($chatServiceSid) . '/Conversations/' . \rawurlencode($conversationSid) . '/Messages/' . \rawurlencode($sid) . ''; } /** * Update the MessageInstance * * @param array|Options $options Optional Arguments * @return MessageInstance Updated MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): MessageInstance { $options = new Values($options); $data = Values::of([ 'Author' => $options['author'], 'Body' => $options['body'], 'DateCreated' => Serialize::iso8601DateTime($options['dateCreated']), 'DateUpdated' => Serialize::iso8601DateTime($options['dateUpdated']), 'Attributes' => $options['attributes'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->update('POST', $this->uri, [], $data, $headers); return new MessageInstance( $this->version, $payload, $this->solution['chatServiceSid'], $this->solution['conversationSid'], $this->solution['sid'] ); } /** * Delete the MessageInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { $options = new Values($options); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); return $this->version->delete('DELETE', $this->uri, [], [], $headers); } /** * Fetch the MessageInstance * * @return MessageInstance Fetched MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MessageInstance { $payload = $this->version->fetch('GET', $this->uri); return new MessageInstance( $this->version, $payload, $this->solution['chatServiceSid'], $this->solution['conversationSid'], $this->solution['sid'] ); } /** * Access the deliveryReceipts */ protected function getDeliveryReceipts(): DeliveryReceiptList { if (!$this->_deliveryReceipts) { $this->_deliveryReceipts = new DeliveryReceiptList( $this->version, $this->solution['chatServiceSid'], $this->solution['conversationSid'], $this->solution['sid'] ); } return $this->_deliveryReceipts; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.MessageContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Service/Conversation/MessageOptions.php000064400000032510150515725700022375 0ustar00options['author'] = $author; $this->options['body'] = $body; $this->options['dateCreated'] = $dateCreated; $this->options['dateUpdated'] = $dateUpdated; $this->options['attributes'] = $attributes; $this->options['mediaSid'] = $mediaSid; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The channel specific identifier of the message's author. Defaults to `system`. * * @param string $author The channel specific identifier of the message's * author. * @return $this Fluent Builder */ public function setAuthor(string $author): self { $this->options['author'] = $author; return $this; } /** * The content of the message, can be up to 1,600 characters long. * * @param string $body The content of the message. * @return $this Fluent Builder */ public function setBody(string $body): self { $this->options['body'] = $body; return $this; } /** * The date that this resource was created. * * @param \DateTime $dateCreated The date that this resource was created. * @return $this Fluent Builder */ public function setDateCreated(\DateTime $dateCreated): self { $this->options['dateCreated'] = $dateCreated; return $this; } /** * The date that this resource was last updated. `null` if the message has not been edited. * * @param \DateTime $dateUpdated The date that this resource was last updated. * @return $this Fluent Builder */ public function setDateUpdated(\DateTime $dateUpdated): self { $this->options['dateUpdated'] = $dateUpdated; return $this; } /** * A string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set "{}" will be returned. * * @param string $attributes A string metadata field you can use to store any * data you wish. * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The Media SID to be attached to the new Message. * * @param string $mediaSid The Media SID to be attached to the new Message. * @return $this Fluent Builder */ public function setMediaSid(string $mediaSid): self { $this->options['mediaSid'] = $mediaSid; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.CreateMessageOptions ' . $options . ']'; } } class UpdateMessageOptions extends Options { /** * @param string $author The channel specific identifier of the message's * author. * @param string $body The content of the message. * @param \DateTime $dateCreated The date that this resource was created. * @param \DateTime $dateUpdated The date that this resource was last updated. * @param string $attributes A string metadata field you can use to store any * data you wish. * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header */ public function __construct(string $author = Values::NONE, string $body = Values::NONE, \DateTime $dateCreated = Values::NONE, \DateTime $dateUpdated = Values::NONE, string $attributes = Values::NONE, string $xTwilioWebhookEnabled = Values::NONE) { $this->options['author'] = $author; $this->options['body'] = $body; $this->options['dateCreated'] = $dateCreated; $this->options['dateUpdated'] = $dateUpdated; $this->options['attributes'] = $attributes; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The channel specific identifier of the message's author. Defaults to `system`. * * @param string $author The channel specific identifier of the message's * author. * @return $this Fluent Builder */ public function setAuthor(string $author): self { $this->options['author'] = $author; return $this; } /** * The content of the message, can be up to 1,600 characters long. * * @param string $body The content of the message. * @return $this Fluent Builder */ public function setBody(string $body): self { $this->options['body'] = $body; return $this; } /** * The date that this resource was created. * * @param \DateTime $dateCreated The date that this resource was created. * @return $this Fluent Builder */ public function setDateCreated(\DateTime $dateCreated): self { $this->options['dateCreated'] = $dateCreated; return $this; } /** * The date that this resource was last updated. `null` if the message has not been edited. * * @param \DateTime $dateUpdated The date that this resource was last updated. * @return $this Fluent Builder */ public function setDateUpdated(\DateTime $dateUpdated): self { $this->options['dateUpdated'] = $dateUpdated; return $this; } /** * A string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set "{}" will be returned. * * @param string $attributes A string metadata field you can use to store any * data you wish. * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.UpdateMessageOptions ' . $options . ']'; } } class DeleteMessageOptions extends Options { /** * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header */ public function __construct(string $xTwilioWebhookEnabled = Values::NONE) { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.DeleteMessageOptions ' . $options . ']'; } } class ReadMessageOptions extends Options { /** * @param string $order The sort order of the returned messages */ public function __construct(string $order = Values::NONE) { $this->options['order'] = $order; } /** * The sort order of the returned messages. Can be: `asc` (ascending) or `desc` (descending), with `asc` as the default. * * @param string $order The sort order of the returned messages * @return $this Fluent Builder */ public function setOrder(string $order): self { $this->options['order'] = $order; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.ReadMessageOptions ' . $options . ']'; } }src/Twilio/Rest/Conversations/V1/Service/Conversation/WebhookPage.php000064400000002471150515725700021633 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return WebhookInstance \Twilio\Rest\Conversations\V1\Service\Conversation\WebhookInstance */ public function buildInstance(array $payload): WebhookInstance { return new WebhookInstance( $this->version, $payload, $this->solution['chatServiceSid'], $this->solution['conversationSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.WebhookPage]'; } }src/Twilio/Rest/Conversations/V1/Service/Conversation/WebhookList.php000064400000015025150515725700021671 0ustar00solution = ['chatServiceSid' => $chatServiceSid, 'conversationSid' => $conversationSid, ]; $this->uri = '/Services/' . \rawurlencode($chatServiceSid) . '/Conversations/' . \rawurlencode($conversationSid) . '/Webhooks'; } /** * Create the WebhookInstance * * @param string $target The target of this webhook. * @param array|Options $options Optional Arguments * @return WebhookInstance Created WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $target, array $options = []): WebhookInstance { $options = new Values($options); $data = Values::of([ 'Target' => $target, 'Configuration.Url' => $options['configurationUrl'], 'Configuration.Method' => $options['configurationMethod'], 'Configuration.Filters' => Serialize::map($options['configurationFilters'], function($e) { return $e; }), 'Configuration.Triggers' => Serialize::map($options['configurationTriggers'], function($e) { return $e; }), 'Configuration.FlowSid' => $options['configurationFlowSid'], 'Configuration.ReplayAfter' => $options['configurationReplayAfter'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new WebhookInstance( $this->version, $payload, $this->solution['chatServiceSid'], $this->solution['conversationSid'] ); } /** * Streams WebhookInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads WebhookInstance 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 WebhookInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of WebhookInstance 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 WebhookPage Page of WebhookInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): WebhookPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new WebhookPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of WebhookInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return WebhookPage Page of WebhookInstance */ public function getPage(string $targetUrl): WebhookPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new WebhookPage($this->version, $response, $this->solution); } /** * Constructs a WebhookContext * * @param string $sid A 34 character string that uniquely identifies this * resource. */ public function getContext(string $sid): WebhookContext { return new WebhookContext( $this->version, $this->solution['chatServiceSid'], $this->solution['conversationSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.WebhookList]'; } }src/Twilio/Rest/Conversations/V1/Service/Conversation/ParticipantOptions.php000064400000052371150515725700023276 0ustar00options['identity'] = $identity; $this->options['messagingBindingAddress'] = $messagingBindingAddress; $this->options['messagingBindingProxyAddress'] = $messagingBindingProxyAddress; $this->options['dateCreated'] = $dateCreated; $this->options['dateUpdated'] = $dateUpdated; $this->options['attributes'] = $attributes; $this->options['messagingBindingProjectedAddress'] = $messagingBindingProjectedAddress; $this->options['roleSid'] = $roleSid; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversation SDK to communicate. Limited to 256 characters. * * @param string $identity A unique string identifier for the conversation * participant as Conversation User. * @return $this Fluent Builder */ public function setIdentity(string $identity): self { $this->options['identity'] = $identity; return $this; } /** * The address of the participant's device, e.g. a phone or WhatsApp number. Together with the Proxy address, this determines a participant uniquely. This field (with proxy_address) is only null when the participant is interacting from an SDK endpoint (see the 'identity' field). * * @param string $messagingBindingAddress The address of the participant's * device. * @return $this Fluent Builder */ public function setMessagingBindingAddress(string $messagingBindingAddress): self { $this->options['messagingBindingAddress'] = $messagingBindingAddress; return $this; } /** * The address of the Twilio phone number (or WhatsApp number) that the participant is in contact with. This field, together with participant address, is only null when the participant is interacting from an SDK endpoint (see the 'identity' field). * * @param string $messagingBindingProxyAddress The address of the Twilio phone * number that the participant is * in contact with. * @return $this Fluent Builder */ public function setMessagingBindingProxyAddress(string $messagingBindingProxyAddress): self { $this->options['messagingBindingProxyAddress'] = $messagingBindingProxyAddress; return $this; } /** * The date that this resource was created. * * @param \DateTime $dateCreated The date that this resource was created. * @return $this Fluent Builder */ public function setDateCreated(\DateTime $dateCreated): self { $this->options['dateCreated'] = $dateCreated; return $this; } /** * The date that this resource was last updated. * * @param \DateTime $dateUpdated The date that this resource was last updated. * @return $this Fluent Builder */ public function setDateUpdated(\DateTime $dateUpdated): self { $this->options['dateUpdated'] = $dateUpdated; return $this; } /** * An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set "{}" will be returned. * * @param string $attributes An optional string metadata field you can use to * store any data you wish. * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The address of the Twilio phone number that is used in Group MMS. Communication mask for the Conversation participant with Identity. * * @param string $messagingBindingProjectedAddress The address of the Twilio * phone number that is used in * Group MMS. * @return $this Fluent Builder */ public function setMessagingBindingProjectedAddress(string $messagingBindingProjectedAddress): self { $this->options['messagingBindingProjectedAddress'] = $messagingBindingProjectedAddress; return $this; } /** * The SID of a conversation-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the participant. * * @param string $roleSid The SID of a conversation-level Role to assign to the * participant * @return $this Fluent Builder */ public function setRoleSid(string $roleSid): self { $this->options['roleSid'] = $roleSid; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.CreateParticipantOptions ' . $options . ']'; } } class UpdateParticipantOptions extends Options { /** * @param \DateTime $dateCreated The date that this resource was created. * @param \DateTime $dateUpdated The date that this resource was last updated. * @param string $identity A unique string identifier for the conversation * participant as Conversation User. * @param string $attributes An optional string metadata field you can use to * store any data you wish. * @param string $roleSid The SID of a conversation-level Role to assign to the * participant * @param string $messagingBindingProxyAddress The address of the Twilio phone * number that the participant is * in contact with. * @param string $messagingBindingProjectedAddress The address of the Twilio * phone number that is used in * Group MMS. * @param int $lastReadMessageIndex Index of last “read” message in the * Conversation for the Participant. * @param string $lastReadTimestamp Timestamp of last “read” message in the * Conversation for the Participant. * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header */ public function __construct(\DateTime $dateCreated = Values::NONE, \DateTime $dateUpdated = Values::NONE, string $identity = Values::NONE, string $attributes = Values::NONE, string $roleSid = Values::NONE, string $messagingBindingProxyAddress = Values::NONE, string $messagingBindingProjectedAddress = Values::NONE, int $lastReadMessageIndex = Values::NONE, string $lastReadTimestamp = Values::NONE, string $xTwilioWebhookEnabled = Values::NONE) { $this->options['dateCreated'] = $dateCreated; $this->options['dateUpdated'] = $dateUpdated; $this->options['identity'] = $identity; $this->options['attributes'] = $attributes; $this->options['roleSid'] = $roleSid; $this->options['messagingBindingProxyAddress'] = $messagingBindingProxyAddress; $this->options['messagingBindingProjectedAddress'] = $messagingBindingProjectedAddress; $this->options['lastReadMessageIndex'] = $lastReadMessageIndex; $this->options['lastReadTimestamp'] = $lastReadTimestamp; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The date that this resource was created. * * @param \DateTime $dateCreated The date that this resource was created. * @return $this Fluent Builder */ public function setDateCreated(\DateTime $dateCreated): self { $this->options['dateCreated'] = $dateCreated; return $this; } /** * The date that this resource was last updated. * * @param \DateTime $dateUpdated The date that this resource was last updated. * @return $this Fluent Builder */ public function setDateUpdated(\DateTime $dateUpdated): self { $this->options['dateUpdated'] = $dateUpdated; return $this; } /** * A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversation SDK to communicate. Limited to 256 characters. * * @param string $identity A unique string identifier for the conversation * participant as Conversation User. * @return $this Fluent Builder */ public function setIdentity(string $identity): self { $this->options['identity'] = $identity; return $this; } /** * An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set "{}" will be returned. * * @param string $attributes An optional string metadata field you can use to * store any data you wish. * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The SID of a conversation-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the participant. * * @param string $roleSid The SID of a conversation-level Role to assign to the * participant * @return $this Fluent Builder */ public function setRoleSid(string $roleSid): self { $this->options['roleSid'] = $roleSid; return $this; } /** * The address of the Twilio phone number that the participant is in contact with. 'null' value will remove it. * * @param string $messagingBindingProxyAddress The address of the Twilio phone * number that the participant is * in contact with. * @return $this Fluent Builder */ public function setMessagingBindingProxyAddress(string $messagingBindingProxyAddress): self { $this->options['messagingBindingProxyAddress'] = $messagingBindingProxyAddress; return $this; } /** * The address of the Twilio phone number that is used in Group MMS. 'null' value will remove it. * * @param string $messagingBindingProjectedAddress The address of the Twilio * phone number that is used in * Group MMS. * @return $this Fluent Builder */ public function setMessagingBindingProjectedAddress(string $messagingBindingProjectedAddress): self { $this->options['messagingBindingProjectedAddress'] = $messagingBindingProjectedAddress; return $this; } /** * Index of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. * * @param int $lastReadMessageIndex Index of last “read” message in the * Conversation for the Participant. * @return $this Fluent Builder */ public function setLastReadMessageIndex(int $lastReadMessageIndex): self { $this->options['lastReadMessageIndex'] = $lastReadMessageIndex; return $this; } /** * Timestamp of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. * * @param string $lastReadTimestamp Timestamp of last “read” message in the * Conversation for the Participant. * @return $this Fluent Builder */ public function setLastReadTimestamp(string $lastReadTimestamp): self { $this->options['lastReadTimestamp'] = $lastReadTimestamp; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.UpdateParticipantOptions ' . $options . ']'; } } class DeleteParticipantOptions extends Options { /** * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header */ public function __construct(string $xTwilioWebhookEnabled = Values::NONE) { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.DeleteParticipantOptions ' . $options . ']'; } }src/Twilio/Rest/Conversations/V1/Service/Conversation/WebhookContext.php000064400000007163150515725700022406 0ustar00solution = [ 'chatServiceSid' => $chatServiceSid, 'conversationSid' => $conversationSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($chatServiceSid) . '/Conversations/' . \rawurlencode($conversationSid) . '/Webhooks/' . \rawurlencode($sid) . ''; } /** * Update the WebhookInstance * * @param array|Options $options Optional Arguments * @return WebhookInstance Updated WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): WebhookInstance { $options = new Values($options); $data = Values::of([ 'Configuration.Url' => $options['configurationUrl'], 'Configuration.Method' => $options['configurationMethod'], 'Configuration.Filters' => Serialize::map($options['configurationFilters'], function($e) { return $e; }), 'Configuration.Triggers' => Serialize::map($options['configurationTriggers'], function($e) { return $e; }), 'Configuration.FlowSid' => $options['configurationFlowSid'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new WebhookInstance( $this->version, $payload, $this->solution['chatServiceSid'], $this->solution['conversationSid'], $this->solution['sid'] ); } /** * Delete the WebhookInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Fetch the WebhookInstance * * @return WebhookInstance Fetched WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): WebhookInstance { $payload = $this->version->fetch('GET', $this->uri); return new WebhookInstance( $this->version, $payload, $this->solution['chatServiceSid'], $this->solution['conversationSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.WebhookContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Service/Conversation/ParticipantInstance.php000064400000012532150515725700023402 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'chatServiceSid' => Values::array_get($payload, 'chat_service_sid'), 'conversationSid' => Values::array_get($payload, 'conversation_sid'), 'sid' => Values::array_get($payload, 'sid'), 'identity' => Values::array_get($payload, 'identity'), 'attributes' => Values::array_get($payload, 'attributes'), 'messagingBinding' => Values::array_get($payload, 'messaging_binding'), 'roleSid' => Values::array_get($payload, 'role_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'url' => Values::array_get($payload, 'url'), 'lastReadMessageIndex' => Values::array_get($payload, 'last_read_message_index'), 'lastReadTimestamp' => Values::array_get($payload, 'last_read_timestamp'), ]; $this->solution = [ 'chatServiceSid' => $chatServiceSid, 'conversationSid' => $conversationSid, '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 ParticipantContext Context for this ParticipantInstance */ protected function proxy(): ParticipantContext { if (!$this->context) { $this->context = new ParticipantContext( $this->version, $this->solution['chatServiceSid'], $this->solution['conversationSid'], $this->solution['sid'] ); } return $this->context; } /** * Update the ParticipantInstance * * @param array|Options $options Optional Arguments * @return ParticipantInstance Updated ParticipantInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ParticipantInstance { return $this->proxy()->update($options); } /** * Delete the ParticipantInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { return $this->proxy()->delete($options); } /** * Fetch the ParticipantInstance * * @return ParticipantInstance Fetched ParticipantInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ParticipantInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.ParticipantInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Service/Conversation/MessagePage.php000064400000002471150515725700021621 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return MessageInstance \Twilio\Rest\Conversations\V1\Service\Conversation\MessageInstance */ public function buildInstance(array $payload): MessageInstance { return new MessageInstance( $this->version, $payload, $this->solution['chatServiceSid'], $this->solution['conversationSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.MessagePage]'; } }src/Twilio/Rest/Conversations/V1/Service/UserOptions.php000064400000022170150515725700017256 0ustar00options['friendlyName'] = $friendlyName; $this->options['attributes'] = $attributes; $this->options['roleSid'] = $roleSid; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The string that you assigned to describe the resource. * * @param string $friendlyName The string that you assigned to describe the * resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The JSON Object string that stores application-specific data. If attributes have not been set, `{}` is returned. * * @param string $attributes The JSON Object string that stores * application-specific data * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The SID of a service-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the user. * * @param string $roleSid The SID of a service-level Role to assign to the user * @return $this Fluent Builder */ public function setRoleSid(string $roleSid): self { $this->options['roleSid'] = $roleSid; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.CreateUserOptions ' . $options . ']'; } } class UpdateUserOptions extends Options { /** * @param string $friendlyName The string that you assigned to describe the * resource * @param string $attributes The JSON Object string that stores * application-specific data * @param string $roleSid The SID of a service-level Role to assign to the user * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header */ public function __construct(string $friendlyName = Values::NONE, string $attributes = Values::NONE, string $roleSid = Values::NONE, string $xTwilioWebhookEnabled = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['attributes'] = $attributes; $this->options['roleSid'] = $roleSid; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The string that you assigned to describe the resource. * * @param string $friendlyName The string that you assigned to describe the * resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The JSON Object string that stores application-specific data. If attributes have not been set, `{}` is returned. * * @param string $attributes The JSON Object string that stores * application-specific data * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The SID of a service-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the user. * * @param string $roleSid The SID of a service-level Role to assign to the user * @return $this Fluent Builder */ public function setRoleSid(string $roleSid): self { $this->options['roleSid'] = $roleSid; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.UpdateUserOptions ' . $options . ']'; } } class DeleteUserOptions extends Options { /** * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header */ public function __construct(string $xTwilioWebhookEnabled = Values::NONE) { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.DeleteUserOptions ' . $options . ']'; } }src/Twilio/Rest/Conversations/V1/Service/ConversationInstance.php000064400000013443150515725700021126 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'chatServiceSid' => Values::array_get($payload, 'chat_service_sid'), 'messagingServiceSid' => Values::array_get($payload, 'messaging_service_sid'), 'sid' => Values::array_get($payload, 'sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'attributes' => Values::array_get($payload, 'attributes'), 'state' => Values::array_get($payload, 'state'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'timers' => Values::array_get($payload, 'timers'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), 'bindings' => Values::array_get($payload, 'bindings'), ]; $this->solution = ['chatServiceSid' => $chatServiceSid, '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 ConversationContext Context for this ConversationInstance */ protected function proxy(): ConversationContext { if (!$this->context) { $this->context = new ConversationContext( $this->version, $this->solution['chatServiceSid'], $this->solution['sid'] ); } return $this->context; } /** * Update the ConversationInstance * * @param array|Options $options Optional Arguments * @return ConversationInstance Updated ConversationInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ConversationInstance { return $this->proxy()->update($options); } /** * Delete the ConversationInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { return $this->proxy()->delete($options); } /** * Fetch the ConversationInstance * * @return ConversationInstance Fetched ConversationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ConversationInstance { return $this->proxy()->fetch(); } /** * Access the participants */ protected function getParticipants(): ParticipantList { return $this->proxy()->participants; } /** * Access the messages */ protected function getMessages(): MessageList { return $this->proxy()->messages; } /** * Access the webhooks */ protected function getWebhooks(): WebhookList { return $this->proxy()->webhooks; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.ConversationInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Service/RoleContext.php000064400000005317150515725700017236 0ustar00solution = ['chatServiceSid' => $chatServiceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($chatServiceSid) . '/Roles/' . \rawurlencode($sid) . ''; } /** * Update the RoleInstance * * @param string[] $permission A permission the role should have * @return RoleInstance Updated RoleInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $permission): RoleInstance { $data = Values::of(['Permission' => Serialize::map($permission, function($e) { return $e; }), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new RoleInstance( $this->version, $payload, $this->solution['chatServiceSid'], $this->solution['sid'] ); } /** * Delete the RoleInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Fetch the RoleInstance * * @return RoleInstance Fetched RoleInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RoleInstance { $payload = $this->version->fetch('GET', $this->uri); return new RoleInstance( $this->version, $payload, $this->solution['chatServiceSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.RoleContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Service/RoleInstance.php000064400000010501150515725700017345 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'chatServiceSid' => Values::array_get($payload, 'chat_service_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'type' => Values::array_get($payload, 'type'), 'permissions' => Values::array_get($payload, 'permissions'), '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 = ['chatServiceSid' => $chatServiceSid, '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 RoleContext Context for this RoleInstance */ protected function proxy(): RoleContext { if (!$this->context) { $this->context = new RoleContext( $this->version, $this->solution['chatServiceSid'], $this->solution['sid'] ); } return $this->context; } /** * Update the RoleInstance * * @param string[] $permission A permission the role should have * @return RoleInstance Updated RoleInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $permission): RoleInstance { return $this->proxy()->update($permission); } /** * Delete the RoleInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Fetch the RoleInstance * * @return RoleInstance Fetched RoleInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RoleInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.RoleInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Service/ConfigurationList.php000064400000006503150515725700020431 0ustar00solution = ['chatServiceSid' => $chatServiceSid, ]; } /** * Access the notifications */ protected function getNotifications(): NotificationList { if (!$this->_notifications) { $this->_notifications = new NotificationList($this->version, $this->solution['chatServiceSid']); } return $this->_notifications; } /** * Access the webhooks */ protected function getWebhooks(): WebhookList { if (!$this->_webhooks) { $this->_webhooks = new WebhookList($this->version, $this->solution['chatServiceSid']); } return $this->_webhooks; } /** * Constructs a ConfigurationContext */ public function getContext(): ConfigurationContext { return new ConfigurationContext($this->version, $this->solution['chatServiceSid']); } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return \Twilio\ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Conversations.V1.ConfigurationList]'; } }src/Twilio/Rest/Conversations/V1/Service/ConversationContext.php000064400000015242150515725700021005 0ustar00solution = ['chatServiceSid' => $chatServiceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($chatServiceSid) . '/Conversations/' . \rawurlencode($sid) . ''; } /** * Update the ConversationInstance * * @param array|Options $options Optional Arguments * @return ConversationInstance Updated ConversationInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ConversationInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'DateCreated' => Serialize::iso8601DateTime($options['dateCreated']), 'DateUpdated' => Serialize::iso8601DateTime($options['dateUpdated']), 'Attributes' => $options['attributes'], 'MessagingServiceSid' => $options['messagingServiceSid'], 'State' => $options['state'], 'Timers.Inactive' => $options['timersInactive'], 'Timers.Closed' => $options['timersClosed'], 'UniqueName' => $options['uniqueName'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->update('POST', $this->uri, [], $data, $headers); return new ConversationInstance( $this->version, $payload, $this->solution['chatServiceSid'], $this->solution['sid'] ); } /** * Delete the ConversationInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { $options = new Values($options); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); return $this->version->delete('DELETE', $this->uri, [], [], $headers); } /** * Fetch the ConversationInstance * * @return ConversationInstance Fetched ConversationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ConversationInstance { $payload = $this->version->fetch('GET', $this->uri); return new ConversationInstance( $this->version, $payload, $this->solution['chatServiceSid'], $this->solution['sid'] ); } /** * Access the participants */ protected function getParticipants(): ParticipantList { if (!$this->_participants) { $this->_participants = new ParticipantList( $this->version, $this->solution['chatServiceSid'], $this->solution['sid'] ); } return $this->_participants; } /** * Access the messages */ protected function getMessages(): MessageList { if (!$this->_messages) { $this->_messages = new MessageList( $this->version, $this->solution['chatServiceSid'], $this->solution['sid'] ); } return $this->_messages; } /** * Access the webhooks */ protected function getWebhooks(): WebhookList { if (!$this->_webhooks) { $this->_webhooks = new WebhookList( $this->version, $this->solution['chatServiceSid'], $this->solution['sid'] ); } return $this->_webhooks; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.ConversationContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Service/BindingPage.php000064400000002301150515725700017125 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return BindingInstance \Twilio\Rest\Conversations\V1\Service\BindingInstance */ public function buildInstance(array $payload): BindingInstance { return new BindingInstance($this->version, $payload, $this->solution['chatServiceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.BindingPage]'; } }src/Twilio/Rest/Conversations/V1/Service/ParticipantConversationInstance.php000064400000007540150515725700023326 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'chatServiceSid' => Values::array_get($payload, 'chat_service_sid'), 'participantSid' => Values::array_get($payload, 'participant_sid'), 'participantUserSid' => Values::array_get($payload, 'participant_user_sid'), 'participantIdentity' => Values::array_get($payload, 'participant_identity'), 'participantMessagingBinding' => Values::array_get($payload, 'participant_messaging_binding'), 'conversationSid' => Values::array_get($payload, 'conversation_sid'), 'conversationUniqueName' => Values::array_get($payload, 'conversation_unique_name'), 'conversationFriendlyName' => Values::array_get($payload, 'conversation_friendly_name'), 'conversationAttributes' => Values::array_get($payload, 'conversation_attributes'), 'conversationDateCreated' => Deserialize::dateTime(Values::array_get($payload, 'conversation_date_created')), 'conversationDateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'conversation_date_updated')), 'conversationCreatedBy' => Values::array_get($payload, 'conversation_created_by'), 'conversationState' => Values::array_get($payload, 'conversation_state'), 'conversationTimers' => Values::array_get($payload, 'conversation_timers'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['chatServiceSid' => $chatServiceSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Conversations.V1.ParticipantConversationInstance]'; } }src/Twilio/Rest/Conversations/V1/Service/BindingInstance.php000064400000010430150515725700020017 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'chatServiceSid' => Values::array_get($payload, 'chat_service_sid'), 'credentialSid' => Values::array_get($payload, 'credential_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'endpoint' => Values::array_get($payload, 'endpoint'), 'identity' => Values::array_get($payload, 'identity'), 'bindingType' => Values::array_get($payload, 'binding_type'), 'messageTypes' => Values::array_get($payload, 'message_types'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['chatServiceSid' => $chatServiceSid, '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 BindingContext Context for this BindingInstance */ protected function proxy(): BindingContext { if (!$this->context) { $this->context = new BindingContext( $this->version, $this->solution['chatServiceSid'], $this->solution['sid'] ); } return $this->context; } /** * Delete the BindingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Fetch the BindingInstance * * @return BindingInstance Fetched BindingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): BindingInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.BindingInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Service/ConfigurationInstance.php000064400000007547150515725700021273 0ustar00properties = [ 'chatServiceSid' => Values::array_get($payload, 'chat_service_sid'), 'defaultConversationCreatorRoleSid' => Values::array_get($payload, 'default_conversation_creator_role_sid'), 'defaultConversationRoleSid' => Values::array_get($payload, 'default_conversation_role_sid'), 'defaultChatServiceRoleSid' => Values::array_get($payload, 'default_chat_service_role_sid'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), 'reachabilityEnabled' => Values::array_get($payload, 'reachability_enabled'), ]; $this->solution = ['chatServiceSid' => $chatServiceSid, ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return ConfigurationContext Context for this ConfigurationInstance */ protected function proxy(): ConfigurationContext { if (!$this->context) { $this->context = new ConfigurationContext($this->version, $this->solution['chatServiceSid']); } return $this->context; } /** * Fetch the ConfigurationInstance * * @return ConfigurationInstance Fetched ConfigurationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ConfigurationInstance { return $this->proxy()->fetch(); } /** * Update the ConfigurationInstance * * @param array|Options $options Optional Arguments * @return ConfigurationInstance Updated ConfigurationInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ConfigurationInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.ConfigurationInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Service/ConversationOptions.php000064400000045732150515725700021023 0ustar00options['friendlyName'] = $friendlyName; $this->options['uniqueName'] = $uniqueName; $this->options['attributes'] = $attributes; $this->options['messagingServiceSid'] = $messagingServiceSid; $this->options['dateCreated'] = $dateCreated; $this->options['dateUpdated'] = $dateUpdated; $this->options['state'] = $state; $this->options['timersInactive'] = $timersInactive; $this->options['timersClosed'] = $timersClosed; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The human-readable name of this conversation, limited to 256 characters. Optional. * * @param string $friendlyName The human-readable name of this conversation. * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. * * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set "{}" will be returned. * * @param string $attributes An optional string metadata field you can use to * store any data you wish. * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The unique ID of the [Messaging Service](https://www.twilio.com/docs/sms/services/api) this conversation belongs to. * * @param string $messagingServiceSid The unique ID of the Messaging Service * this conversation belongs to. * @return $this Fluent Builder */ public function setMessagingServiceSid(string $messagingServiceSid): self { $this->options['messagingServiceSid'] = $messagingServiceSid; return $this; } /** * The date that this resource was created. * * @param \DateTime $dateCreated The date that this resource was created. * @return $this Fluent Builder */ public function setDateCreated(\DateTime $dateCreated): self { $this->options['dateCreated'] = $dateCreated; return $this; } /** * The date that this resource was last updated. * * @param \DateTime $dateUpdated The date that this resource was last updated. * @return $this Fluent Builder */ public function setDateUpdated(\DateTime $dateUpdated): self { $this->options['dateUpdated'] = $dateUpdated; return $this; } /** * Current state of this conversation. Can be either `active`, `inactive` or `closed` and defaults to `active` * * @param string $state Current state of this conversation. * @return $this Fluent Builder */ public function setState(string $state): self { $this->options['state'] = $state; return $this; } /** * ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. * * @param string $timersInactive ISO8601 duration when conversation will be * switched to `inactive` state. * @return $this Fluent Builder */ public function setTimersInactive(string $timersInactive): self { $this->options['timersInactive'] = $timersInactive; return $this; } /** * ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. * * @param string $timersClosed ISO8601 duration when conversation will be * switched to `closed` state. * @return $this Fluent Builder */ public function setTimersClosed(string $timersClosed): self { $this->options['timersClosed'] = $timersClosed; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.CreateConversationOptions ' . $options . ']'; } } class UpdateConversationOptions extends Options { /** * @param string $friendlyName The human-readable name of this conversation. * @param \DateTime $dateCreated The date that this resource was created. * @param \DateTime $dateUpdated The date that this resource was last updated. * @param string $attributes An optional string metadata field you can use to * store any data you wish. * @param string $messagingServiceSid The unique ID of the Messaging Service * this conversation belongs to. * @param string $state Current state of this conversation. * @param string $timersInactive ISO8601 duration when conversation will be * switched to `inactive` state. * @param string $timersClosed ISO8601 duration when conversation will be * switched to `closed` state. * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header */ public function __construct(string $friendlyName = Values::NONE, \DateTime $dateCreated = Values::NONE, \DateTime $dateUpdated = Values::NONE, string $attributes = Values::NONE, string $messagingServiceSid = Values::NONE, string $state = Values::NONE, string $timersInactive = Values::NONE, string $timersClosed = Values::NONE, string $uniqueName = Values::NONE, string $xTwilioWebhookEnabled = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['dateCreated'] = $dateCreated; $this->options['dateUpdated'] = $dateUpdated; $this->options['attributes'] = $attributes; $this->options['messagingServiceSid'] = $messagingServiceSid; $this->options['state'] = $state; $this->options['timersInactive'] = $timersInactive; $this->options['timersClosed'] = $timersClosed; $this->options['uniqueName'] = $uniqueName; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The human-readable name of this conversation, limited to 256 characters. Optional. * * @param string $friendlyName The human-readable name of this conversation. * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The date that this resource was created. * * @param \DateTime $dateCreated The date that this resource was created. * @return $this Fluent Builder */ public function setDateCreated(\DateTime $dateCreated): self { $this->options['dateCreated'] = $dateCreated; return $this; } /** * The date that this resource was last updated. * * @param \DateTime $dateUpdated The date that this resource was last updated. * @return $this Fluent Builder */ public function setDateUpdated(\DateTime $dateUpdated): self { $this->options['dateUpdated'] = $dateUpdated; return $this; } /** * An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set "{}" will be returned. * * @param string $attributes An optional string metadata field you can use to * store any data you wish. * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The unique ID of the [Messaging Service](https://www.twilio.com/docs/sms/services/api) this conversation belongs to. * * @param string $messagingServiceSid The unique ID of the Messaging Service * this conversation belongs to. * @return $this Fluent Builder */ public function setMessagingServiceSid(string $messagingServiceSid): self { $this->options['messagingServiceSid'] = $messagingServiceSid; return $this; } /** * Current state of this conversation. Can be either `active`, `inactive` or `closed` and defaults to `active` * * @param string $state Current state of this conversation. * @return $this Fluent Builder */ public function setState(string $state): self { $this->options['state'] = $state; return $this; } /** * ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. * * @param string $timersInactive ISO8601 duration when conversation will be * switched to `inactive` state. * @return $this Fluent Builder */ public function setTimersInactive(string $timersInactive): self { $this->options['timersInactive'] = $timersInactive; return $this; } /** * ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. * * @param string $timersClosed ISO8601 duration when conversation will be * switched to `closed` state. * @return $this Fluent Builder */ public function setTimersClosed(string $timersClosed): self { $this->options['timersClosed'] = $timersClosed; return $this; } /** * An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. * * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.UpdateConversationOptions ' . $options . ']'; } } class DeleteConversationOptions extends Options { /** * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header */ public function __construct(string $xTwilioWebhookEnabled = Values::NONE) { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.DeleteConversationOptions ' . $options . ']'; } }src/Twilio/Rest/Conversations/V1/Service/ConversationPage.php000064400000002337150515725700020236 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ConversationInstance \Twilio\Rest\Conversations\V1\Service\ConversationInstance */ public function buildInstance(array $payload): ConversationInstance { return new ConversationInstance($this->version, $payload, $this->solution['chatServiceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.ConversationPage]'; } }src/Twilio/Rest/Conversations/V1/Service/ConfigurationPage.php000064400000002345150515725700020372 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ConfigurationInstance \Twilio\Rest\Conversations\V1\Service\ConfigurationInstance */ public function buildInstance(array $payload): ConfigurationInstance { return new ConfigurationInstance($this->version, $payload, $this->solution['chatServiceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.ConfigurationPage]'; } }src/Twilio/Rest/Conversations/V1/Service/User/UserConversationOptions.php000064400000006606150515725700022575 0ustar00options['notificationLevel'] = $notificationLevel; $this->options['lastReadTimestamp'] = $lastReadTimestamp; $this->options['lastReadMessageIndex'] = $lastReadMessageIndex; } /** * The Notification Level of this User Conversation. One of `default` or `muted`. * * @param string $notificationLevel The Notification Level of this User * Conversation. * @return $this Fluent Builder */ public function setNotificationLevel(string $notificationLevel): self { $this->options['notificationLevel'] = $notificationLevel; return $this; } /** * The date of the last message read in conversation by the user, given in ISO 8601 format. * * @param \DateTime $lastReadTimestamp The date of the last message read in * conversation by the user. * @return $this Fluent Builder */ public function setLastReadTimestamp(\DateTime $lastReadTimestamp): self { $this->options['lastReadTimestamp'] = $lastReadTimestamp; return $this; } /** * The index of the last Message in the Conversation that the Participant has read. * * @param int $lastReadMessageIndex The index of the last read Message. * @return $this Fluent Builder */ public function setLastReadMessageIndex(int $lastReadMessageIndex): self { $this->options['lastReadMessageIndex'] = $lastReadMessageIndex; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.UpdateUserConversationOptions ' . $options . ']'; } }src/Twilio/Rest/Conversations/V1/Service/User/UserConversationPage.php000064400000002527150515725700022014 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return UserConversationInstance \Twilio\Rest\Conversations\V1\Service\User\UserConversationInstance */ public function buildInstance(array $payload): UserConversationInstance { return new UserConversationInstance( $this->version, $payload, $this->solution['chatServiceSid'], $this->solution['userSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.UserConversationPage]'; } }src/Twilio/Rest/Conversations/V1/Service/User/UserConversationList.php000064400000012353150515725700022051 0ustar00solution = ['chatServiceSid' => $chatServiceSid, 'userSid' => $userSid, ]; $this->uri = '/Services/' . \rawurlencode($chatServiceSid) . '/Users/' . \rawurlencode($userSid) . '/Conversations'; } /** * Streams UserConversationInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads UserConversationInstance 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 UserConversationInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of UserConversationInstance 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 UserConversationPage Page of UserConversationInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): UserConversationPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new UserConversationPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of UserConversationInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return UserConversationPage Page of UserConversationInstance */ public function getPage(string $targetUrl): UserConversationPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new UserConversationPage($this->version, $response, $this->solution); } /** * Constructs a UserConversationContext * * @param string $conversationSid The unique SID identifier of the Conversation. */ public function getContext(string $conversationSid): UserConversationContext { return new UserConversationContext( $this->version, $this->solution['chatServiceSid'], $this->solution['userSid'], $conversationSid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.UserConversationList]'; } }src/Twilio/Rest/Conversations/V1/Service/User/UserConversationContext.php000064400000006717150515725700022571 0ustar00solution = [ 'chatServiceSid' => $chatServiceSid, 'userSid' => $userSid, 'conversationSid' => $conversationSid, ]; $this->uri = '/Services/' . \rawurlencode($chatServiceSid) . '/Users/' . \rawurlencode($userSid) . '/Conversations/' . \rawurlencode($conversationSid) . ''; } /** * Update the UserConversationInstance * * @param array|Options $options Optional Arguments * @return UserConversationInstance Updated UserConversationInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): UserConversationInstance { $options = new Values($options); $data = Values::of([ 'NotificationLevel' => $options['notificationLevel'], 'LastReadTimestamp' => Serialize::iso8601DateTime($options['lastReadTimestamp']), 'LastReadMessageIndex' => $options['lastReadMessageIndex'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new UserConversationInstance( $this->version, $payload, $this->solution['chatServiceSid'], $this->solution['userSid'], $this->solution['conversationSid'] ); } /** * Delete the UserConversationInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Fetch the UserConversationInstance * * @return UserConversationInstance Fetched UserConversationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): UserConversationInstance { $payload = $this->version->fetch('GET', $this->uri); return new UserConversationInstance( $this->version, $payload, $this->solution['chatServiceSid'], $this->solution['userSid'], $this->solution['conversationSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.UserConversationContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Service/User/UserConversationInstance.php000064400000013463150515725700022705 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'chatServiceSid' => Values::array_get($payload, 'chat_service_sid'), 'conversationSid' => Values::array_get($payload, 'conversation_sid'), 'unreadMessagesCount' => Values::array_get($payload, 'unread_messages_count'), 'lastReadMessageIndex' => Values::array_get($payload, 'last_read_message_index'), 'participantSid' => Values::array_get($payload, 'participant_sid'), 'userSid' => Values::array_get($payload, 'user_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'conversationState' => Values::array_get($payload, 'conversation_state'), 'timers' => Values::array_get($payload, 'timers'), 'attributes' => Values::array_get($payload, 'attributes'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'createdBy' => Values::array_get($payload, 'created_by'), 'notificationLevel' => Values::array_get($payload, 'notification_level'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = [ 'chatServiceSid' => $chatServiceSid, 'userSid' => $userSid, 'conversationSid' => $conversationSid ?: $this->properties['conversationSid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return UserConversationContext Context for this UserConversationInstance */ protected function proxy(): UserConversationContext { if (!$this->context) { $this->context = new UserConversationContext( $this->version, $this->solution['chatServiceSid'], $this->solution['userSid'], $this->solution['conversationSid'] ); } return $this->context; } /** * Update the UserConversationInstance * * @param array|Options $options Optional Arguments * @return UserConversationInstance Updated UserConversationInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): UserConversationInstance { return $this->proxy()->update($options); } /** * Delete the UserConversationInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Fetch the UserConversationInstance * * @return UserConversationInstance Fetched UserConversationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): UserConversationInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.UserConversationInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Service/ParticipantConversationList.php000064400000012371150515725700022473 0ustar00solution = ['chatServiceSid' => $chatServiceSid, ]; $this->uri = '/Services/' . \rawurlencode($chatServiceSid) . '/ParticipantConversations'; } /** * Streams ParticipantConversationInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ParticipantConversationInstance 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 ParticipantConversationInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of ParticipantConversationInstance 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 ParticipantConversationPage Page of ParticipantConversationInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ParticipantConversationPage { $options = new Values($options); $params = Values::of([ 'Identity' => $options['identity'], 'Address' => $options['address'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ParticipantConversationPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ParticipantConversationInstance records from the * API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ParticipantConversationPage Page of ParticipantConversationInstance */ public function getPage(string $targetUrl): ParticipantConversationPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ParticipantConversationPage($this->version, $response, $this->solution); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.ParticipantConversationList]'; } }src/Twilio/Rest/Conversations/V1/Service/ParticipantConversationPage.php000064400000002517150515725700022435 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ParticipantConversationInstance \Twilio\Rest\Conversations\V1\Service\ParticipantConversationInstance */ public function buildInstance(array $payload): ParticipantConversationInstance { return new ParticipantConversationInstance( $this->version, $payload, $this->solution['chatServiceSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.ParticipantConversationPage]'; } }src/Twilio/Rest/Conversations/V1/Service/RolePage.php000064400000002257150515725700016466 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return RoleInstance \Twilio\Rest\Conversations\V1\Service\RoleInstance */ public function buildInstance(array $payload): RoleInstance { return new RoleInstance($this->version, $payload, $this->solution['chatServiceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.RolePage]'; } }src/Twilio/Rest/Conversations/V1/Service/ConfigurationOptions.php000064400000013253150515725700021151 0ustar00options['defaultConversationCreatorRoleSid'] = $defaultConversationCreatorRoleSid; $this->options['defaultConversationRoleSid'] = $defaultConversationRoleSid; $this->options['defaultChatServiceRoleSid'] = $defaultChatServiceRoleSid; $this->options['reachabilityEnabled'] = $reachabilityEnabled; } /** * The conversation-level role assigned to a conversation creator when they join a new conversation. See the [Conversation Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info about roles. * * @param string $defaultConversationCreatorRoleSid The role assigned to a * conversation creator when * they join a new conversation * @return $this Fluent Builder */ public function setDefaultConversationCreatorRoleSid(string $defaultConversationCreatorRoleSid): self { $this->options['defaultConversationCreatorRoleSid'] = $defaultConversationCreatorRoleSid; return $this; } /** * The conversation-level role assigned to users when they are added to a conversation. See the [Conversation Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info about roles. * * @param string $defaultConversationRoleSid The role assigned to users when * they are added to a conversation * @return $this Fluent Builder */ public function setDefaultConversationRoleSid(string $defaultConversationRoleSid): self { $this->options['defaultConversationRoleSid'] = $defaultConversationRoleSid; return $this; } /** * The service-level role assigned to users when they are added to the service. See the [Conversation Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info about roles. * * @param string $defaultChatServiceRoleSid The service role assigned to users * when they are added to the service * @return $this Fluent Builder */ public function setDefaultChatServiceRoleSid(string $defaultChatServiceRoleSid): self { $this->options['defaultChatServiceRoleSid'] = $defaultChatServiceRoleSid; return $this; } /** * Whether the [Reachability Indicator](https://www.twilio.com/docs/chat/reachability-indicator) is enabled for this Conversations Service. The default is `false`. * * @param bool $reachabilityEnabled Whether the Reachability Indicator feature * is enabled for this Conversations Service * @return $this Fluent Builder */ public function setReachabilityEnabled(bool $reachabilityEnabled): self { $this->options['reachabilityEnabled'] = $reachabilityEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.UpdateConfigurationOptions ' . $options . ']'; } }src/Twilio/Rest/Conversations/V1/Service/UserList.php000064400000013325150515725700016540 0ustar00solution = ['chatServiceSid' => $chatServiceSid, ]; $this->uri = '/Services/' . \rawurlencode($chatServiceSid) . '/Users'; } /** * Create the UserInstance * * @param string $identity The string that identifies the resource's User * @param array|Options $options Optional Arguments * @return UserInstance Created UserInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $identity, array $options = []): UserInstance { $options = new Values($options); $data = Values::of([ 'Identity' => $identity, 'FriendlyName' => $options['friendlyName'], 'Attributes' => $options['attributes'], 'RoleSid' => $options['roleSid'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->create('POST', $this->uri, [], $data, $headers); return new UserInstance($this->version, $payload, $this->solution['chatServiceSid']); } /** * Streams UserInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads UserInstance 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 UserInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of UserInstance 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 UserPage Page of UserInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): UserPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new UserPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of UserInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return UserPage Page of UserInstance */ public function getPage(string $targetUrl): UserPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new UserPage($this->version, $response, $this->solution); } /** * Constructs a UserContext * * @param string $sid The SID of the User resource to fetch */ public function getContext(string $sid): UserContext { return new UserContext($this->version, $this->solution['chatServiceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.UserList]'; } }src/Twilio/Rest/Conversations/V1/Service/ConversationList.php000064400000014357150515725700020302 0ustar00solution = ['chatServiceSid' => $chatServiceSid, ]; $this->uri = '/Services/' . \rawurlencode($chatServiceSid) . '/Conversations'; } /** * Create the ConversationInstance * * @param array|Options $options Optional Arguments * @return ConversationInstance Created ConversationInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): ConversationInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'UniqueName' => $options['uniqueName'], 'Attributes' => $options['attributes'], 'MessagingServiceSid' => $options['messagingServiceSid'], 'DateCreated' => Serialize::iso8601DateTime($options['dateCreated']), 'DateUpdated' => Serialize::iso8601DateTime($options['dateUpdated']), 'State' => $options['state'], 'Timers.Inactive' => $options['timersInactive'], 'Timers.Closed' => $options['timersClosed'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->create('POST', $this->uri, [], $data, $headers); return new ConversationInstance($this->version, $payload, $this->solution['chatServiceSid']); } /** * Streams ConversationInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ConversationInstance 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 ConversationInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of ConversationInstance 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 ConversationPage Page of ConversationInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ConversationPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ConversationPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ConversationInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ConversationPage Page of ConversationInstance */ public function getPage(string $targetUrl): ConversationPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ConversationPage($this->version, $response, $this->solution); } /** * Constructs a ConversationContext * * @param string $sid A 34 character string that uniquely identifies this * resource. */ public function getContext(string $sid): ConversationContext { return new ConversationContext($this->version, $this->solution['chatServiceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.ConversationList]'; } }src/Twilio/Rest/Conversations/V1/Service/UserInstance.php000064400000012076150515725700017373 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'chatServiceSid' => Values::array_get($payload, 'chat_service_sid'), 'roleSid' => Values::array_get($payload, 'role_sid'), 'identity' => Values::array_get($payload, 'identity'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'attributes' => Values::array_get($payload, 'attributes'), 'isOnline' => Values::array_get($payload, 'is_online'), 'isNotifiable' => Values::array_get($payload, 'is_notifiable'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['chatServiceSid' => $chatServiceSid, '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 UserContext Context for this UserInstance */ protected function proxy(): UserContext { if (!$this->context) { $this->context = new UserContext( $this->version, $this->solution['chatServiceSid'], $this->solution['sid'] ); } return $this->context; } /** * Update the UserInstance * * @param array|Options $options Optional Arguments * @return UserInstance Updated UserInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): UserInstance { return $this->proxy()->update($options); } /** * Delete the UserInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { return $this->proxy()->delete($options); } /** * Fetch the UserInstance * * @return UserInstance Fetched UserInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): UserInstance { return $this->proxy()->fetch(); } /** * Access the userConversations */ protected function getUserConversations(): UserConversationList { return $this->proxy()->userConversations; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.UserInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Service/ConfigurationContext.php000064400000005165150515725700021145 0ustar00solution = ['chatServiceSid' => $chatServiceSid, ]; $this->uri = '/Services/' . \rawurlencode($chatServiceSid) . '/Configuration'; } /** * Fetch the ConfigurationInstance * * @return ConfigurationInstance Fetched ConfigurationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ConfigurationInstance { $payload = $this->version->fetch('GET', $this->uri); return new ConfigurationInstance($this->version, $payload, $this->solution['chatServiceSid']); } /** * Update the ConfigurationInstance * * @param array|Options $options Optional Arguments * @return ConfigurationInstance Updated ConfigurationInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ConfigurationInstance { $options = new Values($options); $data = Values::of([ 'DefaultConversationCreatorRoleSid' => $options['defaultConversationCreatorRoleSid'], 'DefaultConversationRoleSid' => $options['defaultConversationRoleSid'], 'DefaultChatServiceRoleSid' => $options['defaultChatServiceRoleSid'], 'ReachabilityEnabled' => Serialize::booleanToString($options['reachabilityEnabled']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ConfigurationInstance($this->version, $payload, $this->solution['chatServiceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.ConfigurationContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/Service/BindingOptions.php000064400000005264150515725700017717 0ustar00options['bindingType'] = $bindingType; $this->options['identity'] = $identity; } /** * The push technology used by the Binding resources to read. Can be: `apn`, `gcm`, or `fcm`. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. * * @param string[] $bindingType The push technology used by the Binding * resources to read. * @return $this Fluent Builder */ public function setBindingType(array $bindingType): self { $this->options['bindingType'] = $bindingType; return $this; } /** * The identity of a [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource) this binding belongs to. See [access tokens](https://www.twilio.com/docs/conversations/create-tokens) for more details. * * @param string[] $identity The identity of Conversation User associated with * this binding. * @return $this Fluent Builder */ public function setIdentity(array $identity): self { $this->options['identity'] = $identity; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.ReadBindingOptions ' . $options . ']'; } }src/Twilio/Rest/Conversations/V1/ConversationContext.php000064400000013623150515725700017406 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Conversations/' . \rawurlencode($sid) . ''; } /** * Update the ConversationInstance * * @param array|Options $options Optional Arguments * @return ConversationInstance Updated ConversationInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ConversationInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'DateCreated' => Serialize::iso8601DateTime($options['dateCreated']), 'DateUpdated' => Serialize::iso8601DateTime($options['dateUpdated']), 'Attributes' => $options['attributes'], 'MessagingServiceSid' => $options['messagingServiceSid'], 'State' => $options['state'], 'Timers.Inactive' => $options['timersInactive'], 'Timers.Closed' => $options['timersClosed'], 'UniqueName' => $options['uniqueName'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->update('POST', $this->uri, [], $data, $headers); return new ConversationInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the ConversationInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { $options = new Values($options); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); return $this->version->delete('DELETE', $this->uri, [], [], $headers); } /** * Fetch the ConversationInstance * * @return ConversationInstance Fetched ConversationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ConversationInstance { $payload = $this->version->fetch('GET', $this->uri); return new ConversationInstance($this->version, $payload, $this->solution['sid']); } /** * Access the participants */ protected function getParticipants(): ParticipantList { if (!$this->_participants) { $this->_participants = new ParticipantList($this->version, $this->solution['sid']); } return $this->_participants; } /** * Access the messages */ protected function getMessages(): MessageList { if (!$this->_messages) { $this->_messages = new MessageList($this->version, $this->solution['sid']); } return $this->_messages; } /** * Access the webhooks */ protected function getWebhooks(): WebhookList { if (!$this->_webhooks) { $this->_webhooks = new WebhookList($this->version, $this->solution['sid']); } return $this->_webhooks; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.ConversationContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/ParticipantConversationInstance.php000064400000007211150515725700021721 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'chatServiceSid' => Values::array_get($payload, 'chat_service_sid'), 'participantSid' => Values::array_get($payload, 'participant_sid'), 'participantUserSid' => Values::array_get($payload, 'participant_user_sid'), 'participantIdentity' => Values::array_get($payload, 'participant_identity'), 'participantMessagingBinding' => Values::array_get($payload, 'participant_messaging_binding'), 'conversationSid' => Values::array_get($payload, 'conversation_sid'), 'conversationUniqueName' => Values::array_get($payload, 'conversation_unique_name'), 'conversationFriendlyName' => Values::array_get($payload, 'conversation_friendly_name'), 'conversationAttributes' => Values::array_get($payload, 'conversation_attributes'), 'conversationDateCreated' => Deserialize::dateTime(Values::array_get($payload, 'conversation_date_created')), 'conversationDateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'conversation_date_updated')), 'conversationCreatedBy' => Values::array_get($payload, 'conversation_created_by'), 'conversationState' => Values::array_get($payload, 'conversation_state'), 'conversationTimers' => Values::array_get($payload, 'conversation_timers'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = []; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Conversations.V1.ParticipantConversationInstance]'; } }src/Twilio/Rest/Conversations/V1/ConfigurationInstance.php000064400000007150150515725700017661 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'defaultChatServiceSid' => Values::array_get($payload, 'default_chat_service_sid'), 'defaultMessagingServiceSid' => Values::array_get($payload, 'default_messaging_service_sid'), 'defaultInactiveTimer' => Values::array_get($payload, 'default_inactive_timer'), 'defaultClosedTimer' => Values::array_get($payload, 'default_closed_timer'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = []; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return ConfigurationContext Context for this ConfigurationInstance */ protected function proxy(): ConfigurationContext { if (!$this->context) { $this->context = new ConfigurationContext($this->version); } return $this->context; } /** * Fetch the ConfigurationInstance * * @return ConfigurationInstance Fetched ConfigurationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ConfigurationInstance { return $this->proxy()->fetch(); } /** * Update the ConfigurationInstance * * @param array|Options $options Optional Arguments * @return ConfigurationInstance Updated ConfigurationInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ConfigurationInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.ConfigurationInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/ConversationOptions.php000064400000045722150515725700017422 0ustar00options['friendlyName'] = $friendlyName; $this->options['uniqueName'] = $uniqueName; $this->options['dateCreated'] = $dateCreated; $this->options['dateUpdated'] = $dateUpdated; $this->options['messagingServiceSid'] = $messagingServiceSid; $this->options['attributes'] = $attributes; $this->options['state'] = $state; $this->options['timersInactive'] = $timersInactive; $this->options['timersClosed'] = $timersClosed; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The human-readable name of this conversation, limited to 256 characters. Optional. * * @param string $friendlyName The human-readable name of this conversation. * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. * * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * The date that this resource was created. * * @param \DateTime $dateCreated The date that this resource was created. * @return $this Fluent Builder */ public function setDateCreated(\DateTime $dateCreated): self { $this->options['dateCreated'] = $dateCreated; return $this; } /** * The date that this resource was last updated. * * @param \DateTime $dateUpdated The date that this resource was last updated. * @return $this Fluent Builder */ public function setDateUpdated(\DateTime $dateUpdated): self { $this->options['dateUpdated'] = $dateUpdated; return $this; } /** * The unique ID of the [Messaging Service](https://www.twilio.com/docs/sms/services/api) this conversation belongs to. * * @param string $messagingServiceSid The unique ID of the Messaging Service * this conversation belongs to. * @return $this Fluent Builder */ public function setMessagingServiceSid(string $messagingServiceSid): self { $this->options['messagingServiceSid'] = $messagingServiceSid; return $this; } /** * An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set "{}" will be returned. * * @param string $attributes An optional string metadata field you can use to * store any data you wish. * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * Current state of this conversation. Can be either `active`, `inactive` or `closed` and defaults to `active` * * @param string $state Current state of this conversation. * @return $this Fluent Builder */ public function setState(string $state): self { $this->options['state'] = $state; return $this; } /** * ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. * * @param string $timersInactive ISO8601 duration when conversation will be * switched to `inactive` state. * @return $this Fluent Builder */ public function setTimersInactive(string $timersInactive): self { $this->options['timersInactive'] = $timersInactive; return $this; } /** * ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. * * @param string $timersClosed ISO8601 duration when conversation will be * switched to `closed` state. * @return $this Fluent Builder */ public function setTimersClosed(string $timersClosed): self { $this->options['timersClosed'] = $timersClosed; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.CreateConversationOptions ' . $options . ']'; } } class UpdateConversationOptions extends Options { /** * @param string $friendlyName The human-readable name of this conversation. * @param \DateTime $dateCreated The date that this resource was created. * @param \DateTime $dateUpdated The date that this resource was last updated. * @param string $attributes An optional string metadata field you can use to * store any data you wish. * @param string $messagingServiceSid The unique ID of the Messaging Service * this conversation belongs to. * @param string $state Current state of this conversation. * @param string $timersInactive ISO8601 duration when conversation will be * switched to `inactive` state. * @param string $timersClosed ISO8601 duration when conversation will be * switched to `closed` state. * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header */ public function __construct(string $friendlyName = Values::NONE, \DateTime $dateCreated = Values::NONE, \DateTime $dateUpdated = Values::NONE, string $attributes = Values::NONE, string $messagingServiceSid = Values::NONE, string $state = Values::NONE, string $timersInactive = Values::NONE, string $timersClosed = Values::NONE, string $uniqueName = Values::NONE, string $xTwilioWebhookEnabled = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['dateCreated'] = $dateCreated; $this->options['dateUpdated'] = $dateUpdated; $this->options['attributes'] = $attributes; $this->options['messagingServiceSid'] = $messagingServiceSid; $this->options['state'] = $state; $this->options['timersInactive'] = $timersInactive; $this->options['timersClosed'] = $timersClosed; $this->options['uniqueName'] = $uniqueName; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The human-readable name of this conversation, limited to 256 characters. Optional. * * @param string $friendlyName The human-readable name of this conversation. * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The date that this resource was created. * * @param \DateTime $dateCreated The date that this resource was created. * @return $this Fluent Builder */ public function setDateCreated(\DateTime $dateCreated): self { $this->options['dateCreated'] = $dateCreated; return $this; } /** * The date that this resource was last updated. * * @param \DateTime $dateUpdated The date that this resource was last updated. * @return $this Fluent Builder */ public function setDateUpdated(\DateTime $dateUpdated): self { $this->options['dateUpdated'] = $dateUpdated; return $this; } /** * An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set "{}" will be returned. * * @param string $attributes An optional string metadata field you can use to * store any data you wish. * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The unique ID of the [Messaging Service](https://www.twilio.com/docs/sms/services/api) this conversation belongs to. * * @param string $messagingServiceSid The unique ID of the Messaging Service * this conversation belongs to. * @return $this Fluent Builder */ public function setMessagingServiceSid(string $messagingServiceSid): self { $this->options['messagingServiceSid'] = $messagingServiceSid; return $this; } /** * Current state of this conversation. Can be either `active`, `inactive` or `closed` and defaults to `active` * * @param string $state Current state of this conversation. * @return $this Fluent Builder */ public function setState(string $state): self { $this->options['state'] = $state; return $this; } /** * ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. * * @param string $timersInactive ISO8601 duration when conversation will be * switched to `inactive` state. * @return $this Fluent Builder */ public function setTimersInactive(string $timersInactive): self { $this->options['timersInactive'] = $timersInactive; return $this; } /** * ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. * * @param string $timersClosed ISO8601 duration when conversation will be * switched to `closed` state. * @return $this Fluent Builder */ public function setTimersClosed(string $timersClosed): self { $this->options['timersClosed'] = $timersClosed; return $this; } /** * An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. * * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.UpdateConversationOptions ' . $options . ']'; } } class DeleteConversationOptions extends Options { /** * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header */ public function __construct(string $xTwilioWebhookEnabled = Values::NONE) { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.DeleteConversationOptions ' . $options . ']'; } }src/Twilio/Rest/Conversations/V1/ConversationPage.php000064400000002254150515725700016634 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ConversationInstance \Twilio\Rest\Conversations\V1\ConversationInstance */ public function buildInstance(array $payload): ConversationInstance { return new ConversationInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.ConversationPage]'; } }src/Twilio/Rest/Conversations/V1/ConfigurationPage.php000064400000002262150515725700016770 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ConfigurationInstance \Twilio\Rest\Conversations\V1\ConfigurationInstance */ public function buildInstance(array $payload): ConfigurationInstance { return new ConfigurationInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.ConfigurationPage]'; } }src/Twilio/Rest/Conversations/V1/ServiceContext.php000064400000013531150515725700016332 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($sid) . ''; } /** * Delete the ServiceInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Fetch the ServiceInstance * * @return ServiceInstance Fetched ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ServiceInstance { $payload = $this->version->fetch('GET', $this->uri); return new ServiceInstance($this->version, $payload, $this->solution['sid']); } /** * Access the conversations */ protected function getConversations(): ConversationList { if (!$this->_conversations) { $this->_conversations = new ConversationList($this->version, $this->solution['sid']); } return $this->_conversations; } /** * Access the bindings */ protected function getBindings(): BindingList { if (!$this->_bindings) { $this->_bindings = new BindingList($this->version, $this->solution['sid']); } return $this->_bindings; } /** * Access the users */ protected function getUsers(): UserList { if (!$this->_users) { $this->_users = new UserList($this->version, $this->solution['sid']); } return $this->_users; } /** * Access the roles */ protected function getRoles(): RoleList { if (!$this->_roles) { $this->_roles = new RoleList($this->version, $this->solution['sid']); } return $this->_roles; } /** * Access the configuration */ protected function getConfiguration(): ConfigurationList { if (!$this->_configuration) { $this->_configuration = new ConfigurationList($this->version, $this->solution['sid']); } return $this->_configuration; } /** * Access the participantConversations */ protected function getParticipantConversations(): ParticipantConversationList { if (!$this->_participantConversations) { $this->_participantConversations = new ParticipantConversationList( $this->version, $this->solution['sid'] ); } return $this->_participantConversations; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.ServiceContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/User/UserConversationOptions.php000064400000006576150515725700021203 0ustar00options['notificationLevel'] = $notificationLevel; $this->options['lastReadTimestamp'] = $lastReadTimestamp; $this->options['lastReadMessageIndex'] = $lastReadMessageIndex; } /** * The Notification Level of this User Conversation. One of `default` or `muted`. * * @param string $notificationLevel The Notification Level of this User * Conversation. * @return $this Fluent Builder */ public function setNotificationLevel(string $notificationLevel): self { $this->options['notificationLevel'] = $notificationLevel; return $this; } /** * The date of the last message read in conversation by the user, given in ISO 8601 format. * * @param \DateTime $lastReadTimestamp The date of the last message read in * conversation by the user. * @return $this Fluent Builder */ public function setLastReadTimestamp(\DateTime $lastReadTimestamp): self { $this->options['lastReadTimestamp'] = $lastReadTimestamp; return $this; } /** * The index of the last Message in the Conversation that the Participant has read. * * @param int $lastReadMessageIndex The index of the last read Message. * @return $this Fluent Builder */ public function setLastReadMessageIndex(int $lastReadMessageIndex): self { $this->options['lastReadMessageIndex'] = $lastReadMessageIndex; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.UpdateUserConversationOptions ' . $options . ']'; } }src/Twilio/Rest/Conversations/V1/User/UserConversationPage.php000064400000002352150515725700020410 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return UserConversationInstance \Twilio\Rest\Conversations\V1\User\UserConversationInstance */ public function buildInstance(array $payload): UserConversationInstance { return new UserConversationInstance($this->version, $payload, $this->solution['userSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.UserConversationPage]'; } }src/Twilio/Rest/Conversations/V1/User/UserConversationList.php000064400000011607150515725700020452 0ustar00solution = ['userSid' => $userSid, ]; $this->uri = '/Users/' . \rawurlencode($userSid) . '/Conversations'; } /** * Streams UserConversationInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads UserConversationInstance 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 UserConversationInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of UserConversationInstance 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 UserConversationPage Page of UserConversationInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): UserConversationPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new UserConversationPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of UserConversationInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return UserConversationPage Page of UserConversationInstance */ public function getPage(string $targetUrl): UserConversationPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new UserConversationPage($this->version, $response, $this->solution); } /** * Constructs a UserConversationContext * * @param string $conversationSid The unique SID identifier of the Conversation. */ public function getContext(string $conversationSid): UserConversationContext { return new UserConversationContext($this->version, $this->solution['userSid'], $conversationSid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.UserConversationList]'; } }src/Twilio/Rest/Conversations/V1/User/UserConversationContext.php000064400000006102150515725700021155 0ustar00solution = ['userSid' => $userSid, 'conversationSid' => $conversationSid, ]; $this->uri = '/Users/' . \rawurlencode($userSid) . '/Conversations/' . \rawurlencode($conversationSid) . ''; } /** * Update the UserConversationInstance * * @param array|Options $options Optional Arguments * @return UserConversationInstance Updated UserConversationInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): UserConversationInstance { $options = new Values($options); $data = Values::of([ 'NotificationLevel' => $options['notificationLevel'], 'LastReadTimestamp' => Serialize::iso8601DateTime($options['lastReadTimestamp']), 'LastReadMessageIndex' => $options['lastReadMessageIndex'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new UserConversationInstance( $this->version, $payload, $this->solution['userSid'], $this->solution['conversationSid'] ); } /** * Delete the UserConversationInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Fetch the UserConversationInstance * * @return UserConversationInstance Fetched UserConversationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): UserConversationInstance { $payload = $this->version->fetch('GET', $this->uri); return new UserConversationInstance( $this->version, $payload, $this->solution['userSid'], $this->solution['conversationSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.UserConversationContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/User/UserConversationInstance.php000064400000013035150515725700021300 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'chatServiceSid' => Values::array_get($payload, 'chat_service_sid'), 'conversationSid' => Values::array_get($payload, 'conversation_sid'), 'unreadMessagesCount' => Values::array_get($payload, 'unread_messages_count'), 'lastReadMessageIndex' => Values::array_get($payload, 'last_read_message_index'), 'participantSid' => Values::array_get($payload, 'participant_sid'), 'userSid' => Values::array_get($payload, 'user_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'conversationState' => Values::array_get($payload, 'conversation_state'), 'timers' => Values::array_get($payload, 'timers'), 'attributes' => Values::array_get($payload, 'attributes'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'createdBy' => Values::array_get($payload, 'created_by'), 'notificationLevel' => Values::array_get($payload, 'notification_level'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = [ 'userSid' => $userSid, 'conversationSid' => $conversationSid ?: $this->properties['conversationSid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return UserConversationContext Context for this UserConversationInstance */ protected function proxy(): UserConversationContext { if (!$this->context) { $this->context = new UserConversationContext( $this->version, $this->solution['userSid'], $this->solution['conversationSid'] ); } return $this->context; } /** * Update the UserConversationInstance * * @param array|Options $options Optional Arguments * @return UserConversationInstance Updated UserConversationInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): UserConversationInstance { return $this->proxy()->update($options); } /** * Delete the UserConversationInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Fetch the UserConversationInstance * * @return UserConversationInstance Fetched UserConversationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): UserConversationInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.UserConversationInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/ParticipantConversationList.php000064400000011762150515725700021076 0ustar00solution = []; $this->uri = '/ParticipantConversations'; } /** * Streams ParticipantConversationInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ParticipantConversationInstance 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 ParticipantConversationInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of ParticipantConversationInstance 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 ParticipantConversationPage Page of ParticipantConversationInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ParticipantConversationPage { $options = new Values($options); $params = Values::of([ 'Identity' => $options['identity'], 'Address' => $options['address'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ParticipantConversationPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ParticipantConversationInstance records from the * API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ParticipantConversationPage Page of ParticipantConversationInstance */ public function getPage(string $targetUrl): ParticipantConversationPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ParticipantConversationPage($this->version, $response, $this->solution); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.ParticipantConversationList]'; } }src/Twilio/Rest/Conversations/V1/ParticipantConversationPage.php000064400000002356150515725700021036 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ParticipantConversationInstance \Twilio\Rest\Conversations\V1\ParticipantConversationInstance */ public function buildInstance(array $payload): ParticipantConversationInstance { return new ParticipantConversationInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.ParticipantConversationPage]'; } }src/Twilio/Rest/Conversations/V1/RolePage.php000064400000002174150515725700015064 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return RoleInstance \Twilio\Rest\Conversations\V1\RoleInstance */ public function buildInstance(array $payload): RoleInstance { return new RoleInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.RolePage]'; } }src/Twilio/Rest/Conversations/V1/CredentialOptions.php000064400000030551150515725700017014 0ustar00options['friendlyName'] = $friendlyName; $this->options['certificate'] = $certificate; $this->options['privateKey'] = $privateKey; $this->options['sandbox'] = $sandbox; $this->options['apiKey'] = $apiKey; $this->options['secret'] = $secret; } /** * A descriptive string that you create to describe the new resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * [APN only] The URL encoded representation of the certificate. For example, `-----BEGIN CERTIFICATE----- MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEF.....A== -----END CERTIFICATE-----`. * * @param string $certificate [APN only] The URL encoded representation of the * certificate. * @return $this Fluent Builder */ public function setCertificate(string $certificate): self { $this->options['certificate'] = $certificate; return $this; } /** * [APN only] The URL encoded representation of the private key. For example, `-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fG... -----END RSA PRIVATE KEY-----`. * * @param string $privateKey [APN only] The URL encoded representation of the * private key. * @return $this Fluent Builder */ public function setPrivateKey(string $privateKey): self { $this->options['privateKey'] = $privateKey; return $this; } /** * [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. * * @param bool $sandbox [APN only] Whether to send the credential to sandbox * APNs. * @return $this Fluent Builder */ public function setSandbox(bool $sandbox): self { $this->options['sandbox'] = $sandbox; return $this; } /** * [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential. * * @param string $apiKey [GCM only] The API key for the project that was * obtained from the Google Developer console for your * GCM Service application credential. * @return $this Fluent Builder */ public function setApiKey(string $apiKey): self { $this->options['apiKey'] = $apiKey; return $this; } /** * [FCM only] The **Server key** of your project from the Firebase console, found under Settings / Cloud messaging. * * @param string $secret [FCM only] The Server key of your project from * Firebase console. * @return $this Fluent Builder */ public function setSecret(string $secret): self { $this->options['secret'] = $secret; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.CreateCredentialOptions ' . $options . ']'; } } class UpdateCredentialOptions extends Options { /** * @param string $type The type of push-notification service the credential is * for. * @param string $friendlyName A string to describe the resource * @param string $certificate [APN only] The URL encoded representation of the * certificate. * @param string $privateKey [APN only] The URL encoded representation of the * private key. * @param bool $sandbox [APN only] Whether to send the credential to sandbox * APNs. * @param string $apiKey [GCM only] The API key for the project that was * obtained from the Google Developer console for your * GCM Service application credential. * @param string $secret [FCM only] The Server key of your project from * Firebase console. */ public function __construct(string $type = Values::NONE, string $friendlyName = Values::NONE, string $certificate = Values::NONE, string $privateKey = Values::NONE, bool $sandbox = Values::NONE, string $apiKey = Values::NONE, string $secret = Values::NONE) { $this->options['type'] = $type; $this->options['friendlyName'] = $friendlyName; $this->options['certificate'] = $certificate; $this->options['privateKey'] = $privateKey; $this->options['sandbox'] = $sandbox; $this->options['apiKey'] = $apiKey; $this->options['secret'] = $secret; } /** * The type of push-notification service the credential is for. Can be: `fcm`, `gcm`, or `apn`. * * @param string $type The type of push-notification service the credential is * for. * @return $this Fluent Builder */ public function setType(string $type): self { $this->options['type'] = $type; return $this; } /** * A descriptive string that you create to describe the new resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * [APN only] The URL encoded representation of the certificate. For example, `-----BEGIN CERTIFICATE----- MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEF.....A== -----END CERTIFICATE-----`. * * @param string $certificate [APN only] The URL encoded representation of the * certificate. * @return $this Fluent Builder */ public function setCertificate(string $certificate): self { $this->options['certificate'] = $certificate; return $this; } /** * [APN only] The URL encoded representation of the private key. For example, `-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fG... -----END RSA PRIVATE KEY-----`. * * @param string $privateKey [APN only] The URL encoded representation of the * private key. * @return $this Fluent Builder */ public function setPrivateKey(string $privateKey): self { $this->options['privateKey'] = $privateKey; return $this; } /** * [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. * * @param bool $sandbox [APN only] Whether to send the credential to sandbox * APNs. * @return $this Fluent Builder */ public function setSandbox(bool $sandbox): self { $this->options['sandbox'] = $sandbox; return $this; } /** * [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential. * * @param string $apiKey [GCM only] The API key for the project that was * obtained from the Google Developer console for your * GCM Service application credential. * @return $this Fluent Builder */ public function setApiKey(string $apiKey): self { $this->options['apiKey'] = $apiKey; return $this; } /** * [FCM only] The **Server key** of your project from the Firebase console, found under Settings / Cloud messaging. * * @param string $secret [FCM only] The Server key of your project from * Firebase console. * @return $this Fluent Builder */ public function setSecret(string $secret): self { $this->options['secret'] = $secret; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.UpdateCredentialOptions ' . $options . ']'; } }src/Twilio/Rest/Conversations/V1/ConfigurationOptions.php000064400000013317150515725700017552 0ustar00options['defaultChatServiceSid'] = $defaultChatServiceSid; $this->options['defaultMessagingServiceSid'] = $defaultMessagingServiceSid; $this->options['defaultInactiveTimer'] = $defaultInactiveTimer; $this->options['defaultClosedTimer'] = $defaultClosedTimer; } /** * The SID of the default [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) to use when creating a conversation. * * @param string $defaultChatServiceSid The SID of the default Conversation * Service that every new conversation * will be associated with. * @return $this Fluent Builder */ public function setDefaultChatServiceSid(string $defaultChatServiceSid): self { $this->options['defaultChatServiceSid'] = $defaultChatServiceSid; return $this; } /** * The SID of the default [Messaging Service](https://www.twilio.com/docs/sms/services/api) to use when creating a conversation. * * @param string $defaultMessagingServiceSid The SID of the default Messaging * Service that every new * conversation will be associated * with. * @return $this Fluent Builder */ public function setDefaultMessagingServiceSid(string $defaultMessagingServiceSid): self { $this->options['defaultMessagingServiceSid'] = $defaultMessagingServiceSid; return $this; } /** * Default ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. * * @param string $defaultInactiveTimer Default ISO8601 duration when * conversation will be switched to * `inactive` state. * @return $this Fluent Builder */ public function setDefaultInactiveTimer(string $defaultInactiveTimer): self { $this->options['defaultInactiveTimer'] = $defaultInactiveTimer; return $this; } /** * Default ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. * * @param string $defaultClosedTimer Default ISO8601 duration when conversation * will be switched to `closed` state. * @return $this Fluent Builder */ public function setDefaultClosedTimer(string $defaultClosedTimer): self { $this->options['defaultClosedTimer'] = $defaultClosedTimer; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Conversations.V1.UpdateConfigurationOptions ' . $options . ']'; } }src/Twilio/Rest/Conversations/V1/ServicePage.php000064400000002216150515725700015560 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ServiceInstance \Twilio\Rest\Conversations\V1\ServiceInstance */ public function buildInstance(array $payload): ServiceInstance { return new ServiceInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.ServicePage]'; } }src/Twilio/Rest/Conversations/V1/UserList.php000064400000012607150515725700015142 0ustar00solution = []; $this->uri = '/Users'; } /** * Create the UserInstance * * @param string $identity The string that identifies the resource's User * @param array|Options $options Optional Arguments * @return UserInstance Created UserInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $identity, array $options = []): UserInstance { $options = new Values($options); $data = Values::of([ 'Identity' => $identity, 'FriendlyName' => $options['friendlyName'], 'Attributes' => $options['attributes'], 'RoleSid' => $options['roleSid'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->create('POST', $this->uri, [], $data, $headers); return new UserInstance($this->version, $payload); } /** * Streams UserInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads UserInstance 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 UserInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of UserInstance 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 UserPage Page of UserInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): UserPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new UserPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of UserInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return UserPage Page of UserInstance */ public function getPage(string $targetUrl): UserPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new UserPage($this->version, $response, $this->solution); } /** * Constructs a UserContext * * @param string $sid The SID of the User resource to fetch */ public function getContext(string $sid): UserContext { return new UserContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.UserList]'; } }src/Twilio/Rest/Conversations/V1/CredentialPage.php000064400000002240150515725700016227 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CredentialInstance \Twilio\Rest\Conversations\V1\CredentialInstance */ public function buildInstance(array $payload): CredentialInstance { return new CredentialInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.CredentialPage]'; } }src/Twilio/Rest/Conversations/V1/ConversationList.php000064400000013642150515725700016676 0ustar00solution = []; $this->uri = '/Conversations'; } /** * Create the ConversationInstance * * @param array|Options $options Optional Arguments * @return ConversationInstance Created ConversationInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): ConversationInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'UniqueName' => $options['uniqueName'], 'DateCreated' => Serialize::iso8601DateTime($options['dateCreated']), 'DateUpdated' => Serialize::iso8601DateTime($options['dateUpdated']), 'MessagingServiceSid' => $options['messagingServiceSid'], 'Attributes' => $options['attributes'], 'State' => $options['state'], 'Timers.Inactive' => $options['timersInactive'], 'Timers.Closed' => $options['timersClosed'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->create('POST', $this->uri, [], $data, $headers); return new ConversationInstance($this->version, $payload); } /** * Streams ConversationInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ConversationInstance 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 ConversationInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of ConversationInstance 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 ConversationPage Page of ConversationInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ConversationPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ConversationPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ConversationInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ConversationPage Page of ConversationInstance */ public function getPage(string $targetUrl): ConversationPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ConversationPage($this->version, $response, $this->solution); } /** * Constructs a ConversationContext * * @param string $sid A 34 character string that uniquely identifies this * resource. */ public function getContext(string $sid): ConversationContext { return new ConversationContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.ConversationList]'; } }src/Twilio/Rest/Conversations/V1/UserInstance.php000064400000011375150515725700015774 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'chatServiceSid' => Values::array_get($payload, 'chat_service_sid'), 'roleSid' => Values::array_get($payload, 'role_sid'), 'identity' => Values::array_get($payload, 'identity'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'attributes' => Values::array_get($payload, 'attributes'), 'isOnline' => Values::array_get($payload, 'is_online'), 'isNotifiable' => Values::array_get($payload, 'is_notifiable'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 UserContext Context for this UserInstance */ protected function proxy(): UserContext { if (!$this->context) { $this->context = new UserContext($this->version, $this->solution['sid']); } return $this->context; } /** * Update the UserInstance * * @param array|Options $options Optional Arguments * @return UserInstance Updated UserInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): UserInstance { return $this->proxy()->update($options); } /** * Delete the UserInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { return $this->proxy()->delete($options); } /** * Fetch the UserInstance * * @return UserInstance Fetched UserInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): UserInstance { return $this->proxy()->fetch(); } /** * Access the userConversations */ protected function getUserConversations(): UserConversationList { return $this->proxy()->userConversations; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.UserInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/ServiceList.php000064400000012146150515725700015622 0ustar00solution = []; $this->uri = '/Services'; } /** * Create the ServiceInstance * * @param string $friendlyName The human-readable name of this service. * @return ServiceInstance Created ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName): ServiceInstance { $data = Values::of(['FriendlyName' => $friendlyName, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ServiceInstance($this->version, $payload); } /** * Streams ServiceInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ServiceInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return ServiceInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of ServiceInstance records from the API. * Request is executed immediately * * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return ServicePage Page of ServiceInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ServicePage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ServicePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ServiceInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ServicePage Page of ServiceInstance */ public function getPage(string $targetUrl): ServicePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ServicePage($this->version, $response, $this->solution); } /** * Constructs a ServiceContext * * @param string $sid A 34 character string that uniquely identifies this * resource. */ public function getContext(string $sid): ServiceContext { return new ServiceContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Conversations.V1.ServiceList]'; } }src/Twilio/Rest/Conversations/V1/ConfigurationContext.php000064400000004352150515725700017542 0ustar00solution = []; $this->uri = '/Configuration'; } /** * Fetch the ConfigurationInstance * * @return ConfigurationInstance Fetched ConfigurationInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ConfigurationInstance { $payload = $this->version->fetch('GET', $this->uri); return new ConfigurationInstance($this->version, $payload); } /** * Update the ConfigurationInstance * * @param array|Options $options Optional Arguments * @return ConfigurationInstance Updated ConfigurationInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ConfigurationInstance { $options = new Values($options); $data = Values::of([ 'DefaultChatServiceSid' => $options['defaultChatServiceSid'], 'DefaultMessagingServiceSid' => $options['defaultMessagingServiceSid'], 'DefaultInactiveTimer' => $options['defaultInactiveTimer'], 'DefaultClosedTimer' => $options['defaultClosedTimer'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ConfigurationInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.ConfigurationContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1/CredentialInstance.php000064400000010035150515725700017120 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'type' => Values::array_get($payload, 'type'), 'sandbox' => Values::array_get($payload, 'sandbox'), '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 = ['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 CredentialContext Context for this CredentialInstance */ protected function proxy(): CredentialContext { if (!$this->context) { $this->context = new CredentialContext($this->version, $this->solution['sid']); } return $this->context; } /** * Update the CredentialInstance * * @param array|Options $options Optional Arguments * @return CredentialInstance Updated CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): CredentialInstance { return $this->proxy()->update($options); } /** * Delete the CredentialInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Fetch the CredentialInstance * * @return CredentialInstance Fetched CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CredentialInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.CredentialInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Conversations/V1.php000064400000010737150515725700013372 0ustar00version = 'v1'; } protected function getConfiguration(): ConfigurationList { if (!$this->_configuration) { $this->_configuration = new ConfigurationList($this); } return $this->_configuration; } protected function getConversations(): ConversationList { if (!$this->_conversations) { $this->_conversations = new ConversationList($this); } return $this->_conversations; } protected function getCredentials(): CredentialList { if (!$this->_credentials) { $this->_credentials = new CredentialList($this); } return $this->_credentials; } protected function getParticipantConversations(): ParticipantConversationList { if (!$this->_participantConversations) { $this->_participantConversations = new ParticipantConversationList($this); } return $this->_participantConversations; } protected function getRoles(): RoleList { if (!$this->_roles) { $this->_roles = new RoleList($this); } return $this->_roles; } protected function getServices(): ServiceList { if (!$this->_services) { $this->_services = new ServiceList($this); } return $this->_services; } protected function getUsers(): UserList { if (!$this->_users) { $this->_users = new UserList($this); } return $this->_users; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Conversations.V1]'; } }src/Twilio/Rest/Media/V1/PlayerStreamerOptions.php000064400000012127150515725700016062 0ustar00options['video'] = $video; $this->options['statusCallback'] = $statusCallback; $this->options['statusCallbackMethod'] = $statusCallbackMethod; } /** * Specifies whether the PlayerStreamer is configured to stream video. Defaults to `true`. * * @param bool $video Whether the PlayerStreamer is configured to stream video * @return $this Fluent Builder */ public function setVideo(bool $video): self { $this->options['video'] = $video; return $this; } /** * The URL to which Twilio will send asynchronous webhook requests for every PlayerStreamer event. See [Status Callbacks](/docs/live/status-callbacks) for more details. * * @param string $statusCallback The URL to which Twilio will send * PlayerStreamer event updates * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * The HTTP method Twilio should use to call the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`. * * @param string $statusCallbackMethod The HTTP method Twilio should use to * call the `status_callback` URL * @return $this Fluent Builder */ public function setStatusCallbackMethod(string $statusCallbackMethod): self { $this->options['statusCallbackMethod'] = $statusCallbackMethod; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Media.V1.CreatePlayerStreamerOptions ' . $options . ']'; } } class ReadPlayerStreamerOptions extends Options { /** * @param string $order The sort order of the list * @param string $status Status to filter by */ public function __construct(string $order = Values::NONE, string $status = Values::NONE) { $this->options['order'] = $order; $this->options['status'] = $status; } /** * The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default. * * @param string $order The sort order of the list * @return $this Fluent Builder */ public function setOrder(string $order): self { $this->options['order'] = $order; return $this; } /** * Status to filter by, with possible values `created`, `started`, `ended`, or `failed`. * * @param string $status Status to filter by * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Media.V1.ReadPlayerStreamerOptions ' . $options . ']'; } }src/Twilio/Rest/Media/V1/PlayerStreamerPage.php000064400000002240150515725700015276 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return PlayerStreamerInstance \Twilio\Rest\Media\V1\PlayerStreamerInstance */ public function buildInstance(array $payload): PlayerStreamerInstance { return new PlayerStreamerInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Media.V1.PlayerStreamerPage]'; } }src/Twilio/Rest/Media/V1/PlayerStreamerList.php000064400000013564150515725700015350 0ustar00solution = []; $this->uri = '/PlayerStreamers'; } /** * Create the PlayerStreamerInstance * * @param array|Options $options Optional Arguments * @return PlayerStreamerInstance Created PlayerStreamerInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): PlayerStreamerInstance { $options = new Values($options); $data = Values::of([ 'Video' => Serialize::booleanToString($options['video']), 'StatusCallback' => $options['statusCallback'], 'StatusCallbackMethod' => $options['statusCallbackMethod'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new PlayerStreamerInstance($this->version, $payload); } /** * Streams PlayerStreamerInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads PlayerStreamerInstance 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 PlayerStreamerInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of PlayerStreamerInstance 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 PlayerStreamerPage Page of PlayerStreamerInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): PlayerStreamerPage { $options = new Values($options); $params = Values::of([ 'Order' => $options['order'], 'Status' => $options['status'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new PlayerStreamerPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of PlayerStreamerInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return PlayerStreamerPage Page of PlayerStreamerInstance */ public function getPage(string $targetUrl): PlayerStreamerPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new PlayerStreamerPage($this->version, $response, $this->solution); } /** * Constructs a PlayerStreamerContext * * @param string $sid The SID that identifies the resource to fetch */ public function getContext(string $sid): PlayerStreamerContext { return new PlayerStreamerContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Media.V1.PlayerStreamerList]'; } }src/Twilio/Rest/Media/V1/MediaProcessorOptions.php000064400000014344150515725700016045 0ustar00options['extensionEnvironment'] = $extensionEnvironment; $this->options['statusCallback'] = $statusCallback; $this->options['statusCallbackMethod'] = $statusCallbackMethod; $this->options['maxDuration'] = $maxDuration; } /** * User-defined environment variables for the Media Extension, represented as a JSON dictionary of key/value strings. See the documentation for the specific [Media Extension](/docs/live/api/media-extensions-overview) you are using for more information about whether you need to provide this. * * @param array $extensionEnvironment The Media Extension environment * @return $this Fluent Builder */ public function setExtensionEnvironment(array $extensionEnvironment): self { $this->options['extensionEnvironment'] = $extensionEnvironment; return $this; } /** * The URL to which Twilio will send asynchronous webhook requests for every MediaProcessor event. See [Status Callbacks](/docs/live/status-callbacks) for details. * * @param string $statusCallback The URL to send MediaProcessor event updates * to your application * @return $this Fluent Builder */ public function setStatusCallback(string $statusCallback): self { $this->options['statusCallback'] = $statusCallback; return $this; } /** * The HTTP method Twilio should use to call the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`. * * @param string $statusCallbackMethod The HTTP method Twilio should use to * call the `status_callback` URL * @return $this Fluent Builder */ public function setStatusCallbackMethod(string $statusCallbackMethod): self { $this->options['statusCallbackMethod'] = $statusCallbackMethod; return $this; } /** * The maximum time, in seconds, that the MediaProcessor can run before automatically ends. The default value is 300 seconds, and the maximum value is 90000 seconds. Once this maximum duration is reached, Twilio will end the MediaProcessor, regardless of whether media is still streaming. * * @param int $maxDuration Maximum MediaProcessor duration in minutes * @return $this Fluent Builder */ public function setMaxDuration(int $maxDuration): self { $this->options['maxDuration'] = $maxDuration; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Media.V1.CreateMediaProcessorOptions ' . $options . ']'; } } class ReadMediaProcessorOptions extends Options { /** * @param string $order The sort order of the list * @param string $status Status to filter by */ public function __construct(string $order = Values::NONE, string $status = Values::NONE) { $this->options['order'] = $order; $this->options['status'] = $status; } /** * The sort order of the list by `date_created`. Can be: `asc` (ascending) or `desc` (descending) with `desc` as the default. * * @param string $order The sort order of the list * @return $this Fluent Builder */ public function setOrder(string $order): self { $this->options['order'] = $order; return $this; } /** * Status to filter by, with possible values `started`, `ended` or `failed`. * * @param string $status Status to filter by * @return $this Fluent Builder */ public function setStatus(string $status): self { $this->options['status'] = $status; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Media.V1.ReadMediaProcessorOptions ' . $options . ']'; } }src/Twilio/Rest/Media/V1/MediaProcessorContext.php000064400000004067150515725700016037 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/MediaProcessors/' . \rawurlencode($sid) . ''; } /** * Fetch the MediaProcessorInstance * * @return MediaProcessorInstance Fetched MediaProcessorInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MediaProcessorInstance { $payload = $this->version->fetch('GET', $this->uri); return new MediaProcessorInstance($this->version, $payload, $this->solution['sid']); } /** * Update the MediaProcessorInstance * * @param string $status The status of the MediaProcessor * @return MediaProcessorInstance Updated MediaProcessorInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $status): MediaProcessorInstance { $data = Values::of(['Status' => $status, ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new MediaProcessorInstance($this->version, $payload, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Media.V1.MediaProcessorContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Media/V1/PlayerStreamer/PlaybackGrantList.php000064400000002155150515725700020064 0ustar00solution = ['sid' => $sid, ]; } /** * Constructs a PlaybackGrantContext */ public function getContext(): PlaybackGrantContext { return new PlaybackGrantContext($this->version, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Media.V1.PlaybackGrantList]'; } }src/Twilio/Rest/Media/V1/PlayerStreamer/PlaybackGrantContext.php000064400000004356150515725700020602 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/PlayerStreamers/' . \rawurlencode($sid) . '/PlaybackGrant'; } /** * Create the PlaybackGrantInstance * * @param array|Options $options Optional Arguments * @return PlaybackGrantInstance Created PlaybackGrantInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): PlaybackGrantInstance { $options = new Values($options); $data = Values::of([ 'Ttl' => $options['ttl'], 'AccessControlAllowOrigin' => $options['accessControlAllowOrigin'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new PlaybackGrantInstance($this->version, $payload, $this->solution['sid']); } /** * Fetch the PlaybackGrantInstance * * @return PlaybackGrantInstance Fetched PlaybackGrantInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): PlaybackGrantInstance { $payload = $this->version->fetch('GET', $this->uri); return new PlaybackGrantInstance($this->version, $payload, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Media.V1.PlaybackGrantContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Media/V1/PlayerStreamer/PlaybackGrantOptions.php000064400000004647150515725700020614 0ustar00options['ttl'] = $ttl; $this->options['accessControlAllowOrigin'] = $accessControlAllowOrigin; } /** * The time to live of the PlaybackGrant. Default value is 15 seconds. Maximum value is 60 seconds. * * @param int $ttl The time to live of the PlaybackGrant * @return $this Fluent Builder */ public function setTtl(int $ttl): self { $this->options['ttl'] = $ttl; return $this; } /** * The full origin URL where the livestream can be streamed. If this is not provided, it can be streamed from any domain. * * @param string $accessControlAllowOrigin The full URL that is authorized to * play back the livestream * @return $this Fluent Builder */ public function setAccessControlAllowOrigin(string $accessControlAllowOrigin): self { $this->options['accessControlAllowOrigin'] = $accessControlAllowOrigin; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Media.V1.CreatePlaybackGrantOptions ' . $options . ']'; } }src/Twilio/Rest/Media/V1/PlayerStreamer/PlaybackGrantPage.php000064400000002320150515725700020017 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return PlaybackGrantInstance \Twilio\Rest\Media\V1\PlayerStreamer\PlaybackGrantInstance */ public function buildInstance(array $payload): PlaybackGrantInstance { return new PlaybackGrantInstance($this->version, $payload, $this->solution['sid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Media.V1.PlaybackGrantPage]'; } }src/Twilio/Rest/Media/V1/PlayerStreamer/PlaybackGrantInstance.php000064400000006752150515725700020724 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'url' => Values::array_get($payload, 'url'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'grant' => Values::array_get($payload, 'grant'), ]; $this->solution = ['sid' => $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 PlaybackGrantContext Context for this PlaybackGrantInstance */ protected function proxy(): PlaybackGrantContext { if (!$this->context) { $this->context = new PlaybackGrantContext($this->version, $this->solution['sid']); } return $this->context; } /** * Create the PlaybackGrantInstance * * @param array|Options $options Optional Arguments * @return PlaybackGrantInstance Created PlaybackGrantInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): PlaybackGrantInstance { return $this->proxy()->create($options); } /** * Fetch the PlaybackGrantInstance * * @return PlaybackGrantInstance Fetched PlaybackGrantInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): PlaybackGrantInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Media.V1.PlaybackGrantInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Media/V1/MediaProcessorInstance.php000064400000010351150515725700016150 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'sid' => Values::array_get($payload, 'sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'extension' => Values::array_get($payload, 'extension'), 'extensionContext' => Values::array_get($payload, 'extension_context'), 'status' => Values::array_get($payload, 'status'), 'url' => Values::array_get($payload, 'url'), 'endedReason' => Values::array_get($payload, 'ended_reason'), 'statusCallback' => Values::array_get($payload, 'status_callback'), 'statusCallbackMethod' => Values::array_get($payload, 'status_callback_method'), 'maxDuration' => Values::array_get($payload, 'max_duration'), ]; $this->solution = ['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 MediaProcessorContext Context for this MediaProcessorInstance */ protected function proxy(): MediaProcessorContext { if (!$this->context) { $this->context = new MediaProcessorContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the MediaProcessorInstance * * @return MediaProcessorInstance Fetched MediaProcessorInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MediaProcessorInstance { return $this->proxy()->fetch(); } /** * Update the MediaProcessorInstance * * @param string $status The status of the MediaProcessor * @return MediaProcessorInstance Updated MediaProcessorInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $status): MediaProcessorInstance { return $this->proxy()->update($status); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Media.V1.MediaProcessorInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Media/V1/PlayerStreamerContext.php000064400000007342150515725700016056 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/PlayerStreamers/' . \rawurlencode($sid) . ''; } /** * Fetch the PlayerStreamerInstance * * @return PlayerStreamerInstance Fetched PlayerStreamerInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): PlayerStreamerInstance { $payload = $this->version->fetch('GET', $this->uri); return new PlayerStreamerInstance($this->version, $payload, $this->solution['sid']); } /** * Update the PlayerStreamerInstance * * @param string $status The status the PlayerStreamer should be transitioned to * @return PlayerStreamerInstance Updated PlayerStreamerInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $status): PlayerStreamerInstance { $data = Values::of(['Status' => $status, ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new PlayerStreamerInstance($this->version, $payload, $this->solution['sid']); } /** * Access the playbackGrant */ protected function getPlaybackGrant(): PlaybackGrantList { if (!$this->_playbackGrant) { $this->_playbackGrant = new PlaybackGrantList($this->version, $this->solution['sid']); } return $this->_playbackGrant; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Media.V1.PlayerStreamerContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Media/V1/MediaProcessorPage.php000064400000002240150515725700015256 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return MediaProcessorInstance \Twilio\Rest\Media\V1\MediaProcessorInstance */ public function buildInstance(array $payload): MediaProcessorInstance { return new MediaProcessorInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Media.V1.MediaProcessorPage]'; } }src/Twilio/Rest/Media/V1/MediaProcessorList.php000064400000014317150515725700015325 0ustar00solution = []; $this->uri = '/MediaProcessors'; } /** * Create the MediaProcessorInstance * * @param string $extension The Media Extension name or URL * @param string $extensionContext The Media Extension context * @param array|Options $options Optional Arguments * @return MediaProcessorInstance Created MediaProcessorInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $extension, string $extensionContext, array $options = []): MediaProcessorInstance { $options = new Values($options); $data = Values::of([ 'Extension' => $extension, 'ExtensionContext' => $extensionContext, 'ExtensionEnvironment' => Serialize::jsonObject($options['extensionEnvironment']), 'StatusCallback' => $options['statusCallback'], 'StatusCallbackMethod' => $options['statusCallbackMethod'], 'MaxDuration' => $options['maxDuration'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new MediaProcessorInstance($this->version, $payload); } /** * Streams MediaProcessorInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads MediaProcessorInstance 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 MediaProcessorInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of MediaProcessorInstance 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 MediaProcessorPage Page of MediaProcessorInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): MediaProcessorPage { $options = new Values($options); $params = Values::of([ 'Order' => $options['order'], 'Status' => $options['status'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new MediaProcessorPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of MediaProcessorInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return MediaProcessorPage Page of MediaProcessorInstance */ public function getPage(string $targetUrl): MediaProcessorPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new MediaProcessorPage($this->version, $response, $this->solution); } /** * Constructs a MediaProcessorContext * * @param string $sid The SID that identifies the resource to fetch */ public function getContext(string $sid): MediaProcessorContext { return new MediaProcessorContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Media.V1.MediaProcessorList]'; } }src/Twilio/Rest/Media/V1/PlayerStreamerInstance.php000064400000010546150515725700016176 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'video' => Values::array_get($payload, 'video'), 'links' => Values::array_get($payload, 'links'), 'sid' => Values::array_get($payload, 'sid'), 'status' => Values::array_get($payload, 'status'), 'url' => Values::array_get($payload, 'url'), 'statusCallback' => Values::array_get($payload, 'status_callback'), 'statusCallbackMethod' => Values::array_get($payload, 'status_callback_method'), 'endedReason' => Values::array_get($payload, 'ended_reason'), ]; $this->solution = ['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 PlayerStreamerContext Context for this PlayerStreamerInstance */ protected function proxy(): PlayerStreamerContext { if (!$this->context) { $this->context = new PlayerStreamerContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the PlayerStreamerInstance * * @return PlayerStreamerInstance Fetched PlayerStreamerInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): PlayerStreamerInstance { return $this->proxy()->fetch(); } /** * Update the PlayerStreamerInstance * * @param string $status The status the PlayerStreamer should be transitioned to * @return PlayerStreamerInstance Updated PlayerStreamerInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $status): PlayerStreamerInstance { return $this->proxy()->update($status); } /** * Access the playbackGrant */ protected function getPlaybackGrant(): PlaybackGrantList { return $this->proxy()->playbackGrant; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Media.V1.PlayerStreamerInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Media/V1.php000064400000005234150515725700011550 0ustar00version = 'v1'; } protected function getMediaProcessor(): MediaProcessorList { if (!$this->_mediaProcessor) { $this->_mediaProcessor = new MediaProcessorList($this); } return $this->_mediaProcessor; } protected function getPlayerStreamer(): PlayerStreamerList { if (!$this->_playerStreamer) { $this->_playerStreamer = new PlayerStreamerList($this); } return $this->_playerStreamer; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Media.V1]'; } }src/Twilio/Rest/Serverless/V1/ServiceInstance.php000064400000012363150515725700015754 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'includeCredentials' => Values::array_get($payload, 'include_credentials'), 'uiEditable' => Values::array_get($payload, 'ui_editable'), 'domainBase' => Values::array_get($payload, 'domain_base'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 ServiceContext Context for this ServiceInstance */ protected function proxy(): ServiceContext { if (!$this->context) { $this->context = new ServiceContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the ServiceInstance * * @return ServiceInstance Fetched ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ServiceInstance { return $this->proxy()->fetch(); } /** * Delete the ServiceInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the ServiceInstance * * @param array|Options $options Optional Arguments * @return ServiceInstance Updated ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ServiceInstance { return $this->proxy()->update($options); } /** * Access the environments */ protected function getEnvironments(): EnvironmentList { return $this->proxy()->environments; } /** * Access the functions */ protected function getFunctions(): FunctionList { return $this->proxy()->functions; } /** * Access the assets */ protected function getAssets(): AssetList { return $this->proxy()->assets; } /** * Access the builds */ protected function getBuilds(): BuildList { return $this->proxy()->builds; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Serverless.V1.ServiceInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Serverless/V1/Service/BuildList.php000064400000013366150515725700016166 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Builds'; } /** * Streams BuildInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads BuildInstance 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 BuildInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of BuildInstance 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 BuildPage Page of BuildInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): BuildPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new BuildPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of BuildInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return BuildPage Page of BuildInstance */ public function getPage(string $targetUrl): BuildPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new BuildPage($this->version, $response, $this->solution); } /** * Create the BuildInstance * * @param array|Options $options Optional Arguments * @return BuildInstance Created BuildInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): BuildInstance { $options = new Values($options); $data = Values::of([ 'AssetVersions' => Serialize::map($options['assetVersions'], function($e) { return $e; }), 'FunctionVersions' => Serialize::map($options['functionVersions'], function($e) { return $e; }), 'Dependencies' => $options['dependencies'], 'Runtime' => $options['runtime'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new BuildInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Constructs a BuildContext * * @param string $sid The SID of the Build resource to fetch */ public function getContext(string $sid): BuildContext { return new BuildContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Serverless.V1.BuildList]'; } }src/Twilio/Rest/Serverless/V1/Service/Build/BuildStatusPage.php000064400000002633150515725700020365 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return BuildStatusInstance \Twilio\Rest\Serverless\V1\Service\Build\BuildStatusInstance */ public function buildInstance(array $payload): BuildStatusInstance { return new BuildStatusInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Serverless.V1.BuildStatusPage]'; } }src/Twilio/Rest/Serverless/V1/Service/Build/BuildStatusContext.php000064400000003641150515725700021135 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Builds/' . \rawurlencode($sid) . '/Status'; } /** * Fetch the BuildStatusInstance * * @return BuildStatusInstance Fetched BuildStatusInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): BuildStatusInstance { $payload = $this->version->fetch('GET', $this->uri); return new BuildStatusInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Serverless.V1.BuildStatusContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Serverless/V1/Service/Build/BuildStatusList.php000064400000002637150515725700020430 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; } /** * Constructs a BuildStatusContext */ public function getContext(): BuildStatusContext { return new BuildStatusContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Serverless.V1.BuildStatusList]'; } }src/Twilio/Rest/Serverless/V1/Service/Build/BuildStatusInstance.php000064400000006543150515725700021261 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'status' => Values::array_get($payload, 'status'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['serviceSid' => $serviceSid, 'sid' => $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 BuildStatusContext Context for this BuildStatusInstance */ protected function proxy(): BuildStatusContext { if (!$this->context) { $this->context = new BuildStatusContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the BuildStatusInstance * * @return BuildStatusInstance Fetched BuildStatusInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): BuildStatusInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Serverless.V1.BuildStatusInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Serverless/V1/Service/BuildOptions.php000064400000010473150515725700016702 0ustar00options['assetVersions'] = $assetVersions; $this->options['functionVersions'] = $functionVersions; $this->options['dependencies'] = $dependencies; $this->options['runtime'] = $runtime; } /** * The list of Asset Version resource SIDs to include in the Build. * * @param string[] $assetVersions The list of Asset Version resource SIDs to * include in the Build * @return $this Fluent Builder */ public function setAssetVersions(array $assetVersions): self { $this->options['assetVersions'] = $assetVersions; return $this; } /** * The list of the Function Version resource SIDs to include in the Build. * * @param string[] $functionVersions The list of the Function Version resource * SIDs to include in the Build * @return $this Fluent Builder */ public function setFunctionVersions(array $functionVersions): self { $this->options['functionVersions'] = $functionVersions; return $this; } /** * A list of objects that describe the Dependencies included in the Build. Each object contains the `name` and `version` of the dependency. * * @param string $dependencies A list of objects that describe the Dependencies * included in the Build * @return $this Fluent Builder */ public function setDependencies(string $dependencies): self { $this->options['dependencies'] = $dependencies; return $this; } /** * The Runtime version that will be used to run the Build resource when it is deployed. * * @param string $runtime The Runtime version that will be used to run the * Build. * @return $this Fluent Builder */ public function setRuntime(string $runtime): self { $this->options['runtime'] = $runtime; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Serverless.V1.CreateBuildOptions ' . $options . ']'; } }src/Twilio/Rest/Serverless/V1/Service/BuildContext.php000064400000007525150515725700016677 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Builds/' . \rawurlencode($sid) . ''; } /** * Fetch the BuildInstance * * @return BuildInstance Fetched BuildInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): BuildInstance { $payload = $this->version->fetch('GET', $this->uri); return new BuildInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Delete the BuildInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the buildStatus */ protected function getBuildStatus(): BuildStatusList { if (!$this->_buildStatus) { $this->_buildStatus = new BuildStatusList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_buildStatus; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Serverless.V1.BuildContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Serverless/V1/Service/FunctionPage.php000064400000002453150515725700016650 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return FunctionInstance \Twilio\Rest\Serverless\V1\Service\FunctionInstance */ public function buildInstance(array $payload): FunctionInstance { return new FunctionInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Serverless.V1.FunctionPage]'; } }src/Twilio/Rest/Serverless/V1/Service/FunctionInstance.php000064400000011202150515725700017530 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_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'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return FunctionContext Context for this FunctionInstance */ protected function proxy(): FunctionContext { if (!$this->context) { $this->context = new FunctionContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the FunctionInstance * * @return FunctionInstance Fetched FunctionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FunctionInstance { return $this->proxy()->fetch(); } /** * Delete the FunctionInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the FunctionInstance * * @param string $friendlyName A string to describe the Function resource * @return FunctionInstance Updated FunctionInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $friendlyName): FunctionInstance { return $this->proxy()->update($friendlyName); } /** * Access the functionVersions */ protected function getFunctionVersions(): FunctionVersionList { return $this->proxy()->functionVersions; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Serverless.V1.FunctionInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Serverless/V1/Service/AssetInstance.php000064400000011073150515725700017030 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_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'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return AssetContext Context for this AssetInstance */ protected function proxy(): AssetContext { if (!$this->context) { $this->context = new AssetContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the AssetInstance * * @return AssetInstance Fetched AssetInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AssetInstance { return $this->proxy()->fetch(); } /** * Delete the AssetInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the AssetInstance * * @param string $friendlyName A string to describe the Asset resource * @return AssetInstance Updated AssetInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $friendlyName): AssetInstance { return $this->proxy()->update($friendlyName); } /** * Access the assetVersions */ protected function getAssetVersions(): AssetVersionList { return $this->proxy()->assetVersions; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Serverless.V1.AssetInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Serverless/V1/Service/EnvironmentOptions.php000064400000003441150515725700020144 0ustar00options['domainSuffix'] = $domainSuffix; } /** * A URL-friendly name that represents the environment and forms part of the domain name. It can be a maximum of 16 characters. * * @param string $domainSuffix A URL-friendly name that represents the * environment * @return $this Fluent Builder */ public function setDomainSuffix(string $domainSuffix): self { $this->options['domainSuffix'] = $domainSuffix; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Serverless.V1.CreateEnvironmentOptions ' . $options . ']'; } }src/Twilio/Rest/Serverless/V1/Service/AssetPage.php000064400000002431150515725700016136 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return AssetInstance \Twilio\Rest\Serverless\V1\Service\AssetInstance */ public function buildInstance(array $payload): AssetInstance { return new AssetInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Serverless.V1.AssetPage]'; } }src/Twilio/Rest/Serverless/V1/Service/TwilioFunction/FunctionVersionList.php000064400000012656150515725700023240 0ustar00solution = ['serviceSid' => $serviceSid, 'functionSid' => $functionSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Functions/' . \rawurlencode($functionSid) . '/Versions'; } /** * Streams FunctionVersionInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads FunctionVersionInstance 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 FunctionVersionInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of FunctionVersionInstance 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 FunctionVersionPage Page of FunctionVersionInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): FunctionVersionPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new FunctionVersionPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of FunctionVersionInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return FunctionVersionPage Page of FunctionVersionInstance */ public function getPage(string $targetUrl): FunctionVersionPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new FunctionVersionPage($this->version, $response, $this->solution); } /** * Constructs a FunctionVersionContext * * @param string $sid The SID that identifies the Function Version resource to * fetch */ public function getContext(string $sid): FunctionVersionContext { return new FunctionVersionContext( $this->version, $this->solution['serviceSid'], $this->solution['functionSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Serverless.V1.FunctionVersionList]'; } }src/Twilio/Rest/Serverless/V1/Service/TwilioFunction/FunctionVersionInstance.php000064400000011046150515725700024061 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'functionSid' => Values::array_get($payload, 'function_sid'), 'path' => Values::array_get($payload, 'path'), 'visibility' => Values::array_get($payload, 'visibility'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'functionSid' => $functionSid, '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 FunctionVersionContext Context for this FunctionVersionInstance */ protected function proxy(): FunctionVersionContext { if (!$this->context) { $this->context = new FunctionVersionContext( $this->version, $this->solution['serviceSid'], $this->solution['functionSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the FunctionVersionInstance * * @return FunctionVersionInstance Fetched FunctionVersionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FunctionVersionInstance { return $this->proxy()->fetch(); } /** * Access the functionVersionContent */ protected function getFunctionVersionContent(): FunctionVersionContentList { return $this->proxy()->functionVersionContent; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Serverless.V1.FunctionVersionInstance ' . \implode(' ', $context) . ']'; } }Twilio/Rest/Serverless/V1/Service/TwilioFunction/FunctionVersion/FunctionVersionContentContext.php000064400000004557150515725700030361 0ustar00srcsolution = ['serviceSid' => $serviceSid, 'functionSid' => $functionSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Functions/' . \rawurlencode($functionSid) . '/Versions/' . \rawurlencode($sid) . '/Content'; } /** * Fetch the FunctionVersionContentInstance * * @return FunctionVersionContentInstance Fetched FunctionVersionContentInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FunctionVersionContentInstance { $payload = $this->version->fetch('GET', $this->uri); return new FunctionVersionContentInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['functionSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Serverless.V1.FunctionVersionContentContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Serverless/V1/Service/TwilioFunction/FunctionVersion/FunctionVersionContentPage.php000064400000003073150515725700027660 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return FunctionVersionContentInstance \Twilio\Rest\Serverless\V1\Service\TwilioFunction\FunctionVersion\FunctionVersionContentInstance */ public function buildInstance(array $payload): FunctionVersionContentInstance { return new FunctionVersionContentInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['functionSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Serverless.V1.FunctionVersionContentPage]'; } }Twilio/Rest/Serverless/V1/Service/TwilioFunction/FunctionVersion/FunctionVersionContentInstance.php000064400000007653150515725700030501 0ustar00srcproperties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'functionSid' => Values::array_get($payload, 'function_sid'), 'content' => Values::array_get($payload, 'content'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['serviceSid' => $serviceSid, 'functionSid' => $functionSid, 'sid' => $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 FunctionVersionContentContext Context for this * FunctionVersionContentInstance */ protected function proxy(): FunctionVersionContentContext { if (!$this->context) { $this->context = new FunctionVersionContentContext( $this->version, $this->solution['serviceSid'], $this->solution['functionSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the FunctionVersionContentInstance * * @return FunctionVersionContentInstance Fetched FunctionVersionContentInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FunctionVersionContentInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Serverless.V1.FunctionVersionContentInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Serverless/V1/Service/TwilioFunction/FunctionVersion/FunctionVersionContentList.php000064400000003421150515725700027714 0ustar00solution = ['serviceSid' => $serviceSid, 'functionSid' => $functionSid, 'sid' => $sid, ]; } /** * Constructs a FunctionVersionContentContext */ public function getContext(): FunctionVersionContentContext { return new FunctionVersionContentContext( $this->version, $this->solution['serviceSid'], $this->solution['functionSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Serverless.V1.FunctionVersionContentList]'; } }src/Twilio/Rest/Serverless/V1/Service/TwilioFunction/FunctionVersionContext.php000064400000010355150515725700023743 0ustar00solution = ['serviceSid' => $serviceSid, 'functionSid' => $functionSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Functions/' . \rawurlencode($functionSid) . '/Versions/' . \rawurlencode($sid) . ''; } /** * Fetch the FunctionVersionInstance * * @return FunctionVersionInstance Fetched FunctionVersionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FunctionVersionInstance { $payload = $this->version->fetch('GET', $this->uri); return new FunctionVersionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['functionSid'], $this->solution['sid'] ); } /** * Access the functionVersionContent */ protected function getFunctionVersionContent(): FunctionVersionContentList { if (!$this->_functionVersionContent) { $this->_functionVersionContent = new FunctionVersionContentList( $this->version, $this->solution['serviceSid'], $this->solution['functionSid'], $this->solution['sid'] ); } return $this->_functionVersionContent; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Serverless.V1.FunctionVersionContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Serverless/V1/Service/TwilioFunction/FunctionVersionPage.php000064400000002715150515725700023174 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return FunctionVersionInstance \Twilio\Rest\Serverless\V1\Service\TwilioFunction\FunctionVersionInstance */ public function buildInstance(array $payload): FunctionVersionInstance { return new FunctionVersionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['functionSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Serverless.V1.FunctionVersionPage]'; } }src/Twilio/Rest/Serverless/V1/Service/Environment/DeploymentList.php000064400000013737150515725700021555 0ustar00solution = ['serviceSid' => $serviceSid, 'environmentSid' => $environmentSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Environments/' . \rawurlencode($environmentSid) . '/Deployments'; } /** * Streams DeploymentInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads DeploymentInstance 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 DeploymentInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of DeploymentInstance 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 DeploymentPage Page of DeploymentInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): DeploymentPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new DeploymentPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of DeploymentInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return DeploymentPage Page of DeploymentInstance */ public function getPage(string $targetUrl): DeploymentPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new DeploymentPage($this->version, $response, $this->solution); } /** * Create the DeploymentInstance * * @param array|Options $options Optional Arguments * @return DeploymentInstance Created DeploymentInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): DeploymentInstance { $options = new Values($options); $data = Values::of(['BuildSid' => $options['buildSid'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new DeploymentInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['environmentSid'] ); } /** * Constructs a DeploymentContext * * @param string $sid The SID that identifies the Deployment resource to fetch */ public function getContext(string $sid): DeploymentContext { return new DeploymentContext( $this->version, $this->solution['serviceSid'], $this->solution['environmentSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Serverless.V1.DeploymentList]'; } }src/Twilio/Rest/Serverless/V1/Service/Environment/LogPage.php000064400000002602150515725700020104 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return LogInstance \Twilio\Rest\Serverless\V1\Service\Environment\LogInstance */ public function buildInstance(array $payload): LogInstance { return new LogInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['environmentSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Serverless.V1.LogPage]'; } }src/Twilio/Rest/Serverless/V1/Service/Environment/VariableInstance.php000064400000011342150515725700022001 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'environmentSid' => Values::array_get($payload, 'environment_sid'), 'key' => Values::array_get($payload, 'key'), 'value' => Values::array_get($payload, 'value'), '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 = [ 'serviceSid' => $serviceSid, 'environmentSid' => $environmentSid, '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 VariableContext Context for this VariableInstance */ protected function proxy(): VariableContext { if (!$this->context) { $this->context = new VariableContext( $this->version, $this->solution['serviceSid'], $this->solution['environmentSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the VariableInstance * * @return VariableInstance Fetched VariableInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): VariableInstance { return $this->proxy()->fetch(); } /** * Update the VariableInstance * * @param array|Options $options Optional Arguments * @return VariableInstance Updated VariableInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): VariableInstance { return $this->proxy()->update($options); } /** * Delete the VariableInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Serverless.V1.VariableInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Serverless/V1/Service/Environment/VariablePage.php000064400000002640150515725700021112 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return VariableInstance \Twilio\Rest\Serverless\V1\Service\Environment\VariableInstance */ public function buildInstance(array $payload): VariableInstance { return new VariableInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['environmentSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Serverless.V1.VariablePage]'; } }src/Twilio/Rest/Serverless/V1/Service/Environment/VariableList.php000064400000014002150515725700021144 0ustar00solution = ['serviceSid' => $serviceSid, 'environmentSid' => $environmentSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Environments/' . \rawurlencode($environmentSid) . '/Variables'; } /** * Streams VariableInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads VariableInstance 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 VariableInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of VariableInstance 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 VariablePage Page of VariableInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): VariablePage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new VariablePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of VariableInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return VariablePage Page of VariableInstance */ public function getPage(string $targetUrl): VariablePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new VariablePage($this->version, $response, $this->solution); } /** * Create the VariableInstance * * @param string $key A string by which the Variable resource can be referenced * @param string $value A string that contains the actual value of the Variable * @return VariableInstance Created VariableInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $key, string $value): VariableInstance { $data = Values::of(['Key' => $key, 'Value' => $value, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new VariableInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['environmentSid'] ); } /** * Constructs a VariableContext * * @param string $sid The SID of the Variable resource to fetch */ public function getContext(string $sid): VariableContext { return new VariableContext( $this->version, $this->solution['serviceSid'], $this->solution['environmentSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Serverless.V1.VariableList]'; } }src/Twilio/Rest/Serverless/V1/Service/Environment/LogContext.php000064400000004204150515725700020654 0ustar00solution = ['serviceSid' => $serviceSid, 'environmentSid' => $environmentSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Environments/' . \rawurlencode($environmentSid) . '/Logs/' . \rawurlencode($sid) . ''; } /** * Fetch the LogInstance * * @return LogInstance Fetched LogInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): LogInstance { $payload = $this->version->fetch('GET', $this->uri); return new LogInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['environmentSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Serverless.V1.LogContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Serverless/V1/Service/Environment/DeploymentContext.php000064400000004322150515725700022254 0ustar00solution = ['serviceSid' => $serviceSid, 'environmentSid' => $environmentSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Environments/' . \rawurlencode($environmentSid) . '/Deployments/' . \rawurlencode($sid) . ''; } /** * Fetch the DeploymentInstance * * @return DeploymentInstance Fetched DeploymentInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): DeploymentInstance { $payload = $this->version->fetch('GET', $this->uri); return new DeploymentInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['environmentSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Serverless.V1.DeploymentContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Serverless/V1/Service/Environment/DeploymentPage.php000064400000002654150515725700021512 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return DeploymentInstance \Twilio\Rest\Serverless\V1\Service\Environment\DeploymentInstance */ public function buildInstance(array $payload): DeploymentInstance { return new DeploymentInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['environmentSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Serverless.V1.DeploymentPage]'; } }src/Twilio/Rest/Serverless/V1/Service/Environment/LogOptions.php000064400000006734150515725700020675 0ustar00options['functionSid'] = $functionSid; $this->options['startDate'] = $startDate; $this->options['endDate'] = $endDate; } /** * The SID of the function whose invocation produced the Log resources to read. * * @param string $functionSid The SID of the function whose invocation produced * the Log resources to read * @return $this Fluent Builder */ public function setFunctionSid(string $functionSid): self { $this->options['functionSid'] = $functionSid; return $this; } /** * The date/time (in GMT, ISO 8601) after which the Log resources must have been created. Defaults to 1 day prior to current date/time. * * @param \DateTime $startDate The date and time after which the Log resources * must have been created. * @return $this Fluent Builder */ public function setStartDate(\DateTime $startDate): self { $this->options['startDate'] = $startDate; return $this; } /** * The date/time (in GMT, ISO 8601) before which the Log resources must have been created. Defaults to current date/time. * * @param \DateTime $endDate The date and time before which the Log resource * must have been created. * @return $this Fluent Builder */ public function setEndDate(\DateTime $endDate): self { $this->options['endDate'] = $endDate; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Serverless.V1.ReadLogOptions ' . $options . ']'; } }src/Twilio/Rest/Serverless/V1/Service/Environment/VariableOptions.php000064400000004307150515725700021673 0ustar00options['key'] = $key; $this->options['value'] = $value; } /** * A string by which the Variable resource can be referenced. It can be a maximum of 128 characters. * * @param string $key A string by which the Variable resource can be referenced * @return $this Fluent Builder */ public function setKey(string $key): self { $this->options['key'] = $key; return $this; } /** * A string that contains the actual value of the Variable. It can be a maximum of 450 bytes in size. * * @param string $value A string that contains the actual value of the Variable * @return $this Fluent Builder */ public function setValue(string $value): self { $this->options['value'] = $value; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Serverless.V1.UpdateVariableOptions ' . $options . ']'; } }src/Twilio/Rest/Serverless/V1/Service/Environment/LogInstance.php000064400000010535150515725700021000 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'environmentSid' => Values::array_get($payload, 'environment_sid'), 'buildSid' => Values::array_get($payload, 'build_sid'), 'deploymentSid' => Values::array_get($payload, 'deployment_sid'), 'functionSid' => Values::array_get($payload, 'function_sid'), 'requestSid' => Values::array_get($payload, 'request_sid'), 'level' => Values::array_get($payload, 'level'), 'message' => Values::array_get($payload, 'message'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'environmentSid' => $environmentSid, '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 LogContext Context for this LogInstance */ protected function proxy(): LogContext { if (!$this->context) { $this->context = new LogContext( $this->version, $this->solution['serviceSid'], $this->solution['environmentSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the LogInstance * * @return LogInstance Fetched LogInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): LogInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Serverless.V1.LogInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Serverless/V1/Service/Environment/VariableContext.php000064400000006276150515725700021673 0ustar00solution = ['serviceSid' => $serviceSid, 'environmentSid' => $environmentSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Environments/' . \rawurlencode($environmentSid) . '/Variables/' . \rawurlencode($sid) . ''; } /** * Fetch the VariableInstance * * @return VariableInstance Fetched VariableInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): VariableInstance { $payload = $this->version->fetch('GET', $this->uri); return new VariableInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['environmentSid'], $this->solution['sid'] ); } /** * Update the VariableInstance * * @param array|Options $options Optional Arguments * @return VariableInstance Updated VariableInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): VariableInstance { $options = new Values($options); $data = Values::of(['Key' => $options['key'], 'Value' => $options['value'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new VariableInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['environmentSid'], $this->solution['sid'] ); } /** * Delete the VariableInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Serverless.V1.VariableContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Serverless/V1/Service/Environment/DeploymentOptions.php000064400000003026150515725700022263 0ustar00options['buildSid'] = $buildSid; } /** * The SID of the Build for the Deployment. * * @param string $buildSid The SID of the Build for the Deployment * @return $this Fluent Builder */ public function setBuildSid(string $buildSid): self { $this->options['buildSid'] = $buildSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Serverless.V1.CreateDeploymentOptions ' . $options . ']'; } }src/Twilio/Rest/Serverless/V1/Service/Environment/DeploymentInstance.php000064400000010027150515725700022373 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'environmentSid' => Values::array_get($payload, 'environment_sid'), 'buildSid' => Values::array_get($payload, 'build_sid'), '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 = [ 'serviceSid' => $serviceSid, 'environmentSid' => $environmentSid, '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 DeploymentContext Context for this DeploymentInstance */ protected function proxy(): DeploymentContext { if (!$this->context) { $this->context = new DeploymentContext( $this->version, $this->solution['serviceSid'], $this->solution['environmentSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the DeploymentInstance * * @return DeploymentInstance Fetched DeploymentInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): DeploymentInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Serverless.V1.DeploymentInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Serverless/V1/Service/Environment/LogList.php000064400000013321150515725700020143 0ustar00solution = ['serviceSid' => $serviceSid, 'environmentSid' => $environmentSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Environments/' . \rawurlencode($environmentSid) . '/Logs'; } /** * Streams LogInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads LogInstance 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 LogInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of LogInstance 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 LogPage Page of LogInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): LogPage { $options = new Values($options); $params = Values::of([ 'FunctionSid' => $options['functionSid'], 'StartDate' => Serialize::iso8601DateTime($options['startDate']), 'EndDate' => Serialize::iso8601DateTime($options['endDate']), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new LogPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of LogInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return LogPage Page of LogInstance */ public function getPage(string $targetUrl): LogPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new LogPage($this->version, $response, $this->solution); } /** * Constructs a LogContext * * @param string $sid The SID that identifies the Log resource to fetch */ public function getContext(string $sid): LogContext { return new LogContext( $this->version, $this->solution['serviceSid'], $this->solution['environmentSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Serverless.V1.LogList]'; } }src/Twilio/Rest/Serverless/V1/Service/BuildInstance.php000064400000011134150515725700017006 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'status' => Values::array_get($payload, 'status'), 'assetVersions' => Values::array_get($payload, 'asset_versions'), 'functionVersions' => Values::array_get($payload, 'function_versions'), 'dependencies' => Values::array_get($payload, 'dependencies'), 'runtime' => Values::array_get($payload, 'runtime'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return BuildContext Context for this BuildInstance */ protected function proxy(): BuildContext { if (!$this->context) { $this->context = new BuildContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the BuildInstance * * @return BuildInstance Fetched BuildInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): BuildInstance { return $this->proxy()->fetch(); } /** * Delete the BuildInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the buildStatus */ protected function getBuildStatus(): BuildStatusList { return $this->proxy()->buildStatus; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Serverless.V1.BuildInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Serverless/V1/Service/EnvironmentContext.php000064400000011720150515725700020134 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Environments/' . \rawurlencode($sid) . ''; } /** * Fetch the EnvironmentInstance * * @return EnvironmentInstance Fetched EnvironmentInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): EnvironmentInstance { $payload = $this->version->fetch('GET', $this->uri); return new EnvironmentInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Delete the EnvironmentInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Access the variables */ protected function getVariables(): VariableList { if (!$this->_variables) { $this->_variables = new VariableList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_variables; } /** * Access the deployments */ protected function getDeployments(): DeploymentList { if (!$this->_deployments) { $this->_deployments = new DeploymentList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_deployments; } /** * Access the logs */ protected function getLogs(): LogList { if (!$this->_logs) { $this->_logs = new LogList($this->version, $this->solution['serviceSid'], $this->solution['sid']); } return $this->_logs; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Serverless.V1.EnvironmentContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Serverless/V1/Service/EnvironmentList.php000064400000013446150515725700017432 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Environments'; } /** * Streams EnvironmentInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads EnvironmentInstance 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 EnvironmentInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of EnvironmentInstance 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 EnvironmentPage Page of EnvironmentInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): EnvironmentPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new EnvironmentPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of EnvironmentInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return EnvironmentPage Page of EnvironmentInstance */ public function getPage(string $targetUrl): EnvironmentPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new EnvironmentPage($this->version, $response, $this->solution); } /** * Create the EnvironmentInstance * * @param string $uniqueName A user-defined string that uniquely identifies the * Environment resource * @param array|Options $options Optional Arguments * @return EnvironmentInstance Created EnvironmentInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $uniqueName, array $options = []): EnvironmentInstance { $options = new Values($options); $data = Values::of(['UniqueName' => $uniqueName, 'DomainSuffix' => $options['domainSuffix'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new EnvironmentInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Constructs a EnvironmentContext * * @param string $sid The SID of the Environment resource to fetch */ public function getContext(string $sid): EnvironmentContext { return new EnvironmentContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Serverless.V1.EnvironmentList]'; } }src/Twilio/Rest/Serverless/V1/Service/EnvironmentInstance.php000064400000011776150515725700020267 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'buildSid' => Values::array_get($payload, 'build_sid'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'domainSuffix' => Values::array_get($payload, 'domain_suffix'), 'domainName' => Values::array_get($payload, 'domain_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'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return EnvironmentContext Context for this EnvironmentInstance */ protected function proxy(): EnvironmentContext { if (!$this->context) { $this->context = new EnvironmentContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the EnvironmentInstance * * @return EnvironmentInstance Fetched EnvironmentInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): EnvironmentInstance { return $this->proxy()->fetch(); } /** * Delete the EnvironmentInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Access the variables */ protected function getVariables(): VariableList { return $this->proxy()->variables; } /** * Access the deployments */ protected function getDeployments(): DeploymentList { return $this->proxy()->deployments; } /** * Access the logs */ protected function getLogs(): LogList { return $this->proxy()->logs; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Serverless.V1.EnvironmentInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Serverless/V1/Service/FunctionList.php000064400000012750150515725700016710 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Functions'; } /** * Streams FunctionInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads FunctionInstance 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 FunctionInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of FunctionInstance 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 FunctionPage Page of FunctionInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): FunctionPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new FunctionPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of FunctionInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return FunctionPage Page of FunctionInstance */ public function getPage(string $targetUrl): FunctionPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new FunctionPage($this->version, $response, $this->solution); } /** * Create the FunctionInstance * * @param string $friendlyName A string to describe the Function resource * @return FunctionInstance Created FunctionInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName): FunctionInstance { $data = Values::of(['FriendlyName' => $friendlyName, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new FunctionInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Constructs a FunctionContext * * @param string $sid The SID of the Function resource to fetch */ public function getContext(string $sid): FunctionContext { return new FunctionContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Serverless.V1.FunctionList]'; } }src/Twilio/Rest/Serverless/V1/Service/EnvironmentPage.php000064400000002475150515725700017373 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return EnvironmentInstance \Twilio\Rest\Serverless\V1\Service\EnvironmentInstance */ public function buildInstance(array $payload): EnvironmentInstance { return new EnvironmentInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Serverless.V1.EnvironmentPage]'; } }src/Twilio/Rest/Serverless/V1/Service/AssetList.php000064400000012641150515725700016201 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Assets'; } /** * Streams AssetInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads AssetInstance 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 AssetInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of AssetInstance 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 AssetPage Page of AssetInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): AssetPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new AssetPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of AssetInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return AssetPage Page of AssetInstance */ public function getPage(string $targetUrl): AssetPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new AssetPage($this->version, $response, $this->solution); } /** * Create the AssetInstance * * @param string $friendlyName A string to describe the Asset resource * @return AssetInstance Created AssetInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName): AssetInstance { $data = Values::of(['FriendlyName' => $friendlyName, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new AssetInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Constructs a AssetContext * * @param string $sid The SID that identifies the Asset resource to fetch */ public function getContext(string $sid): AssetContext { return new AssetContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Serverless.V1.AssetList]'; } }src/Twilio/Rest/Serverless/V1/Service/FunctionContext.php000064400000011126150515725700017415 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Functions/' . \rawurlencode($sid) . ''; } /** * Fetch the FunctionInstance * * @return FunctionInstance Fetched FunctionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): FunctionInstance { $payload = $this->version->fetch('GET', $this->uri); return new FunctionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Delete the FunctionInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the FunctionInstance * * @param string $friendlyName A string to describe the Function resource * @return FunctionInstance Updated FunctionInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $friendlyName): FunctionInstance { $data = Values::of(['FriendlyName' => $friendlyName, ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new FunctionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Access the functionVersions */ protected function getFunctionVersions(): FunctionVersionList { if (!$this->_functionVersions) { $this->_functionVersions = new FunctionVersionList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_functionVersions; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Serverless.V1.FunctionContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Serverless/V1/Service/AssetContext.php000064400000010764150515725700016716 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Assets/' . \rawurlencode($sid) . ''; } /** * Fetch the AssetInstance * * @return AssetInstance Fetched AssetInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AssetInstance { $payload = $this->version->fetch('GET', $this->uri); return new AssetInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Delete the AssetInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the AssetInstance * * @param string $friendlyName A string to describe the Asset resource * @return AssetInstance Updated AssetInstance * @throws TwilioException When an HTTP error occurs. */ public function update(string $friendlyName): AssetInstance { $data = Values::of(['FriendlyName' => $friendlyName, ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new AssetInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Access the assetVersions */ protected function getAssetVersions(): AssetVersionList { if (!$this->_assetVersions) { $this->_assetVersions = new AssetVersionList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_assetVersions; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Serverless.V1.AssetContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Serverless/V1/Service/BuildPage.php000064400000002431150515725700016116 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return BuildInstance \Twilio\Rest\Serverless\V1\Service\BuildInstance */ public function buildInstance(array $payload): BuildInstance { return new BuildInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Serverless.V1.BuildPage]'; } }src/Twilio/Rest/Serverless/V1/Service/Asset/AssetVersionInstance.php000064400000010043150515725700021451 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'assetSid' => Values::array_get($payload, 'asset_sid'), 'path' => Values::array_get($payload, 'path'), 'visibility' => Values::array_get($payload, 'visibility'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'assetSid' => $assetSid, '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 AssetVersionContext Context for this AssetVersionInstance */ protected function proxy(): AssetVersionContext { if (!$this->context) { $this->context = new AssetVersionContext( $this->version, $this->solution['serviceSid'], $this->solution['assetSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the AssetVersionInstance * * @return AssetVersionInstance Fetched AssetVersionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AssetVersionInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Serverless.V1.AssetVersionInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Serverless/V1/Service/Asset/AssetVersionContext.php000064400000004346150515725700021342 0ustar00solution = ['serviceSid' => $serviceSid, 'assetSid' => $assetSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Assets/' . \rawurlencode($assetSid) . '/Versions/' . \rawurlencode($sid) . ''; } /** * Fetch the AssetVersionInstance * * @return AssetVersionInstance Fetched AssetVersionInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): AssetVersionInstance { $payload = $this->version->fetch('GET', $this->uri); return new AssetVersionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['assetSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Serverless.V1.AssetVersionContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Serverless/V1/Service/Asset/AssetVersionList.php000064400000012477150515725700020635 0ustar00solution = ['serviceSid' => $serviceSid, 'assetSid' => $assetSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Assets/' . \rawurlencode($assetSid) . '/Versions'; } /** * Streams AssetVersionInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads AssetVersionInstance 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 AssetVersionInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of AssetVersionInstance 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 AssetVersionPage Page of AssetVersionInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): AssetVersionPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new AssetVersionPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of AssetVersionInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return AssetVersionPage Page of AssetVersionInstance */ public function getPage(string $targetUrl): AssetVersionPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new AssetVersionPage($this->version, $response, $this->solution); } /** * Constructs a AssetVersionContext * * @param string $sid The SID that identifies the Asset Version resource to * fetch */ public function getContext(string $sid): AssetVersionContext { return new AssetVersionContext( $this->version, $this->solution['serviceSid'], $this->solution['assetSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Serverless.V1.AssetVersionList]'; } }src/Twilio/Rest/Serverless/V1/Service/Asset/AssetVersionPage.php000064400000002646150515725700020573 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return AssetVersionInstance \Twilio\Rest\Serverless\V1\Service\Asset\AssetVersionInstance */ public function buildInstance(array $payload): AssetVersionInstance { return new AssetVersionInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['assetSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Serverless.V1.AssetVersionPage]'; } }src/Twilio/Rest/Serverless/V1/ServiceContext.php000064400000013132150515725700015627 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($sid) . ''; } /** * Fetch the ServiceInstance * * @return ServiceInstance Fetched ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ServiceInstance { $payload = $this->version->fetch('GET', $this->uri); return new ServiceInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the ServiceInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the ServiceInstance * * @param array|Options $options Optional Arguments * @return ServiceInstance Updated ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ServiceInstance { $options = new Values($options); $data = Values::of([ 'IncludeCredentials' => Serialize::booleanToString($options['includeCredentials']), 'FriendlyName' => $options['friendlyName'], 'UiEditable' => Serialize::booleanToString($options['uiEditable']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ServiceInstance($this->version, $payload, $this->solution['sid']); } /** * Access the environments */ protected function getEnvironments(): EnvironmentList { if (!$this->_environments) { $this->_environments = new EnvironmentList($this->version, $this->solution['sid']); } return $this->_environments; } /** * Access the functions */ protected function getFunctions(): FunctionList { if (!$this->_functions) { $this->_functions = new FunctionList($this->version, $this->solution['sid']); } return $this->_functions; } /** * Access the assets */ protected function getAssets(): AssetList { if (!$this->_assets) { $this->_assets = new AssetList($this->version, $this->solution['sid']); } return $this->_assets; } /** * Access the builds */ protected function getBuilds(): BuildList { if (!$this->_builds) { $this->_builds = new BuildList($this->version, $this->solution['sid']); } return $this->_builds; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Serverless.V1.ServiceContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Serverless/V1/ServiceOptions.php000064400000013404150515725700015640 0ustar00options['includeCredentials'] = $includeCredentials; $this->options['uiEditable'] = $uiEditable; } /** * Whether to inject Account credentials into a function invocation context. The default value is `true`. * * @param bool $includeCredentials Whether to inject Account credentials into a * function invocation context * @return $this Fluent Builder */ public function setIncludeCredentials(bool $includeCredentials): self { $this->options['includeCredentials'] = $includeCredentials; return $this; } /** * Whether the Service's properties and subresources can be edited via the UI. The default value is `false`. * * @param bool $uiEditable Whether the Service's properties and subresources * can be edited via the UI * @return $this Fluent Builder */ public function setUiEditable(bool $uiEditable): self { $this->options['uiEditable'] = $uiEditable; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Serverless.V1.CreateServiceOptions ' . $options . ']'; } } class UpdateServiceOptions extends Options { /** * @param bool $includeCredentials Whether to inject Account credentials into a * function invocation context * @param string $friendlyName A string to describe the Service resource * @param bool $uiEditable Whether the Service resource's properties and * subresources can be edited via the UI */ public function __construct(bool $includeCredentials = Values::NONE, string $friendlyName = Values::NONE, bool $uiEditable = Values::NONE) { $this->options['includeCredentials'] = $includeCredentials; $this->options['friendlyName'] = $friendlyName; $this->options['uiEditable'] = $uiEditable; } /** * Whether to inject Account credentials into a function invocation context. * * @param bool $includeCredentials Whether to inject Account credentials into a * function invocation context * @return $this Fluent Builder */ public function setIncludeCredentials(bool $includeCredentials): self { $this->options['includeCredentials'] = $includeCredentials; return $this; } /** * A descriptive string that you create to describe the Service resource. It can be a maximum of 255 characters. * * @param string $friendlyName A string to describe the Service resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Whether the Service resource's properties and subresources can be edited via the UI. The default value is `false`. * * @param bool $uiEditable Whether the Service resource's properties and * subresources can be edited via the UI * @return $this Fluent Builder */ public function setUiEditable(bool $uiEditable): self { $this->options['uiEditable'] = $uiEditable; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Serverless.V1.UpdateServiceOptions ' . $options . ']'; } }src/Twilio/Rest/Serverless/V1/ServicePage.php000064400000002366150515725700015066 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ServiceInstance \Twilio\Rest\Serverless\V1\ServiceInstance */ public function buildInstance(array $payload): ServiceInstance { return new ServiceInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Serverless.V1.ServicePage]'; } }src/Twilio/Rest/Serverless/V1/ServiceList.php000064400000013314150515725700015120 0ustar00solution = []; $this->uri = '/Services'; } /** * Streams ServiceInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ServiceInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return ServiceInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of ServiceInstance records from the API. * Request is executed immediately * * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return ServicePage Page of ServiceInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ServicePage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ServicePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ServiceInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ServicePage Page of ServiceInstance */ public function getPage(string $targetUrl): ServicePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ServicePage($this->version, $response, $this->solution); } /** * Create the ServiceInstance * * @param string $uniqueName A user-defined string that uniquely identifies the * Service resource * @param string $friendlyName A string to describe the Service resource * @param array|Options $options Optional Arguments * @return ServiceInstance Created ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $uniqueName, string $friendlyName, array $options = []): ServiceInstance { $options = new Values($options); $data = Values::of([ 'UniqueName' => $uniqueName, 'FriendlyName' => $friendlyName, 'IncludeCredentials' => Serialize::booleanToString($options['includeCredentials']), 'UiEditable' => Serialize::booleanToString($options['uiEditable']), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ServiceInstance($this->version, $payload); } /** * Constructs a ServiceContext * * @param string $sid The SID of the Service resource to fetch */ public function getContext(string $sid): ServiceContext { return new ServiceContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Serverless.V1.ServiceList]'; } }src/Twilio/Rest/Serverless/V1.php000064400000004264150515725700012670 0ustar00version = 'v1'; } protected function getServices(): ServiceList { if (!$this->_services) { $this->_services = new ServiceList($this); } return $this->_services; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Serverless.V1]'; } }src/Twilio/Rest/Client.php000064400000101701150515725700011455 0ustar00environment = $environment ?: \getenv(); $this->username = $this->getArg($username, self::ENV_ACCOUNT_SID); $this->password = $this->getArg($password, self::ENV_AUTH_TOKEN); $this->region = $this->getArg($region, self::ENV_REGION); $this->edge = $this->getArg(null, self::ENV_EDGE); $this->logLevel = $this->getArg(null, self::ENV_LOG); if (!$this->username || !$this->password) { throw new ConfigurationException('Credentials are required to create a Client'); } $this->accountSid = $accountSid ?: $this->username; if ($httpClient) { $this->httpClient = $httpClient; } else { $this->httpClient = new CurlClient(); } } /** * Determines argument value accounting for environment variables. * * @param string $arg The constructor argument * @param string $envVar The environment variable name * @return ?string Argument value */ public function getArg(?string $arg, string $envVar): ?string { if ($arg) { return $arg; } if (\array_key_exists($envVar, $this->environment)) { return $this->environment[$envVar]; } return null; } /** * Makes a request to the Twilio API using the configured http client * Authentication information is automatically added if none is provided * * @param string $method HTTP Method * @param string $uri Fully qualified url * @param string[] $params Query string parameters * @param string[] $data POST body data * @param string[] $headers HTTP Headers * @param string $username User for Authentication * @param string $password Password for Authentication * @param int $timeout Timeout in seconds * @return \Twilio\Http\Response Response from the Twilio API */ public function request(string $method, string $uri, array $params = [], array $data = [], array $headers = [], string $username = null, string $password = null, int $timeout = null): \Twilio\Http\Response { $username = $username ?: $this->username; $password = $password ?: $this->password; $logLevel = (getenv('DEBUG_HTTP_TRAFFIC') === 'true' ? 'debug' : $this->getLogLevel()); $headers['User-Agent'] = 'twilio-php/' . VersionInfo::string() . ' (PHP ' . PHP_VERSION . ')'; $headers['Accept-Charset'] = 'utf-8'; if ($method === 'POST' && !\array_key_exists('Content-Type', $headers)) { $headers['Content-Type'] = 'application/x-www-form-urlencoded'; } if (!\array_key_exists('Accept', $headers)) { $headers['Accept'] = 'application/json'; } $uri = $this->buildUri($uri); if ($logLevel === 'debug') { error_log('-- BEGIN Twilio API Request --'); error_log('Request Method: ' . $method); $u = parse_url($uri); if (isset($u['path'])) { error_log('Request URL: ' . $u['path']); } if (isset($u['query']) && strlen($u['query']) > 0) { error_log('Query Params: ' . $u['query']); } error_log('Request Headers: '); foreach ($headers as $key => $value) { if (strpos(strtolower($key), 'authorization') === false) { error_log("$key: $value"); } } error_log('-- END Twilio API Request --'); } $response = $this->getHttpClient()->request( $method, $uri, $params, $data, $headers, $username, $password, $timeout ); if ($logLevel === 'debug') { error_log('Status Code: ' . $response->getStatusCode()); error_log('Response Headers:'); $responseHeaders = $response->getHeaders(); foreach ($responseHeaders as $key => $value) { error_log("$key: $value"); } } return $response; } /** * Build the final request uri * * @param string $uri The original request uri * @return string Request uri */ public function buildUri(string $uri): string { if ($this->region == null && $this->edge == null) { return $uri; } $parsedUrl = \parse_url($uri); $pieces = \explode('.', $parsedUrl['host']); $product = $pieces[0]; $domain = \implode('.', \array_slice($pieces, -2)); $newEdge = $this->edge; $newRegion = $this->region; if (count($pieces) == 4) { // product.region.twilio.com $newRegion = $newRegion ?: $pieces[1]; } elseif (count($pieces) == 5) { // product.edge.region.twilio.com $newEdge = $newEdge ?: $pieces[1]; $newRegion = $newRegion ?: $pieces[2]; } if ($newEdge != null && $newRegion == null) { $newRegion = self::DEFAULT_REGION; } $parsedUrl['host'] = \implode('.', \array_filter([$product, $newEdge, $newRegion, $domain])); return RequestValidator::unparse_url($parsedUrl); } /** * Retrieve the Username * * @return string Current Username */ public function getUsername(): string { return $this->username; } /** * Retrieve the Password * * @return string Current Password */ public function getPassword(): string { return $this->password; } /** * Retrieve the AccountSid * * @return string Current AccountSid */ public function getAccountSid(): string { return $this->accountSid; } /** * Retrieve the Region * * @return string Current Region */ public function getRegion(): string { return $this->region; } /** * Retrieve the Edge * * @return string Current Edge */ public function getEdge(): string { return $this->edge; } /** * Set Edge * * @param string $uri Edge to use, unsets the Edge when called with no arguments */ public function setEdge(string $edge = null): void { $this->edge = $this->getArg($edge, self::ENV_EDGE); } /** * Retrieve the HttpClient * * @return HttpClient Current HttpClient */ public function getHttpClient(): HttpClient { return $this->httpClient; } /** * Set the HttpClient * * @param HttpClient $httpClient HttpClient to use */ public function setHttpClient(HttpClient $httpClient): void { $this->httpClient = $httpClient; } /** * Retrieve the log level * * @return ?string Current log level */ public function getLogLevel(): ?string { return $this->logLevel; } /** * Set log level to debug * * @param string $logLevel log level to use */ public function setLogLevel(string $logLevel = null): void { $this->logLevel = $this->getArg($logLevel, self::ENV_LOG); } /** * Access the Accounts Twilio Domain * * @return Accounts Accounts Twilio Domain */ protected function getAccounts(): Accounts { if (!$this->_accounts) { $this->_accounts = new Accounts($this); } return $this->_accounts; } /** * Access the Api Twilio Domain * * @return Api Api Twilio Domain */ protected function getApi(): Api { if (!$this->_api) { $this->_api = new Api($this); } return $this->_api; } /** * @return \Twilio\Rest\Api\V2010\AccountContext Account provided as the * authenticating account */ public function getAccount(): \Twilio\Rest\Api\V2010\AccountContext { return $this->api->v2010->account; } protected function getAddresses(): \Twilio\Rest\Api\V2010\Account\AddressList { return $this->api->v2010->account->addresses; } /** * @param string $sid The unique string that identifies the resource */ protected function contextAddresses(string $sid): \Twilio\Rest\Api\V2010\Account\AddressContext { return $this->api->v2010->account->addresses($sid); } protected function getApplications(): \Twilio\Rest\Api\V2010\Account\ApplicationList { return $this->api->v2010->account->applications; } /** * @param string $sid The unique string that identifies the resource */ protected function contextApplications(string $sid): \Twilio\Rest\Api\V2010\Account\ApplicationContext { return $this->api->v2010->account->applications($sid); } protected function getAuthorizedConnectApps(): \Twilio\Rest\Api\V2010\Account\AuthorizedConnectAppList { return $this->api->v2010->account->authorizedConnectApps; } /** * @param string $connectAppSid The SID of the Connect App to fetch */ protected function contextAuthorizedConnectApps(string $connectAppSid): \Twilio\Rest\Api\V2010\Account\AuthorizedConnectAppContext { return $this->api->v2010->account->authorizedConnectApps($connectAppSid); } protected function getAvailablePhoneNumbers(): \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountryList { return $this->api->v2010->account->availablePhoneNumbers; } /** * @param string $countryCode The ISO country code of the country to fetch * available phone number information about */ protected function contextAvailablePhoneNumbers(string $countryCode): \Twilio\Rest\Api\V2010\Account\AvailablePhoneNumberCountryContext { return $this->api->v2010->account->availablePhoneNumbers($countryCode); } protected function getBalance(): \Twilio\Rest\Api\V2010\Account\BalanceList { return $this->api->v2010->account->balance; } protected function getCalls(): \Twilio\Rest\Api\V2010\Account\CallList { return $this->api->v2010->account->calls; } /** * @param string $sid The SID of the Call resource to fetch */ protected function contextCalls(string $sid): \Twilio\Rest\Api\V2010\Account\CallContext { return $this->api->v2010->account->calls($sid); } protected function getConferences(): \Twilio\Rest\Api\V2010\Account\ConferenceList { return $this->api->v2010->account->conferences; } /** * @param string $sid The unique string that identifies this resource */ protected function contextConferences(string $sid): \Twilio\Rest\Api\V2010\Account\ConferenceContext { return $this->api->v2010->account->conferences($sid); } protected function getConnectApps(): \Twilio\Rest\Api\V2010\Account\ConnectAppList { return $this->api->v2010->account->connectApps; } /** * @param string $sid The unique string that identifies the resource */ protected function contextConnectApps(string $sid): \Twilio\Rest\Api\V2010\Account\ConnectAppContext { return $this->api->v2010->account->connectApps($sid); } protected function getIncomingPhoneNumbers(): \Twilio\Rest\Api\V2010\Account\IncomingPhoneNumberList { return $this->api->v2010->account->incomingPhoneNumbers; } /** * @param string $sid The unique string that identifies the resource */ protected function contextIncomingPhoneNumbers(string $sid): \Twilio\Rest\Api\V2010\Account\IncomingPhoneNumberContext { return $this->api->v2010->account->incomingPhoneNumbers($sid); } protected function getKeys(): \Twilio\Rest\Api\V2010\Account\KeyList { return $this->api->v2010->account->keys; } /** * @param string $sid The unique string that identifies the resource */ protected function contextKeys(string $sid): \Twilio\Rest\Api\V2010\Account\KeyContext { return $this->api->v2010->account->keys($sid); } protected function getMessages(): \Twilio\Rest\Api\V2010\Account\MessageList { return $this->api->v2010->account->messages; } /** * @param string $sid The unique string that identifies the resource */ protected function contextMessages(string $sid): \Twilio\Rest\Api\V2010\Account\MessageContext { return $this->api->v2010->account->messages($sid); } protected function getNewKeys(): \Twilio\Rest\Api\V2010\Account\NewKeyList { return $this->api->v2010->account->newKeys; } protected function getNewSigningKeys(): \Twilio\Rest\Api\V2010\Account\NewSigningKeyList { return $this->api->v2010->account->newSigningKeys; } protected function getNotifications(): \Twilio\Rest\Api\V2010\Account\NotificationList { return $this->api->v2010->account->notifications; } /** * @param string $sid The unique string that identifies the resource */ protected function contextNotifications(string $sid): \Twilio\Rest\Api\V2010\Account\NotificationContext { return $this->api->v2010->account->notifications($sid); } protected function getOutgoingCallerIds(): \Twilio\Rest\Api\V2010\Account\OutgoingCallerIdList { return $this->api->v2010->account->outgoingCallerIds; } /** * @param string $sid The unique string that identifies the resource */ protected function contextOutgoingCallerIds(string $sid): \Twilio\Rest\Api\V2010\Account\OutgoingCallerIdContext { return $this->api->v2010->account->outgoingCallerIds($sid); } protected function getQueues(): \Twilio\Rest\Api\V2010\Account\QueueList { return $this->api->v2010->account->queues; } /** * @param string $sid The unique string that identifies this resource */ protected function contextQueues(string $sid): \Twilio\Rest\Api\V2010\Account\QueueContext { return $this->api->v2010->account->queues($sid); } protected function getRecordings(): \Twilio\Rest\Api\V2010\Account\RecordingList { return $this->api->v2010->account->recordings; } /** * @param string $sid The unique string that identifies the resource */ protected function contextRecordings(string $sid): \Twilio\Rest\Api\V2010\Account\RecordingContext { return $this->api->v2010->account->recordings($sid); } protected function getSigningKeys(): \Twilio\Rest\Api\V2010\Account\SigningKeyList { return $this->api->v2010->account->signingKeys; } /** * @param string $sid The sid */ protected function contextSigningKeys(string $sid): \Twilio\Rest\Api\V2010\Account\SigningKeyContext { return $this->api->v2010->account->signingKeys($sid); } protected function getSip(): \Twilio\Rest\Api\V2010\Account\SipList { return $this->api->v2010->account->sip; } protected function getShortCodes(): \Twilio\Rest\Api\V2010\Account\ShortCodeList { return $this->api->v2010->account->shortCodes; } /** * @param string $sid The unique string that identifies this resource */ protected function contextShortCodes(string $sid): \Twilio\Rest\Api\V2010\Account\ShortCodeContext { return $this->api->v2010->account->shortCodes($sid); } protected function getTokens(): \Twilio\Rest\Api\V2010\Account\TokenList { return $this->api->v2010->account->tokens; } protected function getTranscriptions(): \Twilio\Rest\Api\V2010\Account\TranscriptionList { return $this->api->v2010->account->transcriptions; } /** * @param string $sid The unique string that identifies the resource */ protected function contextTranscriptions(string $sid): \Twilio\Rest\Api\V2010\Account\TranscriptionContext { return $this->api->v2010->account->transcriptions($sid); } protected function getUsage(): \Twilio\Rest\Api\V2010\Account\UsageList { return $this->api->v2010->account->usage; } protected function getValidationRequests(): \Twilio\Rest\Api\V2010\Account\ValidationRequestList { return $this->api->v2010->account->validationRequests; } /** * Access the Autopilot Twilio Domain * * @return Autopilot Autopilot Twilio Domain */ protected function getAutopilot(): Autopilot { if (!$this->_autopilot) { $this->_autopilot = new Autopilot($this); } return $this->_autopilot; } /** * Access the Chat Twilio Domain * * @return Chat Chat Twilio Domain */ protected function getChat(): Chat { if (!$this->_chat) { $this->_chat = new Chat($this); } return $this->_chat; } /** * Access the Conversations Twilio Domain * * @return Conversations Conversations Twilio Domain */ protected function getConversations(): Conversations { if (!$this->_conversations) { $this->_conversations = new Conversations($this); } return $this->_conversations; } /** * Access the Events Twilio Domain * * @return Events Events Twilio Domain */ protected function getEvents(): Events { if (!$this->_events) { $this->_events = new Events($this); } return $this->_events; } /** * Access the Fax Twilio Domain * * @return Fax Fax Twilio Domain */ protected function getFax(): Fax { if (!$this->_fax) { $this->_fax = new Fax($this); } return $this->_fax; } /** * Access the FlexApi Twilio Domain * * @return FlexApi FlexApi Twilio Domain */ protected function getFlexApi(): FlexApi { if (!$this->_flexApi) { $this->_flexApi = new FlexApi($this); } return $this->_flexApi; } /** * Access the FrontlineApi Twilio Domain * * @return FrontlineApi FrontlineApi Twilio Domain */ protected function getFrontlineApi(): FrontlineApi { if (!$this->_frontlineApi) { $this->_frontlineApi = new FrontlineApi($this); } return $this->_frontlineApi; } /** * Access the Insights Twilio Domain * * @return Insights Insights Twilio Domain */ protected function getInsights(): Insights { if (!$this->_insights) { $this->_insights = new Insights($this); } return $this->_insights; } /** * Access the IpMessaging Twilio Domain * * @return IpMessaging IpMessaging Twilio Domain */ protected function getIpMessaging(): IpMessaging { if (!$this->_ipMessaging) { $this->_ipMessaging = new IpMessaging($this); } return $this->_ipMessaging; } /** * Access the Lookups Twilio Domain * * @return Lookups Lookups Twilio Domain */ protected function getLookups(): Lookups { if (!$this->_lookups) { $this->_lookups = new Lookups($this); } return $this->_lookups; } /** * Access the Media Twilio Domain * * @return Media Media Twilio Domain */ protected function getMedia(): Media { if (!$this->_media) { $this->_media = new Media($this); } return $this->_media; } /** * Access the Messaging Twilio Domain * * @return Messaging Messaging Twilio Domain */ protected function getMessaging(): Messaging { if (!$this->_messaging) { $this->_messaging = new Messaging($this); } return $this->_messaging; } /** * Access the Monitor Twilio Domain * * @return Monitor Monitor Twilio Domain */ protected function getMonitor(): Monitor { if (!$this->_monitor) { $this->_monitor = new Monitor($this); } return $this->_monitor; } /** * Access the Notify Twilio Domain * * @return Notify Notify Twilio Domain */ protected function getNotify(): Notify { if (!$this->_notify) { $this->_notify = new Notify($this); } return $this->_notify; } /** * Access the Numbers Twilio Domain * * @return Numbers Numbers Twilio Domain */ protected function getNumbers(): Numbers { if (!$this->_numbers) { $this->_numbers = new Numbers($this); } return $this->_numbers; } /** * Access the Preview Twilio Domain * * @return Preview Preview Twilio Domain */ protected function getPreview(): Preview { if (!$this->_preview) { $this->_preview = new Preview($this); } return $this->_preview; } /** * Access the Pricing Twilio Domain * * @return Pricing Pricing Twilio Domain */ protected function getPricing(): Pricing { if (!$this->_pricing) { $this->_pricing = new Pricing($this); } return $this->_pricing; } /** * Access the Proxy Twilio Domain * * @return Proxy Proxy Twilio Domain */ protected function getProxy(): Proxy { if (!$this->_proxy) { $this->_proxy = new Proxy($this); } return $this->_proxy; } /** * Access the Serverless Twilio Domain * * @return Serverless Serverless Twilio Domain */ protected function getServerless(): Serverless { if (!$this->_serverless) { $this->_serverless = new Serverless($this); } return $this->_serverless; } /** * Access the Studio Twilio Domain * * @return Studio Studio Twilio Domain */ protected function getStudio(): Studio { if (!$this->_studio) { $this->_studio = new Studio($this); } return $this->_studio; } /** * Access the Sync Twilio Domain * * @return Sync Sync Twilio Domain */ protected function getSync(): Sync { if (!$this->_sync) { $this->_sync = new Sync($this); } return $this->_sync; } /** * Access the Taskrouter Twilio Domain * * @return Taskrouter Taskrouter Twilio Domain */ protected function getTaskrouter(): Taskrouter { if (!$this->_taskrouter) { $this->_taskrouter = new Taskrouter($this); } return $this->_taskrouter; } /** * Access the Trunking Twilio Domain * * @return Trunking Trunking Twilio Domain */ protected function getTrunking(): Trunking { if (!$this->_trunking) { $this->_trunking = new Trunking($this); } return $this->_trunking; } /** * Access the Trusthub Twilio Domain * * @return Trusthub Trusthub Twilio Domain */ protected function getTrusthub(): Trusthub { if (!$this->_trusthub) { $this->_trusthub = new Trusthub($this); } return $this->_trusthub; } /** * Access the Verify Twilio Domain * * @return Verify Verify Twilio Domain */ protected function getVerify(): Verify { if (!$this->_verify) { $this->_verify = new Verify($this); } return $this->_verify; } /** * Access the Video Twilio Domain * * @return Video Video Twilio Domain */ protected function getVideo(): Video { if (!$this->_video) { $this->_video = new Video($this); } return $this->_video; } /** * Access the Voice Twilio Domain * * @return Voice Voice Twilio Domain */ protected function getVoice(): Voice { if (!$this->_voice) { $this->_voice = new Voice($this); } return $this->_voice; } /** * Access the Wireless Twilio Domain * * @return Wireless Wireless Twilio Domain */ protected function getWireless(): Wireless { if (!$this->_wireless) { $this->_wireless = new Wireless($this); } return $this->_wireless; } /** * Access the Supersim Twilio Domain * * @return Supersim Supersim Twilio Domain */ protected function getSupersim(): Supersim { if (!$this->_supersim) { $this->_supersim = new Supersim($this); } return $this->_supersim; } /** * Access the Bulkexports Twilio Domain * * @return Bulkexports Bulkexports Twilio Domain */ protected function getBulkexports(): Bulkexports { if (!$this->_bulkexports) { $this->_bulkexports = new Bulkexports($this); } return $this->_bulkexports; } /** * Magic getter to lazy load domains * * @param string $name Domain to return * @return \Twilio\Domain The requested domain * @throws TwilioException For unknown domains */ public function __get(string $name) { $method = 'get' . \ucfirst($name); if (\method_exists($this, $method)) { return $this->$method(); } throw new TwilioException('Unknown domain ' . $name); } /** * Magic call to lazy load contexts * * @param string $name Context to return * @param mixed[] $arguments Context to return * @return \Twilio\InstanceContext The requested context * @throws TwilioException For unknown contexts */ public function __call(string $name, array $arguments) { $method = 'context' . \ucfirst($name); if (\method_exists($this, $method)) { return \call_user_func_array([$this, $method], $arguments); } throw new TwilioException('Unknown context ' . $name); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Client ' . $this->getAccountSid() . ']'; } /** * Validates connection to new SSL certificate endpoint * * @param CurlClient $client * @throws TwilioException if request fails */ public function validateSslCertificate(CurlClient $client): void { $response = $client->request('GET', 'https://api.twilio.com:8443'); if ($response->getStatusCode() < 200 || $response->getStatusCode() > 300) { throw new TwilioException('Failed to validate SSL certificate'); } } }src/Twilio/Rest/Chat/V1/ServiceInstance.php000064400000014175150515725700014501 0ustar00properties = [ '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')), 'defaultServiceRoleSid' => Values::array_get($payload, 'default_service_role_sid'), 'defaultChannelRoleSid' => Values::array_get($payload, 'default_channel_role_sid'), 'defaultChannelCreatorRoleSid' => Values::array_get($payload, 'default_channel_creator_role_sid'), 'readStatusEnabled' => Values::array_get($payload, 'read_status_enabled'), 'reachabilityEnabled' => Values::array_get($payload, 'reachability_enabled'), 'typingIndicatorTimeout' => Values::array_get($payload, 'typing_indicator_timeout'), 'consumptionReportInterval' => Values::array_get($payload, 'consumption_report_interval'), 'limits' => Values::array_get($payload, 'limits'), 'webhooks' => Values::array_get($payload, 'webhooks'), 'preWebhookUrl' => Values::array_get($payload, 'pre_webhook_url'), 'postWebhookUrl' => Values::array_get($payload, 'post_webhook_url'), 'webhookMethod' => Values::array_get($payload, 'webhook_method'), 'webhookFilters' => Values::array_get($payload, 'webhook_filters'), 'notifications' => Values::array_get($payload, 'notifications'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 ServiceContext Context for this ServiceInstance */ protected function proxy(): ServiceContext { if (!$this->context) { $this->context = new ServiceContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the ServiceInstance * * @return ServiceInstance Fetched ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ServiceInstance { return $this->proxy()->fetch(); } /** * Delete the ServiceInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the ServiceInstance * * @param array|Options $options Optional Arguments * @return ServiceInstance Updated ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ServiceInstance { return $this->proxy()->update($options); } /** * Access the channels */ protected function getChannels(): ChannelList { return $this->proxy()->channels; } /** * Access the roles */ protected function getRoles(): RoleList { return $this->proxy()->roles; } /** * Access the users */ protected function getUsers(): UserList { return $this->proxy()->users; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V1.ServiceInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V1/CredentialList.php000064400000013176150515725700014322 0ustar00solution = []; $this->uri = '/Credentials'; } /** * Streams CredentialInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads CredentialInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return CredentialInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of CredentialInstance records from the API. * Request is executed immediately * * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return CredentialPage Page of CredentialInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): CredentialPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new CredentialPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of CredentialInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return CredentialPage Page of CredentialInstance */ public function getPage(string $targetUrl): CredentialPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new CredentialPage($this->version, $response, $this->solution); } /** * Create the CredentialInstance * * @param string $type The type of push-notification service the credential is * for * @param array|Options $options Optional Arguments * @return CredentialInstance Created CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $type, array $options = []): CredentialInstance { $options = new Values($options); $data = Values::of([ 'Type' => $type, 'FriendlyName' => $options['friendlyName'], 'Certificate' => $options['certificate'], 'PrivateKey' => $options['privateKey'], 'Sandbox' => Serialize::booleanToString($options['sandbox']), 'ApiKey' => $options['apiKey'], 'Secret' => $options['secret'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new CredentialInstance($this->version, $payload); } /** * Constructs a CredentialContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): CredentialContext { return new CredentialContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V1.CredentialList]'; } }src/Twilio/Rest/Chat/V1/CredentialContext.php000064400000005245150515725700015031 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Credentials/' . \rawurlencode($sid) . ''; } /** * Fetch the CredentialInstance * * @return CredentialInstance Fetched CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CredentialInstance { $payload = $this->version->fetch('GET', $this->uri); return new CredentialInstance($this->version, $payload, $this->solution['sid']); } /** * Update the CredentialInstance * * @param array|Options $options Optional Arguments * @return CredentialInstance Updated CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): CredentialInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'Certificate' => $options['certificate'], 'PrivateKey' => $options['privateKey'], 'Sandbox' => Serialize::booleanToString($options['sandbox']), 'ApiKey' => $options['apiKey'], 'Secret' => $options['secret'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new CredentialInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the CredentialInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V1.CredentialContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V1/Service/ChannelContext.php000064400000013033150515725700015721 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($sid) . ''; } /** * Fetch the ChannelInstance * * @return ChannelInstance Fetched ChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ChannelInstance { $payload = $this->version->fetch('GET', $this->uri); return new ChannelInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Delete the ChannelInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the ChannelInstance * * @param array|Options $options Optional Arguments * @return ChannelInstance Updated ChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ChannelInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'UniqueName' => $options['uniqueName'], 'Attributes' => $options['attributes'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ChannelInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Access the members */ protected function getMembers(): MemberList { if (!$this->_members) { $this->_members = new MemberList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_members; } /** * Access the messages */ protected function getMessages(): MessageList { if (!$this->_messages) { $this->_messages = new MessageList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_messages; } /** * Access the invites */ protected function getInvites(): InviteList { if (!$this->_invites) { $this->_invites = new InviteList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_invites; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V1.ChannelContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V1/Service/UserPage.php000064400000002220150515725700014513 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return UserInstance \Twilio\Rest\Chat\V1\Service\UserInstance */ public function buildInstance(array $payload): UserInstance { return new UserInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V1.UserPage]'; } }src/Twilio/Rest/Chat/V1/Service/ChannelOptions.php000064400000017535150515725700015743 0ustar00options['friendlyName'] = $friendlyName; $this->options['uniqueName'] = $uniqueName; $this->options['attributes'] = $attributes; $this->options['type'] = $type; } /** * A descriptive string that you create to describe the new resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the new resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. This value must be 64 characters or less in length and be unique within the Service. * * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * A valid JSON string that contains application-specific data. * * @param string $attributes A valid JSON string that contains * application-specific data * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The visibility of the channel. Can be: `public` or `private` and defaults to `public`. * * @param string $type The visibility of the channel * @return $this Fluent Builder */ public function setType(string $type): self { $this->options['type'] = $type; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V1.CreateChannelOptions ' . $options . ']'; } } class ReadChannelOptions extends Options { /** * @param string[] $type The visibility of the channel to read */ public function __construct(array $type = Values::ARRAY_NONE) { $this->options['type'] = $type; } /** * The visibility of the Channels to read. Can be: `public` or `private` and defaults to `public`. * * @param string[] $type The visibility of the channel to read * @return $this Fluent Builder */ public function setType(array $type): self { $this->options['type'] = $type; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V1.ReadChannelOptions ' . $options . ']'; } } class UpdateChannelOptions extends Options { /** * @param string $friendlyName A string to describe the resource * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @param string $attributes A valid JSON string that contains * application-specific data */ public function __construct(string $friendlyName = Values::NONE, string $uniqueName = Values::NONE, string $attributes = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['uniqueName'] = $uniqueName; $this->options['attributes'] = $attributes; } /** * A descriptive string that you create to describe the resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. This value must be 64 characters or less in length and be unique within the Service. * * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * A valid JSON string that contains application-specific data. * * @param string $attributes A valid JSON string that contains * application-specific data * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V1.UpdateChannelOptions ' . $options . ']'; } }src/Twilio/Rest/Chat/V1/Service/UserContext.php000064400000010570150515725700015272 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Users/' . \rawurlencode($sid) . ''; } /** * Fetch the UserInstance * * @return UserInstance Fetched UserInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): UserInstance { $payload = $this->version->fetch('GET', $this->uri); return new UserInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Delete the UserInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the UserInstance * * @param array|Options $options Optional Arguments * @return UserInstance Updated UserInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): UserInstance { $options = new Values($options); $data = Values::of([ 'RoleSid' => $options['roleSid'], 'Attributes' => $options['attributes'], 'FriendlyName' => $options['friendlyName'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new UserInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Access the userChannels */ protected function getUserChannels(): UserChannelList { if (!$this->_userChannels) { $this->_userChannels = new UserChannelList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_userChannels; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V1.UserContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V1/Service/RoleList.php000064400000013056150515725700014546 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Roles'; } /** * Create the RoleInstance * * @param string $friendlyName A string to describe the new resource * @param string $type The type of role * @param string[] $permission A permission the role should have * @return RoleInstance Created RoleInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, string $type, array $permission): RoleInstance { $data = Values::of([ 'FriendlyName' => $friendlyName, 'Type' => $type, 'Permission' => Serialize::map($permission, function($e) { return $e; }), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new RoleInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Streams RoleInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads RoleInstance 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 RoleInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of RoleInstance 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 RolePage Page of RoleInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): RolePage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new RolePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of RoleInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return RolePage Page of RoleInstance */ public function getPage(string $targetUrl): RolePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new RolePage($this->version, $response, $this->solution); } /** * Constructs a RoleContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): RoleContext { return new RoleContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V1.RoleList]'; } }src/Twilio/Rest/Chat/V1/Service/UserOptions.php000064400000012716150515725700015305 0ustar00options['roleSid'] = $roleSid; $this->options['attributes'] = $attributes; $this->options['friendlyName'] = $friendlyName; } /** * The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) assigned to the new User. * * @param string $roleSid The SID of the Role assigned to this user * @return $this Fluent Builder */ public function setRoleSid(string $roleSid): self { $this->options['roleSid'] = $roleSid; return $this; } /** * A valid JSON string that contains application-specific data. * * @param string $attributes A valid JSON string that contains * application-specific data * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * A descriptive string that you create to describe the new resource. This value is often used for display purposes. * * @param string $friendlyName A string to describe the new resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V1.CreateUserOptions ' . $options . ']'; } } class UpdateUserOptions extends Options { /** * @param string $roleSid The SID id of the Role assigned to this user * @param string $attributes A valid JSON string that contains * application-specific data * @param string $friendlyName A string to describe the resource */ public function __construct(string $roleSid = Values::NONE, string $attributes = Values::NONE, string $friendlyName = Values::NONE) { $this->options['roleSid'] = $roleSid; $this->options['attributes'] = $attributes; $this->options['friendlyName'] = $friendlyName; } /** * The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) assigned to this user. * * @param string $roleSid The SID id of the Role assigned to this user * @return $this Fluent Builder */ public function setRoleSid(string $roleSid): self { $this->options['roleSid'] = $roleSid; return $this; } /** * A valid JSON string that contains application-specific data. * * @param string $attributes A valid JSON string that contains * application-specific data * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * A descriptive string that you create to describe the resource. It is often used for display purposes. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V1.UpdateUserOptions ' . $options . ']'; } }src/Twilio/Rest/Chat/V1/Service/RoleContext.php000064400000005170150515725700015255 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Roles/' . \rawurlencode($sid) . ''; } /** * Fetch the RoleInstance * * @return RoleInstance Fetched RoleInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RoleInstance { $payload = $this->version->fetch('GET', $this->uri); return new RoleInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Delete the RoleInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the RoleInstance * * @param string[] $permission A permission the role should have * @return RoleInstance Updated RoleInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $permission): RoleInstance { $data = Values::of(['Permission' => Serialize::map($permission, function($e) { return $e; }), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new RoleInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V1.RoleContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V1/Service/RoleInstance.php000064400000010406150515725700015373 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'type' => Values::array_get($payload, 'type'), 'permissions' => Values::array_get($payload, 'permissions'), '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 = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return RoleContext Context for this RoleInstance */ protected function proxy(): RoleContext { if (!$this->context) { $this->context = new RoleContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the RoleInstance * * @return RoleInstance Fetched RoleInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RoleInstance { return $this->proxy()->fetch(); } /** * Delete the RoleInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the RoleInstance * * @param string[] $permission A permission the role should have * @return RoleInstance Updated RoleInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $permission): RoleInstance { return $this->proxy()->update($permission); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V1.RoleInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V1/Service/ChannelInstance.php000064400000012703150515725700016044 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'attributes' => Values::array_get($payload, 'attributes'), 'type' => Values::array_get($payload, 'type'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'createdBy' => Values::array_get($payload, 'created_by'), 'membersCount' => Values::array_get($payload, 'members_count'), 'messagesCount' => Values::array_get($payload, 'messages_count'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return ChannelContext Context for this ChannelInstance */ protected function proxy(): ChannelContext { if (!$this->context) { $this->context = new ChannelContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the ChannelInstance * * @return ChannelInstance Fetched ChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ChannelInstance { return $this->proxy()->fetch(); } /** * Delete the ChannelInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the ChannelInstance * * @param array|Options $options Optional Arguments * @return ChannelInstance Updated ChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ChannelInstance { return $this->proxy()->update($options); } /** * Access the members */ protected function getMembers(): MemberList { return $this->proxy()->members; } /** * Access the messages */ protected function getMessages(): MessageList { return $this->proxy()->messages; } /** * Access the invites */ protected function getInvites(): InviteList { return $this->proxy()->invites; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V1.ChannelInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V1/Service/Channel/InvitePage.php000064400000002405150515725700016410 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return InviteInstance \Twilio\Rest\Chat\V1\Service\Channel\InviteInstance */ public function buildInstance(array $payload): InviteInstance { return new InviteInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V1.InvitePage]'; } }src/Twilio/Rest/Chat/V1/Service/Channel/MemberOptions.php000064400000012361150515725700017142 0ustar00options['roleSid'] = $roleSid; } /** * The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) to assign to the member. The default roles are those specified on the [Service](https://www.twilio.com/docs/chat/api/services). * * @param string $roleSid The SID of the Role to assign to the member * @return $this Fluent Builder */ public function setRoleSid(string $roleSid): self { $this->options['roleSid'] = $roleSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V1.CreateMemberOptions ' . $options . ']'; } } class ReadMemberOptions extends Options { /** * @param string[] $identity The `identity` value of the resources to read */ public function __construct(array $identity = Values::ARRAY_NONE) { $this->options['identity'] = $identity; } /** * The [User](https://www.twilio.com/docs/api/chat/rest/v1/user)'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more details. * * @param string[] $identity The `identity` value of the resources to read * @return $this Fluent Builder */ public function setIdentity(array $identity): self { $this->options['identity'] = $identity; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V1.ReadMemberOptions ' . $options . ']'; } } class UpdateMemberOptions extends Options { /** * @param string $roleSid The SID of the Role to assign to the member * @param int $lastConsumedMessageIndex The index of the last consumed Message * for the Channel for the Member */ public function __construct(string $roleSid = Values::NONE, int $lastConsumedMessageIndex = Values::NONE) { $this->options['roleSid'] = $roleSid; $this->options['lastConsumedMessageIndex'] = $lastConsumedMessageIndex; } /** * The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) to assign to the member. The default roles are those specified on the [Service](https://www.twilio.com/docs/chat/api/services). * * @param string $roleSid The SID of the Role to assign to the member * @return $this Fluent Builder */ public function setRoleSid(string $roleSid): self { $this->options['roleSid'] = $roleSid; return $this; } /** * The index of the last [Message](https://www.twilio.com/docs/api/chat/rest/messages) that the Member has read within the [Channel](https://www.twilio.com/docs/api/chat/rest/channels). * * @param int $lastConsumedMessageIndex The index of the last consumed Message * for the Channel for the Member * @return $this Fluent Builder */ public function setLastConsumedMessageIndex(int $lastConsumedMessageIndex): self { $this->options['lastConsumedMessageIndex'] = $lastConsumedMessageIndex; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V1.UpdateMemberOptions ' . $options . ']'; } }src/Twilio/Rest/Chat/V1/Service/Channel/InviteInstance.php000064400000010406150515725700017300 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'channelSid' => Values::array_get($payload, 'channel_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'identity' => Values::array_get($payload, 'identity'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'roleSid' => Values::array_get($payload, 'role_sid'), 'createdBy' => Values::array_get($payload, 'created_by'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'channelSid' => $channelSid, '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 InviteContext Context for this InviteInstance */ protected function proxy(): InviteContext { if (!$this->context) { $this->context = new InviteContext( $this->version, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the InviteInstance * * @return InviteInstance Fetched InviteInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): InviteInstance { return $this->proxy()->fetch(); } /** * Delete the InviteInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V1.InviteInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V1/Service/Channel/MessageInstance.php000064400000011641150515725700017430 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'attributes' => Values::array_get($payload, 'attributes'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'to' => Values::array_get($payload, 'to'), 'channelSid' => Values::array_get($payload, 'channel_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'wasEdited' => Values::array_get($payload, 'was_edited'), 'from' => Values::array_get($payload, 'from'), 'body' => Values::array_get($payload, 'body'), 'index' => Values::array_get($payload, 'index'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'channelSid' => $channelSid, '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 MessageContext Context for this MessageInstance */ protected function proxy(): MessageContext { if (!$this->context) { $this->context = new MessageContext( $this->version, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the MessageInstance * * @return MessageInstance Fetched MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MessageInstance { return $this->proxy()->fetch(); } /** * Delete the MessageInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the MessageInstance * * @param array|Options $options Optional Arguments * @return MessageInstance Updated MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): MessageInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V1.MessageInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V1/Service/Channel/MessageList.php000064400000014464150515725700016605 0ustar00solution = ['serviceSid' => $serviceSid, 'channelSid' => $channelSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($channelSid) . '/Messages'; } /** * Create the MessageInstance * * @param string $body The message to send to the channel * @param array|Options $options Optional Arguments * @return MessageInstance Created MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $body, array $options = []): MessageInstance { $options = new Values($options); $data = Values::of([ 'Body' => $body, 'From' => $options['from'], 'Attributes' => $options['attributes'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new MessageInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'] ); } /** * Streams MessageInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads MessageInstance 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 MessageInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of MessageInstance 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 MessagePage Page of MessageInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): MessagePage { $options = new Values($options); $params = Values::of([ 'Order' => $options['order'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new MessagePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of MessageInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return MessagePage Page of MessageInstance */ public function getPage(string $targetUrl): MessagePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new MessagePage($this->version, $response, $this->solution); } /** * Constructs a MessageContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): MessageContext { return new MessageContext( $this->version, $this->solution['serviceSid'], $this->solution['channelSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V1.MessageList]'; } }src/Twilio/Rest/Chat/V1/Service/Channel/MessageContext.php000064400000005757150515725700017323 0ustar00solution = ['serviceSid' => $serviceSid, 'channelSid' => $channelSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($channelSid) . '/Messages/' . \rawurlencode($sid) . ''; } /** * Fetch the MessageInstance * * @return MessageInstance Fetched MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MessageInstance { $payload = $this->version->fetch('GET', $this->uri); return new MessageInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } /** * Delete the MessageInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the MessageInstance * * @param array|Options $options Optional Arguments * @return MessageInstance Updated MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): MessageInstance { $options = new Values($options); $data = Values::of(['Body' => $options['body'], 'Attributes' => $options['attributes'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new MessageInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V1.MessageContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V1/Service/Channel/MemberList.php000064400000014454150515725700016427 0ustar00solution = ['serviceSid' => $serviceSid, 'channelSid' => $channelSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($channelSid) . '/Members'; } /** * Create the MemberInstance * * @param string $identity The `identity` value that identifies the new * resource's User * @param array|Options $options Optional Arguments * @return MemberInstance Created MemberInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $identity, array $options = []): MemberInstance { $options = new Values($options); $data = Values::of(['Identity' => $identity, 'RoleSid' => $options['roleSid'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new MemberInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'] ); } /** * Streams MemberInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads MemberInstance 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 MemberInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of MemberInstance 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 MemberPage Page of MemberInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): MemberPage { $options = new Values($options); $params = Values::of([ 'Identity' => Serialize::map($options['identity'], function($e) { return $e; }), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new MemberPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of MemberInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return MemberPage Page of MemberInstance */ public function getPage(string $targetUrl): MemberPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new MemberPage($this->version, $response, $this->solution); } /** * Constructs a MemberContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): MemberContext { return new MemberContext( $this->version, $this->solution['serviceSid'], $this->solution['channelSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V1.MemberList]'; } }src/Twilio/Rest/Chat/V1/Service/Channel/MemberContext.php000064400000005770150515725700017141 0ustar00solution = ['serviceSid' => $serviceSid, 'channelSid' => $channelSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($channelSid) . '/Members/' . \rawurlencode($sid) . ''; } /** * Fetch the MemberInstance * * @return MemberInstance Fetched MemberInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MemberInstance { $payload = $this->version->fetch('GET', $this->uri); return new MemberInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } /** * Delete the MemberInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the MemberInstance * * @param array|Options $options Optional Arguments * @return MemberInstance Updated MemberInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): MemberInstance { $options = new Values($options); $data = Values::of([ 'RoleSid' => $options['roleSid'], 'LastConsumedMessageIndex' => $options['lastConsumedMessageIndex'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new MemberInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V1.MemberContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V1/Service/Channel/InviteOptions.php000064400000005350150515725700017171 0ustar00options['roleSid'] = $roleSid; } /** * The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) assigned to the new member. * * @param string $roleSid The Role assigned to the new member * @return $this Fluent Builder */ public function setRoleSid(string $roleSid): self { $this->options['roleSid'] = $roleSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V1.CreateInviteOptions ' . $options . ']'; } } class ReadInviteOptions extends Options { /** * @param string[] $identity The `identity` value of the resources to read */ public function __construct(array $identity = Values::ARRAY_NONE) { $this->options['identity'] = $identity; } /** * The [User](https://www.twilio.com/docs/api/chat/rest/v1/user)'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more details. * * @param string[] $identity The `identity` value of the resources to read * @return $this Fluent Builder */ public function setIdentity(array $identity): self { $this->options['identity'] = $identity; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V1.ReadInviteOptions ' . $options . ']'; } }src/Twilio/Rest/Chat/V1/Service/Channel/MessageOptions.php000064400000012550150515725700017317 0ustar00options['from'] = $from; $this->options['attributes'] = $attributes; } /** * The [identity](https://www.twilio.com/docs/api/chat/guides/identity) of the new message's author. The default value is `system`. * * @param string $from The identity of the new message's author * @return $this Fluent Builder */ public function setFrom(string $from): self { $this->options['from'] = $from; return $this; } /** * A valid JSON string that contains application-specific data. * * @param string $attributes A valid JSON string that contains * application-specific data * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V1.CreateMessageOptions ' . $options . ']'; } } class ReadMessageOptions extends Options { /** * @param string $order The sort order of the returned messages */ public function __construct(string $order = Values::NONE) { $this->options['order'] = $order; } /** * The sort order of the returned messages. Can be: `asc` (ascending) or `desc` (descending) with `asc` as the default. * * @param string $order The sort order of the returned messages * @return $this Fluent Builder */ public function setOrder(string $order): self { $this->options['order'] = $order; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V1.ReadMessageOptions ' . $options . ']'; } } class UpdateMessageOptions extends Options { /** * @param string $body The message to send to the channel * @param string $attributes A valid JSON string that contains * application-specific data */ public function __construct(string $body = Values::NONE, string $attributes = Values::NONE) { $this->options['body'] = $body; $this->options['attributes'] = $attributes; } /** * The message to send to the channel. Can also be an empty string or `null`, which sets the value as an empty string. You can send structured data in the body by serializing it as a string. * * @param string $body The message to send to the channel * @return $this Fluent Builder */ public function setBody(string $body): self { $this->options['body'] = $body; return $this; } /** * A valid JSON string that contains application-specific data. * * @param string $attributes A valid JSON string that contains * application-specific data * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V1.UpdateMessageOptions ' . $options . ']'; } }src/Twilio/Rest/Chat/V1/Service/Channel/InviteList.php000064400000014463150515725700016456 0ustar00solution = ['serviceSid' => $serviceSid, 'channelSid' => $channelSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($channelSid) . '/Invites'; } /** * Create the InviteInstance * * @param string $identity The `identity` value that identifies the new * resource's User * @param array|Options $options Optional Arguments * @return InviteInstance Created InviteInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $identity, array $options = []): InviteInstance { $options = new Values($options); $data = Values::of(['Identity' => $identity, 'RoleSid' => $options['roleSid'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new InviteInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'] ); } /** * Streams InviteInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads InviteInstance 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 InviteInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of InviteInstance 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 InvitePage Page of InviteInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): InvitePage { $options = new Values($options); $params = Values::of([ 'Identity' => Serialize::map($options['identity'], function($e) { return $e; }), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new InvitePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of InviteInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return InvitePage Page of InviteInstance */ public function getPage(string $targetUrl): InvitePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new InvitePage($this->version, $response, $this->solution); } /** * Constructs a InviteContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): InviteContext { return new InviteContext( $this->version, $this->solution['serviceSid'], $this->solution['channelSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V1.InviteList]'; } }src/Twilio/Rest/Chat/V1/Service/Channel/InviteContext.php000064400000004354150515725700017165 0ustar00solution = ['serviceSid' => $serviceSid, 'channelSid' => $channelSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($channelSid) . '/Invites/' . \rawurlencode($sid) . ''; } /** * Fetch the InviteInstance * * @return InviteInstance Fetched InviteInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): InviteInstance { $payload = $this->version->fetch('GET', $this->uri); return new InviteInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } /** * Delete the InviteInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V1.InviteContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V1/Service/Channel/MemberPage.php000064400000002405150515725700016361 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return MemberInstance \Twilio\Rest\Chat\V1\Service\Channel\MemberInstance */ public function buildInstance(array $payload): MemberInstance { return new MemberInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V1.MemberPage]'; } }src/Twilio/Rest/Chat/V1/Service/Channel/MemberInstance.php000064400000011505150515725700017252 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'channelSid' => Values::array_get($payload, 'channel_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'identity' => Values::array_get($payload, 'identity'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'roleSid' => Values::array_get($payload, 'role_sid'), 'lastConsumedMessageIndex' => Values::array_get($payload, 'last_consumed_message_index'), 'lastConsumptionTimestamp' => Deserialize::dateTime(Values::array_get($payload, 'last_consumption_timestamp')), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'channelSid' => $channelSid, '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 MemberContext Context for this MemberInstance */ protected function proxy(): MemberContext { if (!$this->context) { $this->context = new MemberContext( $this->version, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the MemberInstance * * @return MemberInstance Fetched MemberInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MemberInstance { return $this->proxy()->fetch(); } /** * Delete the MemberInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the MemberInstance * * @param array|Options $options Optional Arguments * @return MemberInstance Updated MemberInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): MemberInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V1.MemberInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V1/Service/Channel/MessagePage.php000064400000002413150515725700016535 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return MessageInstance \Twilio\Rest\Chat\V1\Service\Channel\MessageInstance */ public function buildInstance(array $payload): MessageInstance { return new MessageInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V1.MessagePage]'; } }src/Twilio/Rest/Chat/V1/Service/User/UserChannelPage.php000064400000002432150515725700016727 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return UserChannelInstance \Twilio\Rest\Chat\V1\Service\User\UserChannelInstance */ public function buildInstance(array $payload): UserChannelInstance { return new UserChannelInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['userSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V1.UserChannelPage]'; } }src/Twilio/Rest/Chat/V1/Service/User/UserChannelInstance.php000064400000005211150515725700017615 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'channelSid' => Values::array_get($payload, 'channel_sid'), 'memberSid' => Values::array_get($payload, 'member_sid'), 'status' => Values::array_get($payload, 'status'), 'lastConsumedMessageIndex' => Values::array_get($payload, 'last_consumed_message_index'), 'unreadMessagesCount' => Values::array_get($payload, 'unread_messages_count'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['serviceSid' => $serviceSid, 'userSid' => $userSid, ]; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { return '[Twilio.Chat.V1.UserChannelInstance]'; } }src/Twilio/Rest/Chat/V1/Service/User/UserChannelList.php000064400000011272150515725700016770 0ustar00solution = ['serviceSid' => $serviceSid, 'userSid' => $userSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Users/' . \rawurlencode($userSid) . '/Channels'; } /** * Streams UserChannelInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads UserChannelInstance 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 UserChannelInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of UserChannelInstance 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 UserChannelPage Page of UserChannelInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): UserChannelPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new UserChannelPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of UserChannelInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return UserChannelPage Page of UserChannelInstance */ public function getPage(string $targetUrl): UserChannelPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new UserChannelPage($this->version, $response, $this->solution); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V1.UserChannelList]'; } }src/Twilio/Rest/Chat/V1/Service/ChannelPage.php000064400000002242150515725700015151 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ChannelInstance \Twilio\Rest\Chat\V1\Service\ChannelInstance */ public function buildInstance(array $payload): ChannelInstance { return new ChannelInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V1.ChannelPage]'; } }src/Twilio/Rest/Chat/V1/Service/RolePage.php000064400000002220150515725700014476 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return RoleInstance \Twilio\Rest\Chat\V1\Service\RoleInstance */ public function buildInstance(array $payload): RoleInstance { return new RoleInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V1.RolePage]'; } }src/Twilio/Rest/Chat/V1/Service/ChannelList.php000064400000013742150515725700015217 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels'; } /** * Create the ChannelInstance * * @param array|Options $options Optional Arguments * @return ChannelInstance Created ChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): ChannelInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'UniqueName' => $options['uniqueName'], 'Attributes' => $options['attributes'], 'Type' => $options['type'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ChannelInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Streams ChannelInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ChannelInstance 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 ChannelInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of ChannelInstance 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 ChannelPage Page of ChannelInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ChannelPage { $options = new Values($options); $params = Values::of([ 'Type' => Serialize::map($options['type'], function($e) { return $e; }), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ChannelPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ChannelInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ChannelPage Page of ChannelInstance */ public function getPage(string $targetUrl): ChannelPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ChannelPage($this->version, $response, $this->solution); } /** * Constructs a ChannelContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): ChannelContext { return new ChannelContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V1.ChannelList]'; } }src/Twilio/Rest/Chat/V1/Service/UserList.php000064400000013136150515725700014562 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Users'; } /** * Create the UserInstance * * @param string $identity The `identity` value that identifies the new * resource's User * @param array|Options $options Optional Arguments * @return UserInstance Created UserInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $identity, array $options = []): UserInstance { $options = new Values($options); $data = Values::of([ 'Identity' => $identity, 'RoleSid' => $options['roleSid'], 'Attributes' => $options['attributes'], 'FriendlyName' => $options['friendlyName'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new UserInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Streams UserInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads UserInstance 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 UserInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of UserInstance 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 UserPage Page of UserInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): UserPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new UserPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of UserInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return UserPage Page of UserInstance */ public function getPage(string $targetUrl): UserPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new UserPage($this->version, $response, $this->solution); } /** * Constructs a UserContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): UserContext { return new UserContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V1.UserList]'; } }src/Twilio/Rest/Chat/V1/Service/UserInstance.php000064400000012012150515725700015403 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'attributes' => Values::array_get($payload, 'attributes'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'roleSid' => Values::array_get($payload, 'role_sid'), 'identity' => Values::array_get($payload, 'identity'), 'isOnline' => Values::array_get($payload, 'is_online'), 'isNotifiable' => Values::array_get($payload, 'is_notifiable'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'joinedChannelsCount' => Values::array_get($payload, 'joined_channels_count'), 'links' => Values::array_get($payload, 'links'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return UserContext Context for this UserInstance */ protected function proxy(): UserContext { if (!$this->context) { $this->context = new UserContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the UserInstance * * @return UserInstance Fetched UserInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): UserInstance { return $this->proxy()->fetch(); } /** * Delete the UserInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the UserInstance * * @param array|Options $options Optional Arguments * @return UserInstance Updated UserInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): UserInstance { return $this->proxy()->update($options); } /** * Access the userChannels */ protected function getUserChannels(): UserChannelList { return $this->proxy()->userChannels; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V1.UserInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V1/ServiceContext.php000064400000022614150515725700014356 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($sid) . ''; } /** * Fetch the ServiceInstance * * @return ServiceInstance Fetched ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ServiceInstance { $payload = $this->version->fetch('GET', $this->uri); return new ServiceInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the ServiceInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the ServiceInstance * * @param array|Options $options Optional Arguments * @return ServiceInstance Updated ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ServiceInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'DefaultServiceRoleSid' => $options['defaultServiceRoleSid'], 'DefaultChannelRoleSid' => $options['defaultChannelRoleSid'], 'DefaultChannelCreatorRoleSid' => $options['defaultChannelCreatorRoleSid'], 'ReadStatusEnabled' => Serialize::booleanToString($options['readStatusEnabled']), 'ReachabilityEnabled' => Serialize::booleanToString($options['reachabilityEnabled']), 'TypingIndicatorTimeout' => $options['typingIndicatorTimeout'], 'ConsumptionReportInterval' => $options['consumptionReportInterval'], 'Notifications.NewMessage.Enabled' => Serialize::booleanToString($options['notificationsNewMessageEnabled']), 'Notifications.NewMessage.Template' => $options['notificationsNewMessageTemplate'], 'Notifications.AddedToChannel.Enabled' => Serialize::booleanToString($options['notificationsAddedToChannelEnabled']), 'Notifications.AddedToChannel.Template' => $options['notificationsAddedToChannelTemplate'], 'Notifications.RemovedFromChannel.Enabled' => Serialize::booleanToString($options['notificationsRemovedFromChannelEnabled']), 'Notifications.RemovedFromChannel.Template' => $options['notificationsRemovedFromChannelTemplate'], 'Notifications.InvitedToChannel.Enabled' => Serialize::booleanToString($options['notificationsInvitedToChannelEnabled']), 'Notifications.InvitedToChannel.Template' => $options['notificationsInvitedToChannelTemplate'], 'PreWebhookUrl' => $options['preWebhookUrl'], 'PostWebhookUrl' => $options['postWebhookUrl'], 'WebhookMethod' => $options['webhookMethod'], 'WebhookFilters' => Serialize::map($options['webhookFilters'], function($e) { return $e; }), 'Webhooks.OnMessageSend.Url' => $options['webhooksOnMessageSendUrl'], 'Webhooks.OnMessageSend.Method' => $options['webhooksOnMessageSendMethod'], 'Webhooks.OnMessageUpdate.Url' => $options['webhooksOnMessageUpdateUrl'], 'Webhooks.OnMessageUpdate.Method' => $options['webhooksOnMessageUpdateMethod'], 'Webhooks.OnMessageRemove.Url' => $options['webhooksOnMessageRemoveUrl'], 'Webhooks.OnMessageRemove.Method' => $options['webhooksOnMessageRemoveMethod'], 'Webhooks.OnChannelAdd.Url' => $options['webhooksOnChannelAddUrl'], 'Webhooks.OnChannelAdd.Method' => $options['webhooksOnChannelAddMethod'], 'Webhooks.OnChannelDestroy.Url' => $options['webhooksOnChannelDestroyUrl'], 'Webhooks.OnChannelDestroy.Method' => $options['webhooksOnChannelDestroyMethod'], 'Webhooks.OnChannelUpdate.Url' => $options['webhooksOnChannelUpdateUrl'], 'Webhooks.OnChannelUpdate.Method' => $options['webhooksOnChannelUpdateMethod'], 'Webhooks.OnMemberAdd.Url' => $options['webhooksOnMemberAddUrl'], 'Webhooks.OnMemberAdd.Method' => $options['webhooksOnMemberAddMethod'], 'Webhooks.OnMemberRemove.Url' => $options['webhooksOnMemberRemoveUrl'], 'Webhooks.OnMemberRemove.Method' => $options['webhooksOnMemberRemoveMethod'], 'Webhooks.OnMessageSent.Url' => $options['webhooksOnMessageSentUrl'], 'Webhooks.OnMessageSent.Method' => $options['webhooksOnMessageSentMethod'], 'Webhooks.OnMessageUpdated.Url' => $options['webhooksOnMessageUpdatedUrl'], 'Webhooks.OnMessageUpdated.Method' => $options['webhooksOnMessageUpdatedMethod'], 'Webhooks.OnMessageRemoved.Url' => $options['webhooksOnMessageRemovedUrl'], 'Webhooks.OnMessageRemoved.Method' => $options['webhooksOnMessageRemovedMethod'], 'Webhooks.OnChannelAdded.Url' => $options['webhooksOnChannelAddedUrl'], 'Webhooks.OnChannelAdded.Method' => $options['webhooksOnChannelAddedMethod'], 'Webhooks.OnChannelDestroyed.Url' => $options['webhooksOnChannelDestroyedUrl'], 'Webhooks.OnChannelDestroyed.Method' => $options['webhooksOnChannelDestroyedMethod'], 'Webhooks.OnChannelUpdated.Url' => $options['webhooksOnChannelUpdatedUrl'], 'Webhooks.OnChannelUpdated.Method' => $options['webhooksOnChannelUpdatedMethod'], 'Webhooks.OnMemberAdded.Url' => $options['webhooksOnMemberAddedUrl'], 'Webhooks.OnMemberAdded.Method' => $options['webhooksOnMemberAddedMethod'], 'Webhooks.OnMemberRemoved.Url' => $options['webhooksOnMemberRemovedUrl'], 'Webhooks.OnMemberRemoved.Method' => $options['webhooksOnMemberRemovedMethod'], 'Limits.ChannelMembers' => $options['limitsChannelMembers'], 'Limits.UserChannels' => $options['limitsUserChannels'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ServiceInstance($this->version, $payload, $this->solution['sid']); } /** * Access the channels */ protected function getChannels(): ChannelList { if (!$this->_channels) { $this->_channels = new ChannelList($this->version, $this->solution['sid']); } return $this->_channels; } /** * Access the roles */ protected function getRoles(): RoleList { if (!$this->_roles) { $this->_roles = new RoleList($this->version, $this->solution['sid']); } return $this->_roles; } /** * Access the users */ protected function getUsers(): UserList { if (!$this->_users) { $this->_users = new UserList($this->version, $this->solution['sid']); } return $this->_users; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V1.ServiceContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V1/ServiceOptions.php000064400000203441150515725700014364 0ustar00options['friendlyName'] = $friendlyName; $this->options['defaultServiceRoleSid'] = $defaultServiceRoleSid; $this->options['defaultChannelRoleSid'] = $defaultChannelRoleSid; $this->options['defaultChannelCreatorRoleSid'] = $defaultChannelCreatorRoleSid; $this->options['readStatusEnabled'] = $readStatusEnabled; $this->options['reachabilityEnabled'] = $reachabilityEnabled; $this->options['typingIndicatorTimeout'] = $typingIndicatorTimeout; $this->options['consumptionReportInterval'] = $consumptionReportInterval; $this->options['notificationsNewMessageEnabled'] = $notificationsNewMessageEnabled; $this->options['notificationsNewMessageTemplate'] = $notificationsNewMessageTemplate; $this->options['notificationsAddedToChannelEnabled'] = $notificationsAddedToChannelEnabled; $this->options['notificationsAddedToChannelTemplate'] = $notificationsAddedToChannelTemplate; $this->options['notificationsRemovedFromChannelEnabled'] = $notificationsRemovedFromChannelEnabled; $this->options['notificationsRemovedFromChannelTemplate'] = $notificationsRemovedFromChannelTemplate; $this->options['notificationsInvitedToChannelEnabled'] = $notificationsInvitedToChannelEnabled; $this->options['notificationsInvitedToChannelTemplate'] = $notificationsInvitedToChannelTemplate; $this->options['preWebhookUrl'] = $preWebhookUrl; $this->options['postWebhookUrl'] = $postWebhookUrl; $this->options['webhookMethod'] = $webhookMethod; $this->options['webhookFilters'] = $webhookFilters; $this->options['webhooksOnMessageSendUrl'] = $webhooksOnMessageSendUrl; $this->options['webhooksOnMessageSendMethod'] = $webhooksOnMessageSendMethod; $this->options['webhooksOnMessageUpdateUrl'] = $webhooksOnMessageUpdateUrl; $this->options['webhooksOnMessageUpdateMethod'] = $webhooksOnMessageUpdateMethod; $this->options['webhooksOnMessageRemoveUrl'] = $webhooksOnMessageRemoveUrl; $this->options['webhooksOnMessageRemoveMethod'] = $webhooksOnMessageRemoveMethod; $this->options['webhooksOnChannelAddUrl'] = $webhooksOnChannelAddUrl; $this->options['webhooksOnChannelAddMethod'] = $webhooksOnChannelAddMethod; $this->options['webhooksOnChannelDestroyUrl'] = $webhooksOnChannelDestroyUrl; $this->options['webhooksOnChannelDestroyMethod'] = $webhooksOnChannelDestroyMethod; $this->options['webhooksOnChannelUpdateUrl'] = $webhooksOnChannelUpdateUrl; $this->options['webhooksOnChannelUpdateMethod'] = $webhooksOnChannelUpdateMethod; $this->options['webhooksOnMemberAddUrl'] = $webhooksOnMemberAddUrl; $this->options['webhooksOnMemberAddMethod'] = $webhooksOnMemberAddMethod; $this->options['webhooksOnMemberRemoveUrl'] = $webhooksOnMemberRemoveUrl; $this->options['webhooksOnMemberRemoveMethod'] = $webhooksOnMemberRemoveMethod; $this->options['webhooksOnMessageSentUrl'] = $webhooksOnMessageSentUrl; $this->options['webhooksOnMessageSentMethod'] = $webhooksOnMessageSentMethod; $this->options['webhooksOnMessageUpdatedUrl'] = $webhooksOnMessageUpdatedUrl; $this->options['webhooksOnMessageUpdatedMethod'] = $webhooksOnMessageUpdatedMethod; $this->options['webhooksOnMessageRemovedUrl'] = $webhooksOnMessageRemovedUrl; $this->options['webhooksOnMessageRemovedMethod'] = $webhooksOnMessageRemovedMethod; $this->options['webhooksOnChannelAddedUrl'] = $webhooksOnChannelAddedUrl; $this->options['webhooksOnChannelAddedMethod'] = $webhooksOnChannelAddedMethod; $this->options['webhooksOnChannelDestroyedUrl'] = $webhooksOnChannelDestroyedUrl; $this->options['webhooksOnChannelDestroyedMethod'] = $webhooksOnChannelDestroyedMethod; $this->options['webhooksOnChannelUpdatedUrl'] = $webhooksOnChannelUpdatedUrl; $this->options['webhooksOnChannelUpdatedMethod'] = $webhooksOnChannelUpdatedMethod; $this->options['webhooksOnMemberAddedUrl'] = $webhooksOnMemberAddedUrl; $this->options['webhooksOnMemberAddedMethod'] = $webhooksOnMemberAddedMethod; $this->options['webhooksOnMemberRemovedUrl'] = $webhooksOnMemberRemovedUrl; $this->options['webhooksOnMemberRemovedMethod'] = $webhooksOnMemberRemovedMethod; $this->options['limitsChannelMembers'] = $limitsChannelMembers; $this->options['limitsUserChannels'] = $limitsUserChannels; } /** * A descriptive string that you create to describe the resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The service role assigned to users when they are added to the service. See the [Roles endpoint](https://www.twilio.com/docs/chat/api/roles) for more details. * * @param string $defaultServiceRoleSid The service role assigned to users when * they are added to the service * @return $this Fluent Builder */ public function setDefaultServiceRoleSid(string $defaultServiceRoleSid): self { $this->options['defaultServiceRoleSid'] = $defaultServiceRoleSid; return $this; } /** * The channel role assigned to users when they are added to a channel. See the [Roles endpoint](https://www.twilio.com/docs/chat/api/roles) for more details. * * @param string $defaultChannelRoleSid The channel role assigned to users when * they are added to a channel * @return $this Fluent Builder */ public function setDefaultChannelRoleSid(string $defaultChannelRoleSid): self { $this->options['defaultChannelRoleSid'] = $defaultChannelRoleSid; return $this; } /** * The channel role assigned to a channel creator when they join a new channel. See the [Roles endpoint](https://www.twilio.com/docs/chat/api/roles) for more details. * * @param string $defaultChannelCreatorRoleSid The channel role assigned to a * channel creator when they join a * new channel * @return $this Fluent Builder */ public function setDefaultChannelCreatorRoleSid(string $defaultChannelCreatorRoleSid): self { $this->options['defaultChannelCreatorRoleSid'] = $defaultChannelCreatorRoleSid; return $this; } /** * Whether to enable the [Message Consumption Horizon](https://www.twilio.com/docs/chat/consumption-horizon) feature. The default is `true`. * * @param bool $readStatusEnabled Whether to enable the Message Consumption * Horizon feature * @return $this Fluent Builder */ public function setReadStatusEnabled(bool $readStatusEnabled): self { $this->options['readStatusEnabled'] = $readStatusEnabled; return $this; } /** * Whether to enable the [Reachability Indicator](https://www.twilio.com/docs/chat/reachability-indicator) for this Service instance. The default is `false`. * * @param bool $reachabilityEnabled Whether to enable the Reachability * Indicator feature for this Service instance * @return $this Fluent Builder */ public function setReachabilityEnabled(bool $reachabilityEnabled): self { $this->options['reachabilityEnabled'] = $reachabilityEnabled; return $this; } /** * How long in seconds after a `started typing` event until clients should assume that user is no longer typing, even if no `ended typing` message was received. The default is 5 seconds. * * @param int $typingIndicatorTimeout How long in seconds to wait before * assuming the user is no longer typing * @return $this Fluent Builder */ public function setTypingIndicatorTimeout(int $typingIndicatorTimeout): self { $this->options['typingIndicatorTimeout'] = $typingIndicatorTimeout; return $this; } /** * DEPRECATED. The interval in seconds between consumption reports submission batches from client endpoints. * * @param int $consumptionReportInterval DEPRECATED * @return $this Fluent Builder */ public function setConsumptionReportInterval(int $consumptionReportInterval): self { $this->options['consumptionReportInterval'] = $consumptionReportInterval; return $this; } /** * Whether to send a notification when a new message is added to a channel. Can be: `true` or `false` and the default is `false`. * * @param bool $notificationsNewMessageEnabled Whether to send a notification * when a new message is added to a * channel * @return $this Fluent Builder */ public function setNotificationsNewMessageEnabled(bool $notificationsNewMessageEnabled): self { $this->options['notificationsNewMessageEnabled'] = $notificationsNewMessageEnabled; return $this; } /** * The template to use to create the notification text displayed when a new message is added to a channel and `notifications.new_message.enabled` is `true`. * * @param string $notificationsNewMessageTemplate The template to use to create * the notification text * displayed when a new message * is added to a channel * @return $this Fluent Builder */ public function setNotificationsNewMessageTemplate(string $notificationsNewMessageTemplate): self { $this->options['notificationsNewMessageTemplate'] = $notificationsNewMessageTemplate; return $this; } /** * Whether to send a notification when a member is added to a channel. Can be: `true` or `false` and the default is `false`. * * @param bool $notificationsAddedToChannelEnabled Whether to send a * notification when a member * is added to a channel * @return $this Fluent Builder */ public function setNotificationsAddedToChannelEnabled(bool $notificationsAddedToChannelEnabled): self { $this->options['notificationsAddedToChannelEnabled'] = $notificationsAddedToChannelEnabled; return $this; } /** * The template to use to create the notification text displayed when a member is added to a channel and `notifications.added_to_channel.enabled` is `true`. * * @param string $notificationsAddedToChannelTemplate The template to use to * create the notification * text displayed when a * member is added to a * channel * @return $this Fluent Builder */ public function setNotificationsAddedToChannelTemplate(string $notificationsAddedToChannelTemplate): self { $this->options['notificationsAddedToChannelTemplate'] = $notificationsAddedToChannelTemplate; return $this; } /** * Whether to send a notification to a user when they are removed from a channel. Can be: `true` or `false` and the default is `false`. * * @param bool $notificationsRemovedFromChannelEnabled Whether to send a * notification to a user * when they are removed * from a channel * @return $this Fluent Builder */ public function setNotificationsRemovedFromChannelEnabled(bool $notificationsRemovedFromChannelEnabled): self { $this->options['notificationsRemovedFromChannelEnabled'] = $notificationsRemovedFromChannelEnabled; return $this; } /** * The template to use to create the notification text displayed to a user when they are removed from a channel and `notifications.removed_from_channel.enabled` is `true`. * * @param string $notificationsRemovedFromChannelTemplate The template to use * to create the * notification text * displayed to a user * when they are removed * @return $this Fluent Builder */ public function setNotificationsRemovedFromChannelTemplate(string $notificationsRemovedFromChannelTemplate): self { $this->options['notificationsRemovedFromChannelTemplate'] = $notificationsRemovedFromChannelTemplate; return $this; } /** * Whether to send a notification when a user is invited to a channel. Can be: `true` or `false` and the default is `false`. * * @param bool $notificationsInvitedToChannelEnabled Whether to send a * notification when a user * is invited to a channel * @return $this Fluent Builder */ public function setNotificationsInvitedToChannelEnabled(bool $notificationsInvitedToChannelEnabled): self { $this->options['notificationsInvitedToChannelEnabled'] = $notificationsInvitedToChannelEnabled; return $this; } /** * The template to use to create the notification text displayed when a user is invited to a channel and `notifications.invited_to_channel.enabled` is `true`. * * @param string $notificationsInvitedToChannelTemplate The template to use to * create the notification * text displayed when a * user is invited to a * channel * @return $this Fluent Builder */ public function setNotificationsInvitedToChannelTemplate(string $notificationsInvitedToChannelTemplate): self { $this->options['notificationsInvitedToChannelTemplate'] = $notificationsInvitedToChannelTemplate; return $this; } /** * The URL for pre-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/api/chat/webhooks) for more details. * * @param string $preWebhookUrl The webhook URL for pre-event webhooks * @return $this Fluent Builder */ public function setPreWebhookUrl(string $preWebhookUrl): self { $this->options['preWebhookUrl'] = $preWebhookUrl; return $this; } /** * The URL for post-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/api/chat/webhooks) for more details. * * @param string $postWebhookUrl The URL for post-event webhooks * @return $this Fluent Builder */ public function setPostWebhookUrl(string $postWebhookUrl): self { $this->options['postWebhookUrl'] = $postWebhookUrl; return $this; } /** * The HTTP method to use for calls to the `pre_webhook_url` and `post_webhook_url` webhooks. Can be: `POST` or `GET` and the default is `POST`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. * * @param string $webhookMethod The HTTP method to use for both PRE and POST * webhooks * @return $this Fluent Builder */ public function setWebhookMethod(string $webhookMethod): self { $this->options['webhookMethod'] = $webhookMethod; return $this; } /** * The list of WebHook events that are enabled for this Service instance. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. * * @param string[] $webhookFilters The list of WebHook events that are enabled * for this Service instance * @return $this Fluent Builder */ public function setWebhookFilters(array $webhookFilters): self { $this->options['webhookFilters'] = $webhookFilters; return $this; } /** * The URL of the webhook to call in response to the `on_message_send` event using the `webhooks.on_message_send.method` HTTP method. * * @param string $webhooksOnMessageSendUrl The URL of the webhook to call in * response to the on_message_send event * @return $this Fluent Builder */ public function setWebhooksOnMessageSendUrl(string $webhooksOnMessageSendUrl): self { $this->options['webhooksOnMessageSendUrl'] = $webhooksOnMessageSendUrl; return $this; } /** * The HTTP method to use when calling the `webhooks.on_message_send.url`. * * @param string $webhooksOnMessageSendMethod The HTTP method to use when * calling the * webhooks.on_message_send.url * @return $this Fluent Builder */ public function setWebhooksOnMessageSendMethod(string $webhooksOnMessageSendMethod): self { $this->options['webhooksOnMessageSendMethod'] = $webhooksOnMessageSendMethod; return $this; } /** * The URL of the webhook to call in response to the `on_message_update` event using the `webhooks.on_message_update.method` HTTP method. * * @param string $webhooksOnMessageUpdateUrl The URL of the webhook to call in * response to the on_message_update * event * @return $this Fluent Builder */ public function setWebhooksOnMessageUpdateUrl(string $webhooksOnMessageUpdateUrl): self { $this->options['webhooksOnMessageUpdateUrl'] = $webhooksOnMessageUpdateUrl; return $this; } /** * The HTTP method to use when calling the `webhooks.on_message_update.url`. * * @param string $webhooksOnMessageUpdateMethod The HTTP method to use when * calling the * webhooks.on_message_update.url * @return $this Fluent Builder */ public function setWebhooksOnMessageUpdateMethod(string $webhooksOnMessageUpdateMethod): self { $this->options['webhooksOnMessageUpdateMethod'] = $webhooksOnMessageUpdateMethod; return $this; } /** * The URL of the webhook to call in response to the `on_message_remove` event using the `webhooks.on_message_remove.method` HTTP method. * * @param string $webhooksOnMessageRemoveUrl The URL of the webhook to call in * response to the on_message_remove * event * @return $this Fluent Builder */ public function setWebhooksOnMessageRemoveUrl(string $webhooksOnMessageRemoveUrl): self { $this->options['webhooksOnMessageRemoveUrl'] = $webhooksOnMessageRemoveUrl; return $this; } /** * The HTTP method to use when calling the `webhooks.on_message_remove.url`. * * @param string $webhooksOnMessageRemoveMethod The HTTP method to use when * calling the * webhooks.on_message_remove.url * @return $this Fluent Builder */ public function setWebhooksOnMessageRemoveMethod(string $webhooksOnMessageRemoveMethod): self { $this->options['webhooksOnMessageRemoveMethod'] = $webhooksOnMessageRemoveMethod; return $this; } /** * The URL of the webhook to call in response to the `on_channel_add` event using the `webhooks.on_channel_add.method` HTTP method. * * @param string $webhooksOnChannelAddUrl The URL of the webhook to call in * response to the on_channel_add event * @return $this Fluent Builder */ public function setWebhooksOnChannelAddUrl(string $webhooksOnChannelAddUrl): self { $this->options['webhooksOnChannelAddUrl'] = $webhooksOnChannelAddUrl; return $this; } /** * The HTTP method to use when calling the `webhooks.on_channel_add.url`. * * @param string $webhooksOnChannelAddMethod The HTTP method to use when * calling the * webhooks.on_channel_add.url * @return $this Fluent Builder */ public function setWebhooksOnChannelAddMethod(string $webhooksOnChannelAddMethod): self { $this->options['webhooksOnChannelAddMethod'] = $webhooksOnChannelAddMethod; return $this; } /** * The URL of the webhook to call in response to the `on_channel_destroy` event using the `webhooks.on_channel_destroy.method` HTTP method. * * @param string $webhooksOnChannelDestroyUrl The URL of the webhook to call in * response to the * on_channel_destroy event * @return $this Fluent Builder */ public function setWebhooksOnChannelDestroyUrl(string $webhooksOnChannelDestroyUrl): self { $this->options['webhooksOnChannelDestroyUrl'] = $webhooksOnChannelDestroyUrl; return $this; } /** * The HTTP method to use when calling the `webhooks.on_channel_destroy.url`. * * @param string $webhooksOnChannelDestroyMethod The HTTP method to use when * calling the * webhooks.on_channel_destroy.url * @return $this Fluent Builder */ public function setWebhooksOnChannelDestroyMethod(string $webhooksOnChannelDestroyMethod): self { $this->options['webhooksOnChannelDestroyMethod'] = $webhooksOnChannelDestroyMethod; return $this; } /** * The URL of the webhook to call in response to the `on_channel_update` event using the `webhooks.on_channel_update.method` HTTP method. * * @param string $webhooksOnChannelUpdateUrl The URL of the webhook to call in * response to the on_channel_update * event * @return $this Fluent Builder */ public function setWebhooksOnChannelUpdateUrl(string $webhooksOnChannelUpdateUrl): self { $this->options['webhooksOnChannelUpdateUrl'] = $webhooksOnChannelUpdateUrl; return $this; } /** * The HTTP method to use when calling the `webhooks.on_channel_update.url`. * * @param string $webhooksOnChannelUpdateMethod The HTTP method to use when * calling the * webhooks.on_channel_update.url * @return $this Fluent Builder */ public function setWebhooksOnChannelUpdateMethod(string $webhooksOnChannelUpdateMethod): self { $this->options['webhooksOnChannelUpdateMethod'] = $webhooksOnChannelUpdateMethod; return $this; } /** * The URL of the webhook to call in response to the `on_member_add` event using the `webhooks.on_member_add.method` HTTP method. * * @param string $webhooksOnMemberAddUrl The URL of the webhook to call in * response to the on_member_add event * @return $this Fluent Builder */ public function setWebhooksOnMemberAddUrl(string $webhooksOnMemberAddUrl): self { $this->options['webhooksOnMemberAddUrl'] = $webhooksOnMemberAddUrl; return $this; } /** * The HTTP method to use when calling the `webhooks.on_member_add.url`. * * @param string $webhooksOnMemberAddMethod The HTTP method to use when calling * the webhooks.on_member_add.url * @return $this Fluent Builder */ public function setWebhooksOnMemberAddMethod(string $webhooksOnMemberAddMethod): self { $this->options['webhooksOnMemberAddMethod'] = $webhooksOnMemberAddMethod; return $this; } /** * The URL of the webhook to call in response to the `on_member_remove` event using the `webhooks.on_member_remove.method` HTTP method. * * @param string $webhooksOnMemberRemoveUrl The URL of the webhook to call in * response to the on_member_remove * event * @return $this Fluent Builder */ public function setWebhooksOnMemberRemoveUrl(string $webhooksOnMemberRemoveUrl): self { $this->options['webhooksOnMemberRemoveUrl'] = $webhooksOnMemberRemoveUrl; return $this; } /** * The HTTP method to use when calling the `webhooks.on_member_remove.url`. * * @param string $webhooksOnMemberRemoveMethod The HTTP method to use when * calling the * webhooks.on_member_remove.url * @return $this Fluent Builder */ public function setWebhooksOnMemberRemoveMethod(string $webhooksOnMemberRemoveMethod): self { $this->options['webhooksOnMemberRemoveMethod'] = $webhooksOnMemberRemoveMethod; return $this; } /** * The URL of the webhook to call in response to the `on_message_sent` event using the `webhooks.on_message_sent.method` HTTP method. * * @param string $webhooksOnMessageSentUrl The URL of the webhook to call in * response to the on_message_sent event * @return $this Fluent Builder */ public function setWebhooksOnMessageSentUrl(string $webhooksOnMessageSentUrl): self { $this->options['webhooksOnMessageSentUrl'] = $webhooksOnMessageSentUrl; return $this; } /** * The URL of the webhook to call in response to the `on_message_sent` event`. * * @param string $webhooksOnMessageSentMethod The URL of the webhook to call in * response to the on_message_sent * event * @return $this Fluent Builder */ public function setWebhooksOnMessageSentMethod(string $webhooksOnMessageSentMethod): self { $this->options['webhooksOnMessageSentMethod'] = $webhooksOnMessageSentMethod; return $this; } /** * The URL of the webhook to call in response to the `on_message_updated` event using the `webhooks.on_message_updated.method` HTTP method. * * @param string $webhooksOnMessageUpdatedUrl The URL of the webhook to call in * response to the * on_message_updated event * @return $this Fluent Builder */ public function setWebhooksOnMessageUpdatedUrl(string $webhooksOnMessageUpdatedUrl): self { $this->options['webhooksOnMessageUpdatedUrl'] = $webhooksOnMessageUpdatedUrl; return $this; } /** * The HTTP method to use when calling the `webhooks.on_message_updated.url`. * * @param string $webhooksOnMessageUpdatedMethod The HTTP method to use when * calling the * webhooks.on_message_updated.url * @return $this Fluent Builder */ public function setWebhooksOnMessageUpdatedMethod(string $webhooksOnMessageUpdatedMethod): self { $this->options['webhooksOnMessageUpdatedMethod'] = $webhooksOnMessageUpdatedMethod; return $this; } /** * The URL of the webhook to call in response to the `on_message_removed` event using the `webhooks.on_message_removed.method` HTTP method. * * @param string $webhooksOnMessageRemovedUrl The URL of the webhook to call in * response to the * on_message_removed event * @return $this Fluent Builder */ public function setWebhooksOnMessageRemovedUrl(string $webhooksOnMessageRemovedUrl): self { $this->options['webhooksOnMessageRemovedUrl'] = $webhooksOnMessageRemovedUrl; return $this; } /** * The HTTP method to use when calling the `webhooks.on_message_removed.url`. * * @param string $webhooksOnMessageRemovedMethod The HTTP method to use when * calling the * webhooks.on_message_removed.url * @return $this Fluent Builder */ public function setWebhooksOnMessageRemovedMethod(string $webhooksOnMessageRemovedMethod): self { $this->options['webhooksOnMessageRemovedMethod'] = $webhooksOnMessageRemovedMethod; return $this; } /** * The URL of the webhook to call in response to the `on_channel_added` event using the `webhooks.on_channel_added.method` HTTP method. * * @param string $webhooksOnChannelAddedUrl The URL of the webhook to call in * response to the on_channel_added * event * @return $this Fluent Builder */ public function setWebhooksOnChannelAddedUrl(string $webhooksOnChannelAddedUrl): self { $this->options['webhooksOnChannelAddedUrl'] = $webhooksOnChannelAddedUrl; return $this; } /** * The URL of the webhook to call in response to the `on_channel_added` event`. * * @param string $webhooksOnChannelAddedMethod The URL of the webhook to call * in response to the * on_channel_added event * @return $this Fluent Builder */ public function setWebhooksOnChannelAddedMethod(string $webhooksOnChannelAddedMethod): self { $this->options['webhooksOnChannelAddedMethod'] = $webhooksOnChannelAddedMethod; return $this; } /** * The URL of the webhook to call in response to the `on_channel_added` event using the `webhooks.on_channel_destroyed.method` HTTP method. * * @param string $webhooksOnChannelDestroyedUrl The URL of the webhook to call * in response to the * on_channel_added event * @return $this Fluent Builder */ public function setWebhooksOnChannelDestroyedUrl(string $webhooksOnChannelDestroyedUrl): self { $this->options['webhooksOnChannelDestroyedUrl'] = $webhooksOnChannelDestroyedUrl; return $this; } /** * The HTTP method to use when calling the `webhooks.on_channel_destroyed.url`. * * @param string $webhooksOnChannelDestroyedMethod The HTTP method to use when * calling the * webhooks.on_channel_destroyed.url * @return $this Fluent Builder */ public function setWebhooksOnChannelDestroyedMethod(string $webhooksOnChannelDestroyedMethod): self { $this->options['webhooksOnChannelDestroyedMethod'] = $webhooksOnChannelDestroyedMethod; return $this; } /** * The URL of the webhook to call in response to the `on_channel_updated` event using the `webhooks.on_channel_updated.method` HTTP method. * * @param string $webhooksOnChannelUpdatedUrl he URL of the webhook to call in * response to the * on_channel_updated event * @return $this Fluent Builder */ public function setWebhooksOnChannelUpdatedUrl(string $webhooksOnChannelUpdatedUrl): self { $this->options['webhooksOnChannelUpdatedUrl'] = $webhooksOnChannelUpdatedUrl; return $this; } /** * The HTTP method to use when calling the `webhooks.on_channel_updated.url`. * * @param string $webhooksOnChannelUpdatedMethod The HTTP method to use when * calling the * webhooks.on_channel_updated.url * @return $this Fluent Builder */ public function setWebhooksOnChannelUpdatedMethod(string $webhooksOnChannelUpdatedMethod): self { $this->options['webhooksOnChannelUpdatedMethod'] = $webhooksOnChannelUpdatedMethod; return $this; } /** * The URL of the webhook to call in response to the `on_channel_updated` event using the `webhooks.on_channel_updated.method` HTTP method. * * @param string $webhooksOnMemberAddedUrl The URL of the webhook to call in * response to the on_channel_updated * event * @return $this Fluent Builder */ public function setWebhooksOnMemberAddedUrl(string $webhooksOnMemberAddedUrl): self { $this->options['webhooksOnMemberAddedUrl'] = $webhooksOnMemberAddedUrl; return $this; } /** * The HTTP method to use when calling the `webhooks.on_channel_updated.url`. * * @param string $webhooksOnMemberAddedMethod he HTTP method to use when * calling the * webhooks.on_channel_updated.url * @return $this Fluent Builder */ public function setWebhooksOnMemberAddedMethod(string $webhooksOnMemberAddedMethod): self { $this->options['webhooksOnMemberAddedMethod'] = $webhooksOnMemberAddedMethod; return $this; } /** * The URL of the webhook to call in response to the `on_member_removed` event using the `webhooks.on_member_removed.method` HTTP method. * * @param string $webhooksOnMemberRemovedUrl The URL of the webhook to call in * response to the on_member_removed * event * @return $this Fluent Builder */ public function setWebhooksOnMemberRemovedUrl(string $webhooksOnMemberRemovedUrl): self { $this->options['webhooksOnMemberRemovedUrl'] = $webhooksOnMemberRemovedUrl; return $this; } /** * The HTTP method to use when calling the `webhooks.on_member_removed.url`. * * @param string $webhooksOnMemberRemovedMethod The HTTP method to use when * calling the * webhooks.on_member_removed.url * @return $this Fluent Builder */ public function setWebhooksOnMemberRemovedMethod(string $webhooksOnMemberRemovedMethod): self { $this->options['webhooksOnMemberRemovedMethod'] = $webhooksOnMemberRemovedMethod; return $this; } /** * The maximum number of Members that can be added to Channels within this Service. Can be up to 1,000. * * @param int $limitsChannelMembers The maximum number of Members that can be * added to Channels within this Service * @return $this Fluent Builder */ public function setLimitsChannelMembers(int $limitsChannelMembers): self { $this->options['limitsChannelMembers'] = $limitsChannelMembers; return $this; } /** * The maximum number of Channels Users can be a Member of within this Service. Can be up to 1,000. * * @param int $limitsUserChannels The maximum number of Channels Users can be a * Member of within this Service * @return $this Fluent Builder */ public function setLimitsUserChannels(int $limitsUserChannels): self { $this->options['limitsUserChannels'] = $limitsUserChannels; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V1.UpdateServiceOptions ' . $options . ']'; } }src/Twilio/Rest/Chat/V1/CredentialOptions.php000064400000027244150515725700015043 0ustar00options['friendlyName'] = $friendlyName; $this->options['certificate'] = $certificate; $this->options['privateKey'] = $privateKey; $this->options['sandbox'] = $sandbox; $this->options['apiKey'] = $apiKey; $this->options['secret'] = $secret; } /** * A descriptive string that you create to describe the new resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * [APN only] The URL encoded representation of the certificate. For example, `-----BEGIN CERTIFICATE----- MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEFBQAwgZYxCzAJBgNV.....A== -----END CERTIFICATE-----` * * @param string $certificate [APN only] The URL encoded representation of the * certificate * @return $this Fluent Builder */ public function setCertificate(string $certificate): self { $this->options['certificate'] = $certificate; return $this; } /** * [APN only] The URL encoded representation of the private key. For example, `-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fGgvCI1l9s+cmBY3WIz+cUDqmxiieR. -----END RSA PRIVATE KEY-----` * * @param string $privateKey [APN only] The URL encoded representation of the * private key * @return $this Fluent Builder */ public function setPrivateKey(string $privateKey): self { $this->options['privateKey'] = $privateKey; return $this; } /** * [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. * * @param bool $sandbox [APN only] Whether to send the credential to sandbox * APNs * @return $this Fluent Builder */ public function setSandbox(bool $sandbox): self { $this->options['sandbox'] = $sandbox; return $this; } /** * [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential. * * @param string $apiKey [GCM only] The API key for the project that was * obtained from the Google Developer console for your * GCM Service application credential * @return $this Fluent Builder */ public function setApiKey(string $apiKey): self { $this->options['apiKey'] = $apiKey; return $this; } /** * [FCM only] The **Server key** of your project from the Firebase console, found under Settings / Cloud messaging. * * @param string $secret [FCM only] The Server key of your project from * Firebase console * @return $this Fluent Builder */ public function setSecret(string $secret): self { $this->options['secret'] = $secret; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V1.CreateCredentialOptions ' . $options . ']'; } } class UpdateCredentialOptions extends Options { /** * @param string $friendlyName A string to describe the resource * @param string $certificate [APN only] The URL encoded representation of the * certificate * @param string $privateKey [APN only] The URL encoded representation of the * private key * @param bool $sandbox [APN only] Whether to send the credential to sandbox * APNs * @param string $apiKey [GCM only] The API key for the project that was * obtained from the Google Developer console for your * GCM Service application credential * @param string $secret [FCM only] The Server key of your project from * Firebase console */ public function __construct(string $friendlyName = Values::NONE, string $certificate = Values::NONE, string $privateKey = Values::NONE, bool $sandbox = Values::NONE, string $apiKey = Values::NONE, string $secret = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['certificate'] = $certificate; $this->options['privateKey'] = $privateKey; $this->options['sandbox'] = $sandbox; $this->options['apiKey'] = $apiKey; $this->options['secret'] = $secret; } /** * A descriptive string that you create to describe the resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * [APN only] The URL encoded representation of the certificate. For example, `-----BEGIN CERTIFICATE----- MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEFBQAwgZYxCzAJBgNV.....A== -----END CERTIFICATE-----` * * @param string $certificate [APN only] The URL encoded representation of the * certificate * @return $this Fluent Builder */ public function setCertificate(string $certificate): self { $this->options['certificate'] = $certificate; return $this; } /** * [APN only] The URL encoded representation of the private key. For example, `-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fGgvCI1l9s+cmBY3WIz+cUDqmxiieR. -----END RSA PRIVATE KEY-----` * * @param string $privateKey [APN only] The URL encoded representation of the * private key * @return $this Fluent Builder */ public function setPrivateKey(string $privateKey): self { $this->options['privateKey'] = $privateKey; return $this; } /** * [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. * * @param bool $sandbox [APN only] Whether to send the credential to sandbox * APNs * @return $this Fluent Builder */ public function setSandbox(bool $sandbox): self { $this->options['sandbox'] = $sandbox; return $this; } /** * [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential. * * @param string $apiKey [GCM only] The API key for the project that was * obtained from the Google Developer console for your * GCM Service application credential * @return $this Fluent Builder */ public function setApiKey(string $apiKey): self { $this->options['apiKey'] = $apiKey; return $this; } /** * [FCM only] The **Server key** of your project from the Firebase console, found under Settings / Cloud messaging. * * @param string $secret [FCM only] The Server key of your project from * Firebase console * @return $this Fluent Builder */ public function setSecret(string $secret): self { $this->options['secret'] = $secret; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V1.UpdateCredentialOptions ' . $options . ']'; } }src/Twilio/Rest/Chat/V1/ServicePage.php000064400000002163150515725700013603 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ServiceInstance \Twilio\Rest\Chat\V1\ServiceInstance */ public function buildInstance(array $payload): ServiceInstance { return new ServiceInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V1.ServicePage]'; } }src/Twilio/Rest/Chat/V1/CredentialPage.php000064400000002205150515725700014252 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CredentialInstance \Twilio\Rest\Chat\V1\CredentialInstance */ public function buildInstance(array $payload): CredentialInstance { return new CredentialInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V1.CredentialPage]'; } }src/Twilio/Rest/Chat/V1/ServiceList.php000064400000012044150515725700013641 0ustar00solution = []; $this->uri = '/Services'; } /** * Create the ServiceInstance * * @param string $friendlyName A string to describe the resource * @return ServiceInstance Created ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName): ServiceInstance { $data = Values::of(['FriendlyName' => $friendlyName, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ServiceInstance($this->version, $payload); } /** * Streams ServiceInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ServiceInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return ServiceInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of ServiceInstance records from the API. * Request is executed immediately * * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return ServicePage Page of ServiceInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ServicePage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ServicePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ServiceInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ServicePage Page of ServiceInstance */ public function getPage(string $targetUrl): ServicePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ServicePage($this->version, $response, $this->solution); } /** * Constructs a ServiceContext * * @param string $sid The unique string that identifies the resource */ public function getContext(string $sid): ServiceContext { return new ServiceContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V1.ServiceList]'; } }src/Twilio/Rest/Chat/V1/CredentialInstance.php000064400000007742150515725700015155 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'type' => Values::array_get($payload, 'type'), 'sandbox' => Values::array_get($payload, 'sandbox'), '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 = ['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 CredentialContext Context for this CredentialInstance */ protected function proxy(): CredentialContext { if (!$this->context) { $this->context = new CredentialContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the CredentialInstance * * @return CredentialInstance Fetched CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CredentialInstance { return $this->proxy()->fetch(); } /** * Update the CredentialInstance * * @param array|Options $options Optional Arguments * @return CredentialInstance Updated CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): CredentialInstance { return $this->proxy()->update($options); } /** * Delete the CredentialInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V1.CredentialInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V1.php000064400000005037150515725700011411 0ustar00version = 'v1'; } protected function getCredentials(): CredentialList { if (!$this->_credentials) { $this->_credentials = new CredentialList($this); } return $this->_credentials; } protected function getServices(): ServiceList { if (!$this->_services) { $this->_services = new ServiceList($this); } return $this->_services; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Chat.V1]'; } }src/Twilio/Rest/Chat/V2.php000064400000005037150515725700011412 0ustar00version = 'v2'; } protected function getCredentials(): CredentialList { if (!$this->_credentials) { $this->_credentials = new CredentialList($this); } return $this->_credentials; } protected function getServices(): ServiceList { if (!$this->_services) { $this->_services = new ServiceList($this); } return $this->_services; } /** * Magic getter to lazy load root resources * * @param string $name Resource to return * @return \Twilio\ListResource The requested resource * @throws TwilioException For unknown resource */ public function __get(string $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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { return '[Twilio.Chat.V2]'; } }src/Twilio/Rest/Chat/V2/ServiceInstance.php000064400000015121150515725700014472 0ustar00properties = [ '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')), 'defaultServiceRoleSid' => Values::array_get($payload, 'default_service_role_sid'), 'defaultChannelRoleSid' => Values::array_get($payload, 'default_channel_role_sid'), 'defaultChannelCreatorRoleSid' => Values::array_get($payload, 'default_channel_creator_role_sid'), 'readStatusEnabled' => Values::array_get($payload, 'read_status_enabled'), 'reachabilityEnabled' => Values::array_get($payload, 'reachability_enabled'), 'typingIndicatorTimeout' => Values::array_get($payload, 'typing_indicator_timeout'), 'consumptionReportInterval' => Values::array_get($payload, 'consumption_report_interval'), 'limits' => Values::array_get($payload, 'limits'), 'preWebhookUrl' => Values::array_get($payload, 'pre_webhook_url'), 'postWebhookUrl' => Values::array_get($payload, 'post_webhook_url'), 'webhookMethod' => Values::array_get($payload, 'webhook_method'), 'webhookFilters' => Values::array_get($payload, 'webhook_filters'), 'preWebhookRetryCount' => Values::array_get($payload, 'pre_webhook_retry_count'), 'postWebhookRetryCount' => Values::array_get($payload, 'post_webhook_retry_count'), 'notifications' => Values::array_get($payload, 'notifications'), 'media' => Values::array_get($payload, 'media'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['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 ServiceContext Context for this ServiceInstance */ protected function proxy(): ServiceContext { if (!$this->context) { $this->context = new ServiceContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the ServiceInstance * * @return ServiceInstance Fetched ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ServiceInstance { return $this->proxy()->fetch(); } /** * Delete the ServiceInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the ServiceInstance * * @param array|Options $options Optional Arguments * @return ServiceInstance Updated ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ServiceInstance { return $this->proxy()->update($options); } /** * Access the channels */ protected function getChannels(): ChannelList { return $this->proxy()->channels; } /** * Access the roles */ protected function getRoles(): RoleList { return $this->proxy()->roles; } /** * Access the users */ protected function getUsers(): UserList { return $this->proxy()->users; } /** * Access the bindings */ protected function getBindings(): BindingList { return $this->proxy()->bindings; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V2.ServiceInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V2/CredentialList.php000064400000013173150515725700014320 0ustar00solution = []; $this->uri = '/Credentials'; } /** * Streams CredentialInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads CredentialInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return CredentialInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of CredentialInstance records from the API. * Request is executed immediately * * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return CredentialPage Page of CredentialInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): CredentialPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new CredentialPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of CredentialInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return CredentialPage Page of CredentialInstance */ public function getPage(string $targetUrl): CredentialPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new CredentialPage($this->version, $response, $this->solution); } /** * Create the CredentialInstance * * @param string $type The type of push-notification service the credential is * for * @param array|Options $options Optional Arguments * @return CredentialInstance Created CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $type, array $options = []): CredentialInstance { $options = new Values($options); $data = Values::of([ 'Type' => $type, 'FriendlyName' => $options['friendlyName'], 'Certificate' => $options['certificate'], 'PrivateKey' => $options['privateKey'], 'Sandbox' => Serialize::booleanToString($options['sandbox']), 'ApiKey' => $options['apiKey'], 'Secret' => $options['secret'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new CredentialInstance($this->version, $payload); } /** * Constructs a CredentialContext * * @param string $sid The SID of the Credential resource to fetch */ public function getContext(string $sid): CredentialContext { return new CredentialContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V2.CredentialList]'; } }src/Twilio/Rest/Chat/V2/CredentialContext.php000064400000005242150515725700015027 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Credentials/' . \rawurlencode($sid) . ''; } /** * Fetch the CredentialInstance * * @return CredentialInstance Fetched CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CredentialInstance { $payload = $this->version->fetch('GET', $this->uri); return new CredentialInstance($this->version, $payload, $this->solution['sid']); } /** * Update the CredentialInstance * * @param array|Options $options Optional Arguments * @return CredentialInstance Updated CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): CredentialInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'Certificate' => $options['certificate'], 'PrivateKey' => $options['privateKey'], 'Sandbox' => Serialize::booleanToString($options['sandbox']), 'ApiKey' => $options['apiKey'], 'Secret' => $options['secret'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new CredentialInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the CredentialInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V2.CredentialContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V2/Service/BindingList.php000064400000012460150515725700015216 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Bindings'; } /** * Streams BindingInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param array|Options $options Optional Arguments * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads BindingInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param array|Options $options Optional Arguments * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return BindingInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of BindingInstance records from the API. * Request is executed immediately * * @param array|Options $options Optional Arguments * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return BindingPage Page of BindingInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): BindingPage { $options = new Values($options); $params = Values::of([ 'BindingType' => Serialize::map($options['bindingType'], function($e) { return $e; }), 'Identity' => Serialize::map($options['identity'], function($e) { return $e; }), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new BindingPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of BindingInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return BindingPage Page of BindingInstance */ public function getPage(string $targetUrl): BindingPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new BindingPage($this->version, $response, $this->solution); } /** * Constructs a BindingContext * * @param string $sid The SID of the resource to fetch */ public function getContext(string $sid): BindingContext { return new BindingContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V2.BindingList]'; } }src/Twilio/Rest/Chat/V2/Service/BindingContext.php000064400000003745150515725700015735 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Bindings/' . \rawurlencode($sid) . ''; } /** * Fetch the BindingInstance * * @return BindingInstance Fetched BindingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): BindingInstance { $payload = $this->version->fetch('GET', $this->uri); return new BindingInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Delete the BindingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V2.BindingContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V2/Service/ChannelContext.php000064400000015171150515725700015727 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($sid) . ''; } /** * Fetch the ChannelInstance * * @return ChannelInstance Fetched ChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ChannelInstance { $payload = $this->version->fetch('GET', $this->uri); return new ChannelInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Delete the ChannelInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { $options = new Values($options); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); return $this->version->delete('DELETE', $this->uri, [], [], $headers); } /** * Update the ChannelInstance * * @param array|Options $options Optional Arguments * @return ChannelInstance Updated ChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ChannelInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'UniqueName' => $options['uniqueName'], 'Attributes' => $options['attributes'], 'DateCreated' => Serialize::iso8601DateTime($options['dateCreated']), 'DateUpdated' => Serialize::iso8601DateTime($options['dateUpdated']), 'CreatedBy' => $options['createdBy'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->update('POST', $this->uri, [], $data, $headers); return new ChannelInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Access the members */ protected function getMembers(): MemberList { if (!$this->_members) { $this->_members = new MemberList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_members; } /** * Access the messages */ protected function getMessages(): MessageList { if (!$this->_messages) { $this->_messages = new MessageList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_messages; } /** * Access the invites */ protected function getInvites(): InviteList { if (!$this->_invites) { $this->_invites = new InviteList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_invites; } /** * Access the webhooks */ protected function getWebhooks(): WebhookList { if (!$this->_webhooks) { $this->_webhooks = new WebhookList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_webhooks; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V2.ChannelContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V2/Service/UserPage.php000064400000002220150515725700014514 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return UserInstance \Twilio\Rest\Chat\V2\Service\UserInstance */ public function buildInstance(array $payload): UserInstance { return new UserInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V2.UserPage]'; } }src/Twilio/Rest/Chat/V2/Service/ChannelOptions.php000064400000040752150515725700015741 0ustar00options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V2.DeleteChannelOptions ' . $options . ']'; } } class CreateChannelOptions extends Options { /** * @param string $friendlyName A string to describe the new resource * @param string $uniqueName An application-defined string that uniquely * identifies the Channel resource * @param string $attributes A valid JSON string that contains * application-specific data * @param string $type The visibility of the channel * @param \DateTime $dateCreated The ISO 8601 date and time in GMT when the * resource was created * @param \DateTime $dateUpdated The ISO 8601 date and time in GMT when the * resource was updated * @param string $createdBy The identity of the User that created the Channel * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header */ public function __construct(string $friendlyName = Values::NONE, string $uniqueName = Values::NONE, string $attributes = Values::NONE, string $type = Values::NONE, \DateTime $dateCreated = Values::NONE, \DateTime $dateUpdated = Values::NONE, string $createdBy = Values::NONE, string $xTwilioWebhookEnabled = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['uniqueName'] = $uniqueName; $this->options['attributes'] = $attributes; $this->options['type'] = $type; $this->options['dateCreated'] = $dateCreated; $this->options['dateUpdated'] = $dateUpdated; $this->options['createdBy'] = $createdBy; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * A descriptive string that you create to describe the new resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the new resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the Channel resource's `sid` in the URL. This value must be 64 characters or less in length and be unique within the Service. * * @param string $uniqueName An application-defined string that uniquely * identifies the Channel resource * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * A valid JSON string that contains application-specific data. * * @param string $attributes A valid JSON string that contains * application-specific data * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The visibility of the channel. Can be: `public` or `private` and defaults to `public`. * * @param string $type The visibility of the channel * @return $this Fluent Builder */ public function setType(string $type): self { $this->options['type'] = $type; return $this; } /** * The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. Note that this should only be used in cases where a Channel is being recreated from a backup/separate source. * * @param \DateTime $dateCreated The ISO 8601 date and time in GMT when the * resource was created * @return $this Fluent Builder */ public function setDateCreated(\DateTime $dateCreated): self { $this->options['dateCreated'] = $dateCreated; return $this; } /** * The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was last updated. The default value is `null`. Note that this parameter should only be used in cases where a Channel is being recreated from a backup/separate source and where a Message was previously updated. * * @param \DateTime $dateUpdated The ISO 8601 date and time in GMT when the * resource was updated * @return $this Fluent Builder */ public function setDateUpdated(\DateTime $dateUpdated): self { $this->options['dateUpdated'] = $dateUpdated; return $this; } /** * The `identity` of the User that created the channel. Default is: `system`. * * @param string $createdBy The identity of the User that created the Channel * @return $this Fluent Builder */ public function setCreatedBy(string $createdBy): self { $this->options['createdBy'] = $createdBy; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V2.CreateChannelOptions ' . $options . ']'; } } class ReadChannelOptions extends Options { /** * @param string[] $type The visibility of the channel to read */ public function __construct(array $type = Values::ARRAY_NONE) { $this->options['type'] = $type; } /** * The visibility of the Channels to read. Can be: `public` or `private` and defaults to `public`. * * @param string[] $type The visibility of the channel to read * @return $this Fluent Builder */ public function setType(array $type): self { $this->options['type'] = $type; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V2.ReadChannelOptions ' . $options . ']'; } } class UpdateChannelOptions extends Options { /** * @param string $friendlyName A string to describe the resource * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @param string $attributes A valid JSON string that contains * application-specific data * @param \DateTime $dateCreated The ISO 8601 date and time in GMT when the * resource was created * @param \DateTime $dateUpdated The ISO 8601 date and time in GMT when the * resource was updated * @param string $createdBy The identity of the User that created the Channel * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header */ public function __construct(string $friendlyName = Values::NONE, string $uniqueName = Values::NONE, string $attributes = Values::NONE, \DateTime $dateCreated = Values::NONE, \DateTime $dateUpdated = Values::NONE, string $createdBy = Values::NONE, string $xTwilioWebhookEnabled = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['uniqueName'] = $uniqueName; $this->options['attributes'] = $attributes; $this->options['dateCreated'] = $dateCreated; $this->options['dateUpdated'] = $dateUpdated; $this->options['createdBy'] = $createdBy; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * A descriptive string that you create to describe the resource. It can be up to 256 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. This value must be 256 characters or less in length and unique within the Service. * * @param string $uniqueName An application-defined string that uniquely * identifies the resource * @return $this Fluent Builder */ public function setUniqueName(string $uniqueName): self { $this->options['uniqueName'] = $uniqueName; return $this; } /** * A valid JSON string that contains application-specific data. * * @param string $attributes A valid JSON string that contains * application-specific data * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. Note that this should only be used in cases where a Channel is being recreated from a backup/separate source. * * @param \DateTime $dateCreated The ISO 8601 date and time in GMT when the * resource was created * @return $this Fluent Builder */ public function setDateCreated(\DateTime $dateCreated): self { $this->options['dateCreated'] = $dateCreated; return $this; } /** * The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was last updated. * * @param \DateTime $dateUpdated The ISO 8601 date and time in GMT when the * resource was updated * @return $this Fluent Builder */ public function setDateUpdated(\DateTime $dateUpdated): self { $this->options['dateUpdated'] = $dateUpdated; return $this; } /** * The `identity` of the User that created the channel. Default is: `system`. * * @param string $createdBy The identity of the User that created the Channel * @return $this Fluent Builder */ public function setCreatedBy(string $createdBy): self { $this->options['createdBy'] = $createdBy; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V2.UpdateChannelOptions ' . $options . ']'; } }src/Twilio/Rest/Chat/V2/Service/UserContext.php000064400000012233150515725700015271 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Users/' . \rawurlencode($sid) . ''; } /** * Fetch the UserInstance * * @return UserInstance Fetched UserInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): UserInstance { $payload = $this->version->fetch('GET', $this->uri); return new UserInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Delete the UserInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the UserInstance * * @param array|Options $options Optional Arguments * @return UserInstance Updated UserInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): UserInstance { $options = new Values($options); $data = Values::of([ 'RoleSid' => $options['roleSid'], 'Attributes' => $options['attributes'], 'FriendlyName' => $options['friendlyName'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->update('POST', $this->uri, [], $data, $headers); return new UserInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Access the userChannels */ protected function getUserChannels(): UserChannelList { if (!$this->_userChannels) { $this->_userChannels = new UserChannelList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_userChannels; } /** * Access the userBindings */ protected function getUserBindings(): UserBindingList { if (!$this->_userBindings) { $this->_userBindings = new UserBindingList( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->_userBindings; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V2.UserContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V2/Service/RoleList.php000064400000013045150515725700014545 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Roles'; } /** * Create the RoleInstance * * @param string $friendlyName A string to describe the new resource * @param string $type The type of role * @param string[] $permission A permission the role should have * @return RoleInstance Created RoleInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName, string $type, array $permission): RoleInstance { $data = Values::of([ 'FriendlyName' => $friendlyName, 'Type' => $type, 'Permission' => Serialize::map($permission, function($e) { return $e; }), ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new RoleInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Streams RoleInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads RoleInstance 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 RoleInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of RoleInstance 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 RolePage Page of RoleInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): RolePage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new RolePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of RoleInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return RolePage Page of RoleInstance */ public function getPage(string $targetUrl): RolePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new RolePage($this->version, $response, $this->solution); } /** * Constructs a RoleContext * * @param string $sid The SID of the Role resource to fetch */ public function getContext(string $sid): RoleContext { return new RoleContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V2.RoleList]'; } }src/Twilio/Rest/Chat/V2/Service/UserOptions.php000064400000016345150515725700015310 0ustar00options['roleSid'] = $roleSid; $this->options['attributes'] = $attributes; $this->options['friendlyName'] = $friendlyName; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) to assign to the new User. * * @param string $roleSid The SID of the Role assigned to this user * @return $this Fluent Builder */ public function setRoleSid(string $roleSid): self { $this->options['roleSid'] = $roleSid; return $this; } /** * A valid JSON string that contains application-specific data. * * @param string $attributes A valid JSON string that contains * application-specific data * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * A descriptive string that you create to describe the new resource. This value is often used for display purposes. * * @param string $friendlyName A string to describe the new resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V2.CreateUserOptions ' . $options . ']'; } } class UpdateUserOptions extends Options { /** * @param string $roleSid The SID id of the Role assigned to this user * @param string $attributes A valid JSON string that contains * application-specific data * @param string $friendlyName A string to describe the resource * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header */ public function __construct(string $roleSid = Values::NONE, string $attributes = Values::NONE, string $friendlyName = Values::NONE, string $xTwilioWebhookEnabled = Values::NONE) { $this->options['roleSid'] = $roleSid; $this->options['attributes'] = $attributes; $this->options['friendlyName'] = $friendlyName; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) to assign to the User. * * @param string $roleSid The SID id of the Role assigned to this user * @return $this Fluent Builder */ public function setRoleSid(string $roleSid): self { $this->options['roleSid'] = $roleSid; return $this; } /** * A valid JSON string that contains application-specific data. * * @param string $attributes A valid JSON string that contains * application-specific data * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * A descriptive string that you create to describe the resource. It is often used for display purposes. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V2.UpdateUserOptions ' . $options . ']'; } }src/Twilio/Rest/Chat/V2/Service/RoleContext.php000064400000005157150515725700015263 0ustar00solution = ['serviceSid' => $serviceSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Roles/' . \rawurlencode($sid) . ''; } /** * Fetch the RoleInstance * * @return RoleInstance Fetched RoleInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RoleInstance { $payload = $this->version->fetch('GET', $this->uri); return new RoleInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Delete the RoleInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the RoleInstance * * @param string[] $permission A permission the role should have * @return RoleInstance Updated RoleInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $permission): RoleInstance { $data = Values::of(['Permission' => Serialize::map($permission, function($e) { return $e; }), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new RoleInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V2.RoleContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V2/Service/RoleInstance.php000064400000010375150515725700015401 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'type' => Values::array_get($payload, 'type'), 'permissions' => Values::array_get($payload, 'permissions'), '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 = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return RoleContext Context for this RoleInstance */ protected function proxy(): RoleContext { if (!$this->context) { $this->context = new RoleContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the RoleInstance * * @return RoleInstance Fetched RoleInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): RoleInstance { return $this->proxy()->fetch(); } /** * Delete the RoleInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the RoleInstance * * @param string[] $permission A permission the role should have * @return RoleInstance Updated RoleInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $permission): RoleInstance { return $this->proxy()->update($permission); } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V2.RoleInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V2/Service/ChannelInstance.php000064400000013335150515725700016047 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'uniqueName' => Values::array_get($payload, 'unique_name'), 'attributes' => Values::array_get($payload, 'attributes'), 'type' => Values::array_get($payload, 'type'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'createdBy' => Values::array_get($payload, 'created_by'), 'membersCount' => Values::array_get($payload, 'members_count'), 'messagesCount' => Values::array_get($payload, 'messages_count'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return ChannelContext Context for this ChannelInstance */ protected function proxy(): ChannelContext { if (!$this->context) { $this->context = new ChannelContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the ChannelInstance * * @return ChannelInstance Fetched ChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ChannelInstance { return $this->proxy()->fetch(); } /** * Delete the ChannelInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { return $this->proxy()->delete($options); } /** * Update the ChannelInstance * * @param array|Options $options Optional Arguments * @return ChannelInstance Updated ChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ChannelInstance { return $this->proxy()->update($options); } /** * Access the members */ protected function getMembers(): MemberList { return $this->proxy()->members; } /** * Access the messages */ protected function getMessages(): MessageList { return $this->proxy()->messages; } /** * Access the invites */ protected function getInvites(): InviteList { return $this->proxy()->invites; } /** * Access the webhooks */ protected function getWebhooks(): WebhookList { return $this->proxy()->webhooks; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V2.ChannelInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V2/Service/Channel/InvitePage.php000064400000002405150515725700016411 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return InviteInstance \Twilio\Rest\Chat\V2\Service\Channel\InviteInstance */ public function buildInstance(array $payload): InviteInstance { return new InviteInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V2.InvitePage]'; } }src/Twilio/Rest/Chat/V2/Service/Channel/MemberOptions.php000064400000045071150515725700017147 0ustar00options['roleSid'] = $roleSid; $this->options['lastConsumedMessageIndex'] = $lastConsumedMessageIndex; $this->options['lastConsumptionTimestamp'] = $lastConsumptionTimestamp; $this->options['dateCreated'] = $dateCreated; $this->options['dateUpdated'] = $dateUpdated; $this->options['attributes'] = $attributes; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) to assign to the member. The default roles are those specified on the [Service](https://www.twilio.com/docs/chat/rest/service-resource). * * @param string $roleSid The SID of the Role to assign to the member * @return $this Fluent Builder */ public function setRoleSid(string $roleSid): self { $this->options['roleSid'] = $roleSid; return $this; } /** * The index of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) in the [Channel](https://www.twilio.com/docs/chat/channels) that the Member has read. This parameter should only be used when recreating a Member from a backup/separate source. * * @param int $lastConsumedMessageIndex The index of the last Message in the * Channel the Member has read * @return $this Fluent Builder */ public function setLastConsumedMessageIndex(int $lastConsumedMessageIndex): self { $this->options['lastConsumedMessageIndex'] = $lastConsumedMessageIndex; return $this; } /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) read event for the Member within the [Channel](https://www.twilio.com/docs/chat/channels). * * @param \DateTime $lastConsumptionTimestamp The ISO 8601 based timestamp * string representing the datetime * of the last Message read event * for the member within the Channel * @return $this Fluent Builder */ public function setLastConsumptionTimestamp(\DateTime $lastConsumptionTimestamp): self { $this->options['lastConsumptionTimestamp'] = $lastConsumptionTimestamp; return $this; } /** * The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. Note that this parameter should only be used when a Member is being recreated from a backup/separate source. * * @param \DateTime $dateCreated The ISO 8601 date and time in GMT when the * resource was created * @return $this Fluent Builder */ public function setDateCreated(\DateTime $dateCreated): self { $this->options['dateCreated'] = $dateCreated; return $this; } /** * The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was last updated. The default value is `null`. Note that this parameter should only be used when a Member is being recreated from a backup/separate source and where a Member was previously updated. * * @param \DateTime $dateUpdated The ISO 8601 date and time in GMT when the * resource was updated * @return $this Fluent Builder */ public function setDateUpdated(\DateTime $dateUpdated): self { $this->options['dateUpdated'] = $dateUpdated; return $this; } /** * A valid JSON string that contains application-specific data. * * @param string $attributes A valid JSON string that contains * application-specific data * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V2.CreateMemberOptions ' . $options . ']'; } } class ReadMemberOptions extends Options { /** * @param string[] $identity The `identity` value of the resources to read */ public function __construct(array $identity = Values::ARRAY_NONE) { $this->options['identity'] = $identity; } /** * The [User](https://www.twilio.com/docs/chat/rest/user-resource)'s `identity` value of the Member resources to read. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more details. * * @param string[] $identity The `identity` value of the resources to read * @return $this Fluent Builder */ public function setIdentity(array $identity): self { $this->options['identity'] = $identity; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V2.ReadMemberOptions ' . $options . ']'; } } class DeleteMemberOptions extends Options { /** * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header */ public function __construct(string $xTwilioWebhookEnabled = Values::NONE) { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V2.DeleteMemberOptions ' . $options . ']'; } } class UpdateMemberOptions extends Options { /** * @param string $roleSid The SID of the Role to assign to the member * @param int $lastConsumedMessageIndex The index of the last consumed Message * for the Channel for the Member * @param \DateTime $lastConsumptionTimestamp The ISO 8601 based timestamp * string representing the datetime * of the last Message read event * for the Member within the Channel * @param \DateTime $dateCreated The ISO 8601 date and time in GMT when the * resource was created * @param \DateTime $dateUpdated The ISO 8601 date and time in GMT when the * resource was updated * @param string $attributes A valid JSON string that contains * application-specific data * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header */ public function __construct(string $roleSid = Values::NONE, int $lastConsumedMessageIndex = Values::NONE, \DateTime $lastConsumptionTimestamp = Values::NONE, \DateTime $dateCreated = Values::NONE, \DateTime $dateUpdated = Values::NONE, string $attributes = Values::NONE, string $xTwilioWebhookEnabled = Values::NONE) { $this->options['roleSid'] = $roleSid; $this->options['lastConsumedMessageIndex'] = $lastConsumedMessageIndex; $this->options['lastConsumptionTimestamp'] = $lastConsumptionTimestamp; $this->options['dateCreated'] = $dateCreated; $this->options['dateUpdated'] = $dateUpdated; $this->options['attributes'] = $attributes; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) to assign to the member. The default roles are those specified on the [Service](https://www.twilio.com/docs/chat/rest/service-resource). * * @param string $roleSid The SID of the Role to assign to the member * @return $this Fluent Builder */ public function setRoleSid(string $roleSid): self { $this->options['roleSid'] = $roleSid; return $this; } /** * The index of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) that the Member has read within the [Channel](https://www.twilio.com/docs/chat/channels). * * @param int $lastConsumedMessageIndex The index of the last consumed Message * for the Channel for the Member * @return $this Fluent Builder */ public function setLastConsumedMessageIndex(int $lastConsumedMessageIndex): self { $this->options['lastConsumedMessageIndex'] = $lastConsumedMessageIndex; return $this; } /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) read event for the Member within the [Channel](https://www.twilio.com/docs/chat/channels). * * @param \DateTime $lastConsumptionTimestamp The ISO 8601 based timestamp * string representing the datetime * of the last Message read event * for the Member within the Channel * @return $this Fluent Builder */ public function setLastConsumptionTimestamp(\DateTime $lastConsumptionTimestamp): self { $this->options['lastConsumptionTimestamp'] = $lastConsumptionTimestamp; return $this; } /** * The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. Note that this parameter should only be used when a Member is being recreated from a backup/separate source. * * @param \DateTime $dateCreated The ISO 8601 date and time in GMT when the * resource was created * @return $this Fluent Builder */ public function setDateCreated(\DateTime $dateCreated): self { $this->options['dateCreated'] = $dateCreated; return $this; } /** * The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was last updated. * * @param \DateTime $dateUpdated The ISO 8601 date and time in GMT when the * resource was updated * @return $this Fluent Builder */ public function setDateUpdated(\DateTime $dateUpdated): self { $this->options['dateUpdated'] = $dateUpdated; return $this; } /** * A valid JSON string that contains application-specific data. * * @param string $attributes A valid JSON string that contains * application-specific data * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V2.UpdateMemberOptions ' . $options . ']'; } }src/Twilio/Rest/Chat/V2/Service/Channel/InviteInstance.php000064400000010377150515725700017310 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'channelSid' => Values::array_get($payload, 'channel_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'identity' => Values::array_get($payload, 'identity'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'roleSid' => Values::array_get($payload, 'role_sid'), 'createdBy' => Values::array_get($payload, 'created_by'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'channelSid' => $channelSid, '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 InviteContext Context for this InviteInstance */ protected function proxy(): InviteContext { if (!$this->context) { $this->context = new InviteContext( $this->version, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the InviteInstance * * @return InviteInstance Fetched InviteInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): InviteInstance { return $this->proxy()->fetch(); } /** * Delete the InviteInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V2.InviteInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V2/Service/Channel/WebhookInstance.php000064400000011141150515725700017436 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'channelSid' => Values::array_get($payload, 'channel_sid'), 'type' => Values::array_get($payload, 'type'), 'url' => Values::array_get($payload, 'url'), 'configuration' => Values::array_get($payload, 'configuration'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'channelSid' => $channelSid, '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 WebhookContext Context for this WebhookInstance */ protected function proxy(): WebhookContext { if (!$this->context) { $this->context = new WebhookContext( $this->version, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the WebhookInstance * * @return WebhookInstance Fetched WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): WebhookInstance { return $this->proxy()->fetch(); } /** * Update the WebhookInstance * * @param array|Options $options Optional Arguments * @return WebhookInstance Updated WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): WebhookInstance { return $this->proxy()->update($options); } /** * Delete the WebhookInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V2.WebhookInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V2/Service/Channel/MessageInstance.php000064400000012406150515725700017431 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'attributes' => Values::array_get($payload, 'attributes'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'to' => Values::array_get($payload, 'to'), 'channelSid' => Values::array_get($payload, 'channel_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'lastUpdatedBy' => Values::array_get($payload, 'last_updated_by'), 'wasEdited' => Values::array_get($payload, 'was_edited'), 'from' => Values::array_get($payload, 'from'), 'body' => Values::array_get($payload, 'body'), 'index' => Values::array_get($payload, 'index'), 'type' => Values::array_get($payload, 'type'), 'media' => Values::array_get($payload, 'media'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'channelSid' => $channelSid, '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 MessageContext Context for this MessageInstance */ protected function proxy(): MessageContext { if (!$this->context) { $this->context = new MessageContext( $this->version, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the MessageInstance * * @return MessageInstance Fetched MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MessageInstance { return $this->proxy()->fetch(); } /** * Delete the MessageInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { return $this->proxy()->delete($options); } /** * Update the MessageInstance * * @param array|Options $options Optional Arguments * @return MessageInstance Updated MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): MessageInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V2.MessageInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V2/Service/Channel/WebhookOptions.php000064400000033210150515725700017326 0ustar00options['configurationUrl'] = $configurationUrl; $this->options['configurationMethod'] = $configurationMethod; $this->options['configurationFilters'] = $configurationFilters; $this->options['configurationTriggers'] = $configurationTriggers; $this->options['configurationFlowSid'] = $configurationFlowSid; $this->options['configurationRetryCount'] = $configurationRetryCount; } /** * The URL of the webhook to call using the `configuration.method`. * * @param string $configurationUrl The URL of the webhook to call * @return $this Fluent Builder */ public function setConfigurationUrl(string $configurationUrl): self { $this->options['configurationUrl'] = $configurationUrl; return $this; } /** * The HTTP method used to call `configuration.url`. Can be: `GET` or `POST` and the default is `POST`. * * @param string $configurationMethod The HTTP method used to call * `configuration.url` * @return $this Fluent Builder */ public function setConfigurationMethod(string $configurationMethod): self { $this->options['configurationMethod'] = $configurationMethod; return $this; } /** * The events that cause us to call the Channel Webhook. Used when `type` is `webhook`. This parameter takes only one event. To specify more than one event, repeat this parameter for each event. For the list of possible events, see [Webhook Event Triggers](https://www.twilio.com/docs/chat/webhook-events#webhook-event-trigger). * * @param string[] $configurationFilters The events that cause us to call the * Channel Webhook * @return $this Fluent Builder */ public function setConfigurationFilters(array $configurationFilters): self { $this->options['configurationFilters'] = $configurationFilters; return $this; } /** * A string that will cause us to call the webhook when it is present in a message body. This parameter takes only one trigger string. To specify more than one, repeat this parameter for each trigger string up to a total of 5 trigger strings. Used only when `type` = `trigger`. * * @param string[] $configurationTriggers A string that will cause us to call * the webhook when it is found in a * message body * @return $this Fluent Builder */ public function setConfigurationTriggers(array $configurationTriggers): self { $this->options['configurationTriggers'] = $configurationTriggers; return $this; } /** * The SID of the Studio [Flow](https://www.twilio.com/docs/studio/rest-api/flow) to call when an event in `configuration.filters` occurs. Used only when `type` is `studio`. * * @param string $configurationFlowSid The SID of the Studio Flow to call when * an event occurs * @return $this Fluent Builder */ public function setConfigurationFlowSid(string $configurationFlowSid): self { $this->options['configurationFlowSid'] = $configurationFlowSid; return $this; } /** * The number of times to retry the webhook if the first attempt fails. Can be an integer between 0 and 3, inclusive, and the default is 0. * * @param int $configurationRetryCount The number of times to retry the webhook * if the first attempt fails * @return $this Fluent Builder */ public function setConfigurationRetryCount(int $configurationRetryCount): self { $this->options['configurationRetryCount'] = $configurationRetryCount; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V2.CreateWebhookOptions ' . $options . ']'; } } class UpdateWebhookOptions extends Options { /** * @param string $configurationUrl The URL of the webhook to call * @param string $configurationMethod The HTTP method used to call * `configuration.url` * @param string[] $configurationFilters The events that cause us to call the * Channel Webhook * @param string[] $configurationTriggers A string that will cause us to call * the webhook when it is found in a * message body * @param string $configurationFlowSid The SID of the Studio Flow to call when * an event occurs * @param int $configurationRetryCount The number of times to retry the webhook * if the first attempt fails */ public function __construct(string $configurationUrl = Values::NONE, string $configurationMethod = Values::NONE, array $configurationFilters = Values::ARRAY_NONE, array $configurationTriggers = Values::ARRAY_NONE, string $configurationFlowSid = Values::NONE, int $configurationRetryCount = Values::NONE) { $this->options['configurationUrl'] = $configurationUrl; $this->options['configurationMethod'] = $configurationMethod; $this->options['configurationFilters'] = $configurationFilters; $this->options['configurationTriggers'] = $configurationTriggers; $this->options['configurationFlowSid'] = $configurationFlowSid; $this->options['configurationRetryCount'] = $configurationRetryCount; } /** * The URL of the webhook to call using the `configuration.method`. * * @param string $configurationUrl The URL of the webhook to call * @return $this Fluent Builder */ public function setConfigurationUrl(string $configurationUrl): self { $this->options['configurationUrl'] = $configurationUrl; return $this; } /** * The HTTP method used to call `configuration.url`. Can be: `GET` or `POST` and the default is `POST`. * * @param string $configurationMethod The HTTP method used to call * `configuration.url` * @return $this Fluent Builder */ public function setConfigurationMethod(string $configurationMethod): self { $this->options['configurationMethod'] = $configurationMethod; return $this; } /** * The events that cause us to call the Channel Webhook. Used when `type` is `webhook`. This parameter takes only one event. To specify more than one event, repeat this parameter for each event. For the list of possible events, see [Webhook Event Triggers](https://www.twilio.com/docs/chat/webhook-events#webhook-event-trigger). * * @param string[] $configurationFilters The events that cause us to call the * Channel Webhook * @return $this Fluent Builder */ public function setConfigurationFilters(array $configurationFilters): self { $this->options['configurationFilters'] = $configurationFilters; return $this; } /** * A string that will cause us to call the webhook when it is present in a message body. This parameter takes only one trigger string. To specify more than one, repeat this parameter for each trigger string up to a total of 5 trigger strings. Used only when `type` = `trigger`. * * @param string[] $configurationTriggers A string that will cause us to call * the webhook when it is found in a * message body * @return $this Fluent Builder */ public function setConfigurationTriggers(array $configurationTriggers): self { $this->options['configurationTriggers'] = $configurationTriggers; return $this; } /** * The SID of the Studio [Flow](https://www.twilio.com/docs/studio/rest-api/flow) to call when an event in `configuration.filters` occurs. Used only when `type` = `studio`. * * @param string $configurationFlowSid The SID of the Studio Flow to call when * an event occurs * @return $this Fluent Builder */ public function setConfigurationFlowSid(string $configurationFlowSid): self { $this->options['configurationFlowSid'] = $configurationFlowSid; return $this; } /** * The number of times to retry the webhook if the first attempt fails. Can be an integer between 0 and 3, inclusive, and the default is 0. * * @param int $configurationRetryCount The number of times to retry the webhook * if the first attempt fails * @return $this Fluent Builder */ public function setConfigurationRetryCount(int $configurationRetryCount): self { $this->options['configurationRetryCount'] = $configurationRetryCount; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V2.UpdateWebhookOptions ' . $options . ']'; } }src/Twilio/Rest/Chat/V2/Service/Channel/MessageList.php000064400000015171150515725700016602 0ustar00solution = ['serviceSid' => $serviceSid, 'channelSid' => $channelSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($channelSid) . '/Messages'; } /** * Create the MessageInstance * * @param array|Options $options Optional Arguments * @return MessageInstance Created MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): MessageInstance { $options = new Values($options); $data = Values::of([ 'From' => $options['from'], 'Attributes' => $options['attributes'], 'DateCreated' => Serialize::iso8601DateTime($options['dateCreated']), 'DateUpdated' => Serialize::iso8601DateTime($options['dateUpdated']), 'LastUpdatedBy' => $options['lastUpdatedBy'], 'Body' => $options['body'], 'MediaSid' => $options['mediaSid'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->create('POST', $this->uri, [], $data, $headers); return new MessageInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'] ); } /** * Streams MessageInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads MessageInstance 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 MessageInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of MessageInstance 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 MessagePage Page of MessageInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): MessagePage { $options = new Values($options); $params = Values::of([ 'Order' => $options['order'], 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new MessagePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of MessageInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return MessagePage Page of MessageInstance */ public function getPage(string $targetUrl): MessagePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new MessagePage($this->version, $response, $this->solution); } /** * Constructs a MessageContext * * @param string $sid The SID of the Message resource to fetch */ public function getContext(string $sid): MessageContext { return new MessageContext( $this->version, $this->solution['serviceSid'], $this->solution['channelSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V2.MessageList]'; } }src/Twilio/Rest/Chat/V2/Service/Channel/MessageContext.php000064400000007172150515725700017315 0ustar00solution = ['serviceSid' => $serviceSid, 'channelSid' => $channelSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($channelSid) . '/Messages/' . \rawurlencode($sid) . ''; } /** * Fetch the MessageInstance * * @return MessageInstance Fetched MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MessageInstance { $payload = $this->version->fetch('GET', $this->uri); return new MessageInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } /** * Delete the MessageInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { $options = new Values($options); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); return $this->version->delete('DELETE', $this->uri, [], [], $headers); } /** * Update the MessageInstance * * @param array|Options $options Optional Arguments * @return MessageInstance Updated MessageInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): MessageInstance { $options = new Values($options); $data = Values::of([ 'Body' => $options['body'], 'Attributes' => $options['attributes'], 'DateCreated' => Serialize::iso8601DateTime($options['dateCreated']), 'DateUpdated' => Serialize::iso8601DateTime($options['dateUpdated']), 'LastUpdatedBy' => $options['lastUpdatedBy'], 'From' => $options['from'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->update('POST', $this->uri, [], $data, $headers); return new MessageInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V2.MessageContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V2/Service/Channel/MemberList.php000064400000015502150515725700016423 0ustar00solution = ['serviceSid' => $serviceSid, 'channelSid' => $channelSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($channelSid) . '/Members'; } /** * Create the MemberInstance * * @param string $identity The `identity` value that identifies the new * resource's User * @param array|Options $options Optional Arguments * @return MemberInstance Created MemberInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $identity, array $options = []): MemberInstance { $options = new Values($options); $data = Values::of([ 'Identity' => $identity, 'RoleSid' => $options['roleSid'], 'LastConsumedMessageIndex' => $options['lastConsumedMessageIndex'], 'LastConsumptionTimestamp' => Serialize::iso8601DateTime($options['lastConsumptionTimestamp']), 'DateCreated' => Serialize::iso8601DateTime($options['dateCreated']), 'DateUpdated' => Serialize::iso8601DateTime($options['dateUpdated']), 'Attributes' => $options['attributes'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->create('POST', $this->uri, [], $data, $headers); return new MemberInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'] ); } /** * Streams MemberInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads MemberInstance 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 MemberInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of MemberInstance 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 MemberPage Page of MemberInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): MemberPage { $options = new Values($options); $params = Values::of([ 'Identity' => Serialize::map($options['identity'], function($e) { return $e; }), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new MemberPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of MemberInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return MemberPage Page of MemberInstance */ public function getPage(string $targetUrl): MemberPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new MemberPage($this->version, $response, $this->solution); } /** * Constructs a MemberContext * * @param string $sid The SID of the Member resource to fetch */ public function getContext(string $sid): MemberContext { return new MemberContext( $this->version, $this->solution['serviceSid'], $this->solution['channelSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V2.MemberList]'; } }src/Twilio/Rest/Chat/V2/Service/Channel/MemberContext.php000064400000007237150515725700017142 0ustar00solution = ['serviceSid' => $serviceSid, 'channelSid' => $channelSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($channelSid) . '/Members/' . \rawurlencode($sid) . ''; } /** * Fetch the MemberInstance * * @return MemberInstance Fetched MemberInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MemberInstance { $payload = $this->version->fetch('GET', $this->uri); return new MemberInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } /** * Delete the MemberInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { $options = new Values($options); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); return $this->version->delete('DELETE', $this->uri, [], [], $headers); } /** * Update the MemberInstance * * @param array|Options $options Optional Arguments * @return MemberInstance Updated MemberInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): MemberInstance { $options = new Values($options); $data = Values::of([ 'RoleSid' => $options['roleSid'], 'LastConsumedMessageIndex' => $options['lastConsumedMessageIndex'], 'LastConsumptionTimestamp' => Serialize::iso8601DateTime($options['lastConsumptionTimestamp']), 'DateCreated' => Serialize::iso8601DateTime($options['dateCreated']), 'DateUpdated' => Serialize::iso8601DateTime($options['dateUpdated']), 'Attributes' => $options['attributes'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->update('POST', $this->uri, [], $data, $headers); return new MemberInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V2.MemberContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V2/Service/Channel/InviteOptions.php000064400000005343150515725700017174 0ustar00options['roleSid'] = $roleSid; } /** * The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) assigned to the new member. * * @param string $roleSid The Role assigned to the new member * @return $this Fluent Builder */ public function setRoleSid(string $roleSid): self { $this->options['roleSid'] = $roleSid; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V2.CreateInviteOptions ' . $options . ']'; } } class ReadInviteOptions extends Options { /** * @param string[] $identity The `identity` value of the resources to read */ public function __construct(array $identity = Values::ARRAY_NONE) { $this->options['identity'] = $identity; } /** * The [User](https://www.twilio.com/docs/chat/rest/user-resource)'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more details. * * @param string[] $identity The `identity` value of the resources to read * @return $this Fluent Builder */ public function setIdentity(array $identity): self { $this->options['identity'] = $identity; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V2.ReadInviteOptions ' . $options . ']'; } }src/Twilio/Rest/Chat/V2/Service/Channel/MessageOptions.php000064400000040047150515725700017322 0ustar00options['from'] = $from; $this->options['attributes'] = $attributes; $this->options['dateCreated'] = $dateCreated; $this->options['dateUpdated'] = $dateUpdated; $this->options['lastUpdatedBy'] = $lastUpdatedBy; $this->options['body'] = $body; $this->options['mediaSid'] = $mediaSid; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The [Identity](https://www.twilio.com/docs/chat/identity) of the new message's author. The default value is `system`. * * @param string $from The Identity of the new message's author * @return $this Fluent Builder */ public function setFrom(string $from): self { $this->options['from'] = $from; return $this; } /** * A valid JSON string that contains application-specific data. * * @param string $attributes A valid JSON string that contains * application-specific data * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. This parameter should only be used when a Chat's history is being recreated from a backup/separate source. * * @param \DateTime $dateCreated The ISO 8601 date and time in GMT when the * resource was created * @return $this Fluent Builder */ public function setDateCreated(\DateTime $dateCreated): self { $this->options['dateCreated'] = $dateCreated; return $this; } /** * The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was last updated. * * @param \DateTime $dateUpdated The ISO 8601 date and time in GMT when the * resource was updated * @return $this Fluent Builder */ public function setDateUpdated(\DateTime $dateUpdated): self { $this->options['dateUpdated'] = $dateUpdated; return $this; } /** * The [Identity](https://www.twilio.com/docs/chat/identity) of the User who last updated the Message, if applicable. * * @param string $lastUpdatedBy The Identity of the User who last updated the * Message * @return $this Fluent Builder */ public function setLastUpdatedBy(string $lastUpdatedBy): self { $this->options['lastUpdatedBy'] = $lastUpdatedBy; return $this; } /** * The message to send to the channel. Can be an empty string or `null`, which sets the value as an empty string. You can send structured data in the body by serializing it as a string. * * @param string $body The message to send to the channel * @return $this Fluent Builder */ public function setBody(string $body): self { $this->options['body'] = $body; return $this; } /** * The SID of the [Media](https://www.twilio.com/docs/chat/rest/media) to attach to the new Message. * * @param string $mediaSid The Media Sid to be attached to the new Message * @return $this Fluent Builder */ public function setMediaSid(string $mediaSid): self { $this->options['mediaSid'] = $mediaSid; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V2.CreateMessageOptions ' . $options . ']'; } } class ReadMessageOptions extends Options { /** * @param string $order The sort order of the returned messages */ public function __construct(string $order = Values::NONE) { $this->options['order'] = $order; } /** * The sort order of the returned messages. Can be: `asc` (ascending) or `desc` (descending) with `asc` as the default. * * @param string $order The sort order of the returned messages * @return $this Fluent Builder */ public function setOrder(string $order): self { $this->options['order'] = $order; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V2.ReadMessageOptions ' . $options . ']'; } } class DeleteMessageOptions extends Options { /** * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header */ public function __construct(string $xTwilioWebhookEnabled = Values::NONE) { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V2.DeleteMessageOptions ' . $options . ']'; } } class UpdateMessageOptions extends Options { /** * @param string $body The message to send to the channel * @param string $attributes A valid JSON string that contains * application-specific data * @param \DateTime $dateCreated The ISO 8601 date and time in GMT when the * resource was created * @param \DateTime $dateUpdated The ISO 8601 date and time in GMT when the * resource was updated * @param string $lastUpdatedBy The Identity of the User who last updated the * Message, if applicable * @param string $from The Identity of the message's author * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header */ public function __construct(string $body = Values::NONE, string $attributes = Values::NONE, \DateTime $dateCreated = Values::NONE, \DateTime $dateUpdated = Values::NONE, string $lastUpdatedBy = Values::NONE, string $from = Values::NONE, string $xTwilioWebhookEnabled = Values::NONE) { $this->options['body'] = $body; $this->options['attributes'] = $attributes; $this->options['dateCreated'] = $dateCreated; $this->options['dateUpdated'] = $dateUpdated; $this->options['lastUpdatedBy'] = $lastUpdatedBy; $this->options['from'] = $from; $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; } /** * The message to send to the channel. Can be an empty string or `null`, which sets the value as an empty string. You can send structured data in the body by serializing it as a string. * * @param string $body The message to send to the channel * @return $this Fluent Builder */ public function setBody(string $body): self { $this->options['body'] = $body; return $this; } /** * A valid JSON string that contains application-specific data. * * @param string $attributes A valid JSON string that contains * application-specific data * @return $this Fluent Builder */ public function setAttributes(string $attributes): self { $this->options['attributes'] = $attributes; return $this; } /** * The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. This parameter should only be used when a Chat's history is being recreated from a backup/separate source. * * @param \DateTime $dateCreated The ISO 8601 date and time in GMT when the * resource was created * @return $this Fluent Builder */ public function setDateCreated(\DateTime $dateCreated): self { $this->options['dateCreated'] = $dateCreated; return $this; } /** * The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was last updated. * * @param \DateTime $dateUpdated The ISO 8601 date and time in GMT when the * resource was updated * @return $this Fluent Builder */ public function setDateUpdated(\DateTime $dateUpdated): self { $this->options['dateUpdated'] = $dateUpdated; return $this; } /** * The [Identity](https://www.twilio.com/docs/chat/identity) of the User who last updated the Message, if applicable. * * @param string $lastUpdatedBy The Identity of the User who last updated the * Message, if applicable * @return $this Fluent Builder */ public function setLastUpdatedBy(string $lastUpdatedBy): self { $this->options['lastUpdatedBy'] = $lastUpdatedBy; return $this; } /** * The [Identity](https://www.twilio.com/docs/chat/identity) of the message's author. * * @param string $from The Identity of the message's author * @return $this Fluent Builder */ public function setFrom(string $from): self { $this->options['from'] = $from; return $this; } /** * The X-Twilio-Webhook-Enabled HTTP request header * * @param string $xTwilioWebhookEnabled The X-Twilio-Webhook-Enabled HTTP * request header * @return $this Fluent Builder */ public function setXTwilioWebhookEnabled(string $xTwilioWebhookEnabled): self { $this->options['xTwilioWebhookEnabled'] = $xTwilioWebhookEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V2.UpdateMessageOptions ' . $options . ']'; } }src/Twilio/Rest/Chat/V2/Service/Channel/InviteList.php000064400000014454150515725700016457 0ustar00solution = ['serviceSid' => $serviceSid, 'channelSid' => $channelSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($channelSid) . '/Invites'; } /** * Create the InviteInstance * * @param string $identity The `identity` value that identifies the new * resource's User * @param array|Options $options Optional Arguments * @return InviteInstance Created InviteInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $identity, array $options = []): InviteInstance { $options = new Values($options); $data = Values::of(['Identity' => $identity, 'RoleSid' => $options['roleSid'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new InviteInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'] ); } /** * Streams InviteInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads InviteInstance 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 InviteInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of InviteInstance 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 InvitePage Page of InviteInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): InvitePage { $options = new Values($options); $params = Values::of([ 'Identity' => Serialize::map($options['identity'], function($e) { return $e; }), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new InvitePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of InviteInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return InvitePage Page of InviteInstance */ public function getPage(string $targetUrl): InvitePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new InvitePage($this->version, $response, $this->solution); } /** * Constructs a InviteContext * * @param string $sid The SID of the Invite resource to fetch */ public function getContext(string $sid): InviteContext { return new InviteContext( $this->version, $this->solution['serviceSid'], $this->solution['channelSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V2.InviteList]'; } }src/Twilio/Rest/Chat/V2/Service/Channel/InviteContext.php000064400000004345150515725700017166 0ustar00solution = ['serviceSid' => $serviceSid, 'channelSid' => $channelSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($channelSid) . '/Invites/' . \rawurlencode($sid) . ''; } /** * Fetch the InviteInstance * * @return InviteInstance Fetched InviteInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): InviteInstance { $payload = $this->version->fetch('GET', $this->uri); return new InviteInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } /** * Delete the InviteInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V2.InviteContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V2/Service/Channel/MemberPage.php000064400000002405150515725700016362 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return MemberInstance \Twilio\Rest\Chat\V2\Service\Channel\MemberInstance */ public function buildInstance(array $payload): MemberInstance { return new MemberInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V2.MemberPage]'; } }src/Twilio/Rest/Chat/V2/Service/Channel/WebhookPage.php000064400000002413150515725700016550 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return WebhookInstance \Twilio\Rest\Chat\V2\Service\Channel\WebhookInstance */ public function buildInstance(array $payload): WebhookInstance { return new WebhookInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V2.WebhookPage]'; } }src/Twilio/Rest/Chat/V2/Service/Channel/WebhookList.php000064400000014605150515725700016615 0ustar00solution = ['serviceSid' => $serviceSid, 'channelSid' => $channelSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($channelSid) . '/Webhooks'; } /** * Streams WebhookInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads WebhookInstance 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 WebhookInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of WebhookInstance 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 WebhookPage Page of WebhookInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): WebhookPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new WebhookPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of WebhookInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return WebhookPage Page of WebhookInstance */ public function getPage(string $targetUrl): WebhookPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new WebhookPage($this->version, $response, $this->solution); } /** * Create the WebhookInstance * * @param string $type The type of webhook * @param array|Options $options Optional Arguments * @return WebhookInstance Created WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $type, array $options = []): WebhookInstance { $options = new Values($options); $data = Values::of([ 'Type' => $type, 'Configuration.Url' => $options['configurationUrl'], 'Configuration.Method' => $options['configurationMethod'], 'Configuration.Filters' => Serialize::map($options['configurationFilters'], function($e) { return $e; }), 'Configuration.Triggers' => Serialize::map($options['configurationTriggers'], function($e) { return $e; }), 'Configuration.FlowSid' => $options['configurationFlowSid'], 'Configuration.RetryCount' => $options['configurationRetryCount'], ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new WebhookInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'] ); } /** * Constructs a WebhookContext * * @param string $sid The SID of the Channel Webhook resource to fetch */ public function getContext(string $sid): WebhookContext { return new WebhookContext( $this->version, $this->solution['serviceSid'], $this->solution['channelSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V2.WebhookList]'; } }src/Twilio/Rest/Chat/V2/Service/Channel/WebhookContext.php000064400000007017150515725700017325 0ustar00solution = ['serviceSid' => $serviceSid, 'channelSid' => $channelSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels/' . \rawurlencode($channelSid) . '/Webhooks/' . \rawurlencode($sid) . ''; } /** * Fetch the WebhookInstance * * @return WebhookInstance Fetched WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): WebhookInstance { $payload = $this->version->fetch('GET', $this->uri); return new WebhookInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } /** * Update the WebhookInstance * * @param array|Options $options Optional Arguments * @return WebhookInstance Updated WebhookInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): WebhookInstance { $options = new Values($options); $data = Values::of([ 'Configuration.Url' => $options['configurationUrl'], 'Configuration.Method' => $options['configurationMethod'], 'Configuration.Filters' => Serialize::map($options['configurationFilters'], function($e) { return $e; }), 'Configuration.Triggers' => Serialize::map($options['configurationTriggers'], function($e) { return $e; }), 'Configuration.FlowSid' => $options['configurationFlowSid'], 'Configuration.RetryCount' => $options['configurationRetryCount'], ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new WebhookInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } /** * Delete the WebhookInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V2.WebhookContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V2/Service/Channel/MemberInstance.php000064400000011762150515725700017260 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'channelSid' => Values::array_get($payload, 'channel_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'identity' => Values::array_get($payload, 'identity'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'roleSid' => Values::array_get($payload, 'role_sid'), 'lastConsumedMessageIndex' => Values::array_get($payload, 'last_consumed_message_index'), 'lastConsumptionTimestamp' => Deserialize::dateTime(Values::array_get($payload, 'last_consumption_timestamp')), 'url' => Values::array_get($payload, 'url'), 'attributes' => Values::array_get($payload, 'attributes'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'channelSid' => $channelSid, '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 MemberContext Context for this MemberInstance */ protected function proxy(): MemberContext { if (!$this->context) { $this->context = new MemberContext( $this->version, $this->solution['serviceSid'], $this->solution['channelSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the MemberInstance * * @return MemberInstance Fetched MemberInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): MemberInstance { return $this->proxy()->fetch(); } /** * Delete the MemberInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { return $this->proxy()->delete($options); } /** * Update the MemberInstance * * @param array|Options $options Optional Arguments * @return MemberInstance Updated MemberInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): MemberInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V2.MemberInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V2/Service/Channel/MessagePage.php000064400000002413150515725700016536 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return MessageInstance \Twilio\Rest\Chat\V2\Service\Channel\MessageInstance */ public function buildInstance(array $payload): MessageInstance { return new MessageInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['channelSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V2.MessagePage]'; } }src/Twilio/Rest/Chat/V2/Service/BindingPage.php000064400000002242150515725700015154 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return BindingInstance \Twilio\Rest\Chat\V2\Service\BindingInstance */ public function buildInstance(array $payload): BindingInstance { return new BindingInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V2.BindingPage]'; } }src/Twilio/Rest/Chat/V2/Service/BindingInstance.php000064400000010373150515725700016050 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'endpoint' => Values::array_get($payload, 'endpoint'), 'identity' => Values::array_get($payload, 'identity'), 'credentialSid' => Values::array_get($payload, 'credential_sid'), 'bindingType' => Values::array_get($payload, 'binding_type'), 'messageTypes' => Values::array_get($payload, 'message_types'), 'url' => Values::array_get($payload, 'url'), 'links' => Values::array_get($payload, 'links'), ]; $this->solution = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return BindingContext Context for this BindingInstance */ protected function proxy(): BindingContext { if (!$this->context) { $this->context = new BindingContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the BindingInstance * * @return BindingInstance Fetched BindingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): BindingInstance { return $this->proxy()->fetch(); } /** * Delete the BindingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V2.BindingInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V2/Service/User/UserChannelPage.php000064400000002432150515725700016730 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return UserChannelInstance \Twilio\Rest\Chat\V2\Service\User\UserChannelInstance */ public function buildInstance(array $payload): UserChannelInstance { return new UserChannelInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['userSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V2.UserChannelPage]'; } }src/Twilio/Rest/Chat/V2/Service/User/UserBindingOptions.php000064400000003437150515725700017517 0ustar00options['bindingType'] = $bindingType; } /** * The push technology used by the User Binding resources to read. Can be: `apn`, `gcm`, or `fcm`. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. * * @param string[] $bindingType The push technology used by the User Binding * resources to read * @return $this Fluent Builder */ public function setBindingType(array $bindingType): self { $this->options['bindingType'] = $bindingType; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V2.ReadUserBindingOptions ' . $options . ']'; } }src/Twilio/Rest/Chat/V2/Service/User/UserChannelContext.php000064400000006554150515725700017511 0ustar00solution = ['serviceSid' => $serviceSid, 'userSid' => $userSid, 'channelSid' => $channelSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Users/' . \rawurlencode($userSid) . '/Channels/' . \rawurlencode($channelSid) . ''; } /** * Fetch the UserChannelInstance * * @return UserChannelInstance Fetched UserChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): UserChannelInstance { $payload = $this->version->fetch('GET', $this->uri); return new UserChannelInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['userSid'], $this->solution['channelSid'] ); } /** * Delete the UserChannelInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the UserChannelInstance * * @param array|Options $options Optional Arguments * @return UserChannelInstance Updated UserChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): UserChannelInstance { $options = new Values($options); $data = Values::of([ 'NotificationLevel' => $options['notificationLevel'], 'LastConsumedMessageIndex' => $options['lastConsumedMessageIndex'], 'LastConsumptionTimestamp' => Serialize::iso8601DateTime($options['lastConsumptionTimestamp']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new UserChannelInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['userSid'], $this->solution['channelSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V2.UserChannelContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V2/Service/User/UserBindingInstance.php000064400000011001150515725700017612 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'endpoint' => Values::array_get($payload, 'endpoint'), 'identity' => Values::array_get($payload, 'identity'), 'userSid' => Values::array_get($payload, 'user_sid'), 'credentialSid' => Values::array_get($payload, 'credential_sid'), 'bindingType' => Values::array_get($payload, 'binding_type'), 'messageTypes' => Values::array_get($payload, 'message_types'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'userSid' => $userSid, '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 UserBindingContext Context for this UserBindingInstance */ protected function proxy(): UserBindingContext { if (!$this->context) { $this->context = new UserBindingContext( $this->version, $this->solution['serviceSid'], $this->solution['userSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the UserBindingInstance * * @return UserBindingInstance Fetched UserBindingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): UserBindingInstance { return $this->proxy()->fetch(); } /** * Delete the UserBindingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V2.UserBindingInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V2/Service/User/UserChannelInstance.php000064400000011560150515725700017622 0ustar00properties = [ 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'channelSid' => Values::array_get($payload, 'channel_sid'), 'userSid' => Values::array_get($payload, 'user_sid'), 'memberSid' => Values::array_get($payload, 'member_sid'), 'status' => Values::array_get($payload, 'status'), 'lastConsumedMessageIndex' => Values::array_get($payload, 'last_consumed_message_index'), 'unreadMessagesCount' => Values::array_get($payload, 'unread_messages_count'), 'links' => Values::array_get($payload, 'links'), 'url' => Values::array_get($payload, 'url'), 'notificationLevel' => Values::array_get($payload, 'notification_level'), ]; $this->solution = [ 'serviceSid' => $serviceSid, 'userSid' => $userSid, 'channelSid' => $channelSid ?: $this->properties['channelSid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return UserChannelContext Context for this UserChannelInstance */ protected function proxy(): UserChannelContext { if (!$this->context) { $this->context = new UserChannelContext( $this->version, $this->solution['serviceSid'], $this->solution['userSid'], $this->solution['channelSid'] ); } return $this->context; } /** * Fetch the UserChannelInstance * * @return UserChannelInstance Fetched UserChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): UserChannelInstance { return $this->proxy()->fetch(); } /** * Delete the UserChannelInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the UserChannelInstance * * @param array|Options $options Optional Arguments * @return UserChannelInstance Updated UserChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): UserChannelInstance { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V2.UserChannelInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V2/Service/User/UserBindingPage.php000064400000002432150515725700016732 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return UserBindingInstance \Twilio\Rest\Chat\V2\Service\User\UserBindingInstance */ public function buildInstance(array $payload): UserBindingInstance { return new UserBindingInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['userSid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V2.UserBindingPage]'; } }src/Twilio/Rest/Chat/V2/Service/User/UserChannelOptions.php000064400000011200150515725700017500 0ustar00options['notificationLevel'] = $notificationLevel; $this->options['lastConsumedMessageIndex'] = $lastConsumedMessageIndex; $this->options['lastConsumptionTimestamp'] = $lastConsumptionTimestamp; } /** * The push notification level to assign to the User Channel. Can be: `default` or `muted`. * * @param string $notificationLevel The push notification level to assign to * the User Channel * @return $this Fluent Builder */ public function setNotificationLevel(string $notificationLevel): self { $this->options['notificationLevel'] = $notificationLevel; return $this; } /** * The index of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) in the [Channel](https://www.twilio.com/docs/chat/channels) that the Member has read. * * @param int $lastConsumedMessageIndex The index of the last Message that the * Member has read within the Channel * @return $this Fluent Builder */ public function setLastConsumedMessageIndex(int $lastConsumedMessageIndex): self { $this->options['lastConsumedMessageIndex'] = $lastConsumedMessageIndex; return $this; } /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) read event for the Member within the [Channel](https://www.twilio.com/docs/chat/channels). * * @param \DateTime $lastConsumptionTimestamp The ISO 8601 based timestamp * string that represents the * datetime of the last Message read * event for the Member within the * Channel * @return $this Fluent Builder */ public function setLastConsumptionTimestamp(\DateTime $lastConsumptionTimestamp): self { $this->options['lastConsumptionTimestamp'] = $lastConsumptionTimestamp; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V2.UpdateUserChannelOptions ' . $options . ']'; } }src/Twilio/Rest/Chat/V2/Service/User/UserChannelList.php000064400000012176150515725700016775 0ustar00solution = ['serviceSid' => $serviceSid, 'userSid' => $userSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Users/' . \rawurlencode($userSid) . '/Channels'; } /** * Streams UserChannelInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads UserChannelInstance 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 UserChannelInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of UserChannelInstance 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 UserChannelPage Page of UserChannelInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): UserChannelPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new UserChannelPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of UserChannelInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return UserChannelPage Page of UserChannelInstance */ public function getPage(string $targetUrl): UserChannelPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new UserChannelPage($this->version, $response, $this->solution); } /** * Constructs a UserChannelContext * * @param string $channelSid The SID of the Channel that has the User Channel * to fetch */ public function getContext(string $channelSid): UserChannelContext { return new UserChannelContext( $this->version, $this->solution['serviceSid'], $this->solution['userSid'], $channelSid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V2.UserChannelList]'; } }src/Twilio/Rest/Chat/V2/Service/User/UserBindingList.php000064400000013020150515725700016764 0ustar00solution = ['serviceSid' => $serviceSid, 'userSid' => $userSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Users/' . \rawurlencode($userSid) . '/Bindings'; } /** * Streams UserBindingInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads UserBindingInstance 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 UserBindingInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of UserBindingInstance 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 UserBindingPage Page of UserBindingInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): UserBindingPage { $options = new Values($options); $params = Values::of([ 'BindingType' => Serialize::map($options['bindingType'], function($e) { return $e; }), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new UserBindingPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of UserBindingInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return UserBindingPage Page of UserBindingInstance */ public function getPage(string $targetUrl): UserBindingPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new UserBindingPage($this->version, $response, $this->solution); } /** * Constructs a UserBindingContext * * @param string $sid The SID of the User Binding resource to fetch */ public function getContext(string $sid): UserBindingContext { return new UserBindingContext( $this->version, $this->solution['serviceSid'], $this->solution['userSid'], $sid ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V2.UserBindingList]'; } }src/Twilio/Rest/Chat/V2/Service/User/UserBindingContext.php000064400000004315150515725700017504 0ustar00solution = ['serviceSid' => $serviceSid, 'userSid' => $userSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Users/' . \rawurlencode($userSid) . '/Bindings/' . \rawurlencode($sid) . ''; } /** * Fetch the UserBindingInstance * * @return UserBindingInstance Fetched UserBindingInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): UserBindingInstance { $payload = $this->version->fetch('GET', $this->uri); return new UserBindingInstance( $this->version, $payload, $this->solution['serviceSid'], $this->solution['userSid'], $this->solution['sid'] ); } /** * Delete the UserBindingInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V2.UserBindingContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V2/Service/ChannelPage.php000064400000002242150515725700015152 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ChannelInstance \Twilio\Rest\Chat\V2\Service\ChannelInstance */ public function buildInstance(array $payload): ChannelInstance { return new ChannelInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V2.ChannelPage]'; } }src/Twilio/Rest/Chat/V2/Service/RolePage.php000064400000002220150515725700014477 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return RoleInstance \Twilio\Rest\Chat\V2\Service\RoleInstance */ public function buildInstance(array $payload): RoleInstance { return new RoleInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V2.RolePage]'; } }src/Twilio/Rest/Chat/V2/Service/ChannelList.php000064400000014417150515725700015220 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Channels'; } /** * Create the ChannelInstance * * @param array|Options $options Optional Arguments * @return ChannelInstance Created ChannelInstance * @throws TwilioException When an HTTP error occurs. */ public function create(array $options = []): ChannelInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'UniqueName' => $options['uniqueName'], 'Attributes' => $options['attributes'], 'Type' => $options['type'], 'DateCreated' => Serialize::iso8601DateTime($options['dateCreated']), 'DateUpdated' => Serialize::iso8601DateTime($options['dateUpdated']), 'CreatedBy' => $options['createdBy'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->create('POST', $this->uri, [], $data, $headers); return new ChannelInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Streams ChannelInstance 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 Stream stream of results */ public function stream(array $options = [], int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($options, $limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ChannelInstance 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 ChannelInstance[] Array of results */ public function read(array $options = [], int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($options, $limit, $pageSize), false); } /** * Retrieve a single page of ChannelInstance 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 ChannelPage Page of ChannelInstance */ public function page(array $options = [], $pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ChannelPage { $options = new Values($options); $params = Values::of([ 'Type' => Serialize::map($options['type'], function($e) { return $e; }), 'PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ChannelPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ChannelInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ChannelPage Page of ChannelInstance */ public function getPage(string $targetUrl): ChannelPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ChannelPage($this->version, $response, $this->solution); } /** * Constructs a ChannelContext * * @param string $sid The SID of the resource */ public function getContext(string $sid): ChannelContext { return new ChannelContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V2.ChannelList]'; } }src/Twilio/Rest/Chat/V2/Service/UserList.php000064400000013303150515725700014557 0ustar00solution = ['serviceSid' => $serviceSid, ]; $this->uri = '/Services/' . \rawurlencode($serviceSid) . '/Users'; } /** * Create the UserInstance * * @param string $identity The `identity` value that identifies the new * resource's User * @param array|Options $options Optional Arguments * @return UserInstance Created UserInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $identity, array $options = []): UserInstance { $options = new Values($options); $data = Values::of([ 'Identity' => $identity, 'RoleSid' => $options['roleSid'], 'Attributes' => $options['attributes'], 'FriendlyName' => $options['friendlyName'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled'], ]); $payload = $this->version->create('POST', $this->uri, [], $data, $headers); return new UserInstance($this->version, $payload, $this->solution['serviceSid']); } /** * Streams UserInstance 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 Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads UserInstance 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 UserInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of UserInstance 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 UserPage Page of UserInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): UserPage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new UserPage($this->version, $response, $this->solution); } /** * Retrieve a specific page of UserInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return UserPage Page of UserInstance */ public function getPage(string $targetUrl): UserPage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new UserPage($this->version, $response, $this->solution); } /** * Constructs a UserContext * * @param string $sid The SID of the User resource to fetch */ public function getContext(string $sid): UserContext { return new UserContext($this->version, $this->solution['serviceSid'], $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V2.UserList]'; } }src/Twilio/Rest/Chat/V2/Service/UserInstance.php000064400000012364150515725700015416 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'serviceSid' => Values::array_get($payload, 'service_sid'), 'attributes' => Values::array_get($payload, 'attributes'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'roleSid' => Values::array_get($payload, 'role_sid'), 'identity' => Values::array_get($payload, 'identity'), 'isOnline' => Values::array_get($payload, 'is_online'), 'isNotifiable' => Values::array_get($payload, 'is_notifiable'), 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')), 'dateUpdated' => Deserialize::dateTime(Values::array_get($payload, 'date_updated')), 'joinedChannelsCount' => Values::array_get($payload, 'joined_channels_count'), 'links' => Values::array_get($payload, 'links'), 'url' => Values::array_get($payload, 'url'), ]; $this->solution = ['serviceSid' => $serviceSid, 'sid' => $sid ?: $this->properties['sid'], ]; } /** * Generate an instance context for the instance, the context is capable of * performing various actions. All instance actions are proxied to the context * * @return UserContext Context for this UserInstance */ protected function proxy(): UserContext { if (!$this->context) { $this->context = new UserContext( $this->version, $this->solution['serviceSid'], $this->solution['sid'] ); } return $this->context; } /** * Fetch the UserInstance * * @return UserInstance Fetched UserInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): UserInstance { return $this->proxy()->fetch(); } /** * Delete the UserInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->proxy()->delete(); } /** * Update the UserInstance * * @param array|Options $options Optional Arguments * @return UserInstance Updated UserInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): UserInstance { return $this->proxy()->update($options); } /** * Access the userChannels */ protected function getUserChannels(): UserChannelList { return $this->proxy()->userChannels; } /** * Access the userBindings */ protected function getUserBindings(): UserBindingList { return $this->proxy()->userBindings; } /** * Magic getter to access properties * * @param string $name Property to access * @return mixed The requested property * @throws TwilioException For unknown properties */ public function __get(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V2.UserInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V2/Service/BindingOptions.php000064400000004756150515725700015747 0ustar00options['bindingType'] = $bindingType; $this->options['identity'] = $identity; } /** * The push technology used by the Binding resources to read. Can be: `apn`, `gcm`, or `fcm`. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. * * @param string[] $bindingType The push technology used by the Binding * resources to read * @return $this Fluent Builder */ public function setBindingType(array $bindingType): self { $this->options['bindingType'] = $bindingType; return $this; } /** * The [User](https://www.twilio.com/docs/chat/rest/user-resource)'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more details. * * @param string[] $identity The `identity` value of the resources to read * @return $this Fluent Builder */ public function setIdentity(array $identity): self { $this->options['identity'] = $identity; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V2.ReadBindingOptions ' . $options . ']'; } }src/Twilio/Rest/Chat/V2/ServiceContext.php000064400000017662150515725700014366 0ustar00solution = ['sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($sid) . ''; } /** * Fetch the ServiceInstance * * @return ServiceInstance Fetched ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ServiceInstance { $payload = $this->version->fetch('GET', $this->uri); return new ServiceInstance($this->version, $payload, $this->solution['sid']); } /** * Delete the ServiceInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { return $this->version->delete('DELETE', $this->uri); } /** * Update the ServiceInstance * * @param array|Options $options Optional Arguments * @return ServiceInstance Updated ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ServiceInstance { $options = new Values($options); $data = Values::of([ 'FriendlyName' => $options['friendlyName'], 'DefaultServiceRoleSid' => $options['defaultServiceRoleSid'], 'DefaultChannelRoleSid' => $options['defaultChannelRoleSid'], 'DefaultChannelCreatorRoleSid' => $options['defaultChannelCreatorRoleSid'], 'ReadStatusEnabled' => Serialize::booleanToString($options['readStatusEnabled']), 'ReachabilityEnabled' => Serialize::booleanToString($options['reachabilityEnabled']), 'TypingIndicatorTimeout' => $options['typingIndicatorTimeout'], 'ConsumptionReportInterval' => $options['consumptionReportInterval'], 'Notifications.NewMessage.Enabled' => Serialize::booleanToString($options['notificationsNewMessageEnabled']), 'Notifications.NewMessage.Template' => $options['notificationsNewMessageTemplate'], 'Notifications.NewMessage.Sound' => $options['notificationsNewMessageSound'], 'Notifications.NewMessage.BadgeCountEnabled' => Serialize::booleanToString($options['notificationsNewMessageBadgeCountEnabled']), 'Notifications.AddedToChannel.Enabled' => Serialize::booleanToString($options['notificationsAddedToChannelEnabled']), 'Notifications.AddedToChannel.Template' => $options['notificationsAddedToChannelTemplate'], 'Notifications.AddedToChannel.Sound' => $options['notificationsAddedToChannelSound'], 'Notifications.RemovedFromChannel.Enabled' => Serialize::booleanToString($options['notificationsRemovedFromChannelEnabled']), 'Notifications.RemovedFromChannel.Template' => $options['notificationsRemovedFromChannelTemplate'], 'Notifications.RemovedFromChannel.Sound' => $options['notificationsRemovedFromChannelSound'], 'Notifications.InvitedToChannel.Enabled' => Serialize::booleanToString($options['notificationsInvitedToChannelEnabled']), 'Notifications.InvitedToChannel.Template' => $options['notificationsInvitedToChannelTemplate'], 'Notifications.InvitedToChannel.Sound' => $options['notificationsInvitedToChannelSound'], 'PreWebhookUrl' => $options['preWebhookUrl'], 'PostWebhookUrl' => $options['postWebhookUrl'], 'WebhookMethod' => $options['webhookMethod'], 'WebhookFilters' => Serialize::map($options['webhookFilters'], function($e) { return $e; }), 'Limits.ChannelMembers' => $options['limitsChannelMembers'], 'Limits.UserChannels' => $options['limitsUserChannels'], 'Media.CompatibilityMessage' => $options['mediaCompatibilityMessage'], 'PreWebhookRetryCount' => $options['preWebhookRetryCount'], 'PostWebhookRetryCount' => $options['postWebhookRetryCount'], 'Notifications.LogEnabled' => Serialize::booleanToString($options['notificationsLogEnabled']), ]); $payload = $this->version->update('POST', $this->uri, [], $data); return new ServiceInstance($this->version, $payload, $this->solution['sid']); } /** * Access the channels */ protected function getChannels(): ChannelList { if (!$this->_channels) { $this->_channels = new ChannelList($this->version, $this->solution['sid']); } return $this->_channels; } /** * Access the roles */ protected function getRoles(): RoleList { if (!$this->_roles) { $this->_roles = new RoleList($this->version, $this->solution['sid']); } return $this->_roles; } /** * Access the users */ protected function getUsers(): UserList { if (!$this->_users) { $this->_users = new UserList($this->version, $this->solution['sid']); } return $this->_users; } /** * Access the bindings */ protected function getBindings(): BindingList { if (!$this->_bindings) { $this->_bindings = new BindingList($this->version, $this->solution['sid']); } return $this->_bindings; } /** * Magic getter to lazy load subresources * * @param string $name Subresource to return * @return ListResource The requested subresource * @throws TwilioException For unknown subresources */ public function __get(string $name): ListResource { 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 InstanceContext The requested resource context * @throws TwilioException For unknown resource */ public function __call(string $name, array $arguments): InstanceContext { $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V2.ServiceContext ' . \implode(' ', $context) . ']'; } }src/Twilio/Rest/Chat/V2/ServiceOptions.php000064400000113234150515725700014365 0ustar00options['friendlyName'] = $friendlyName; $this->options['defaultServiceRoleSid'] = $defaultServiceRoleSid; $this->options['defaultChannelRoleSid'] = $defaultChannelRoleSid; $this->options['defaultChannelCreatorRoleSid'] = $defaultChannelCreatorRoleSid; $this->options['readStatusEnabled'] = $readStatusEnabled; $this->options['reachabilityEnabled'] = $reachabilityEnabled; $this->options['typingIndicatorTimeout'] = $typingIndicatorTimeout; $this->options['consumptionReportInterval'] = $consumptionReportInterval; $this->options['notificationsNewMessageEnabled'] = $notificationsNewMessageEnabled; $this->options['notificationsNewMessageTemplate'] = $notificationsNewMessageTemplate; $this->options['notificationsNewMessageSound'] = $notificationsNewMessageSound; $this->options['notificationsNewMessageBadgeCountEnabled'] = $notificationsNewMessageBadgeCountEnabled; $this->options['notificationsAddedToChannelEnabled'] = $notificationsAddedToChannelEnabled; $this->options['notificationsAddedToChannelTemplate'] = $notificationsAddedToChannelTemplate; $this->options['notificationsAddedToChannelSound'] = $notificationsAddedToChannelSound; $this->options['notificationsRemovedFromChannelEnabled'] = $notificationsRemovedFromChannelEnabled; $this->options['notificationsRemovedFromChannelTemplate'] = $notificationsRemovedFromChannelTemplate; $this->options['notificationsRemovedFromChannelSound'] = $notificationsRemovedFromChannelSound; $this->options['notificationsInvitedToChannelEnabled'] = $notificationsInvitedToChannelEnabled; $this->options['notificationsInvitedToChannelTemplate'] = $notificationsInvitedToChannelTemplate; $this->options['notificationsInvitedToChannelSound'] = $notificationsInvitedToChannelSound; $this->options['preWebhookUrl'] = $preWebhookUrl; $this->options['postWebhookUrl'] = $postWebhookUrl; $this->options['webhookMethod'] = $webhookMethod; $this->options['webhookFilters'] = $webhookFilters; $this->options['limitsChannelMembers'] = $limitsChannelMembers; $this->options['limitsUserChannels'] = $limitsUserChannels; $this->options['mediaCompatibilityMessage'] = $mediaCompatibilityMessage; $this->options['preWebhookRetryCount'] = $preWebhookRetryCount; $this->options['postWebhookRetryCount'] = $postWebhookRetryCount; $this->options['notificationsLogEnabled'] = $notificationsLogEnabled; } /** * A descriptive string that you create to describe the resource. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * The service role assigned to users when they are added to the service. See the [Role resource](https://www.twilio.com/docs/chat/rest/role-resource) for more info about roles. * * @param string $defaultServiceRoleSid The service role assigned to users when * they are added to the service * @return $this Fluent Builder */ public function setDefaultServiceRoleSid(string $defaultServiceRoleSid): self { $this->options['defaultServiceRoleSid'] = $defaultServiceRoleSid; return $this; } /** * The channel role assigned to users when they are added to a channel. See the [Role resource](https://www.twilio.com/docs/chat/rest/role-resource) for more info about roles. * * @param string $defaultChannelRoleSid The channel role assigned to users when * they are added to a channel * @return $this Fluent Builder */ public function setDefaultChannelRoleSid(string $defaultChannelRoleSid): self { $this->options['defaultChannelRoleSid'] = $defaultChannelRoleSid; return $this; } /** * The channel role assigned to a channel creator when they join a new channel. See the [Role resource](https://www.twilio.com/docs/chat/rest/role-resource) for more info about roles. * * @param string $defaultChannelCreatorRoleSid The channel role assigned to a * channel creator when they join a * new channel * @return $this Fluent Builder */ public function setDefaultChannelCreatorRoleSid(string $defaultChannelCreatorRoleSid): self { $this->options['defaultChannelCreatorRoleSid'] = $defaultChannelCreatorRoleSid; return $this; } /** * Whether to enable the [Message Consumption Horizon](https://www.twilio.com/docs/chat/consumption-horizon) feature. The default is `true`. * * @param bool $readStatusEnabled Whether to enable the Message Consumption * Horizon feature * @return $this Fluent Builder */ public function setReadStatusEnabled(bool $readStatusEnabled): self { $this->options['readStatusEnabled'] = $readStatusEnabled; return $this; } /** * Whether to enable the [Reachability Indicator](https://www.twilio.com/docs/chat/reachability-indicator) for this Service instance. The default is `false`. * * @param bool $reachabilityEnabled Whether to enable the Reachability * Indicator feature for this Service instance * @return $this Fluent Builder */ public function setReachabilityEnabled(bool $reachabilityEnabled): self { $this->options['reachabilityEnabled'] = $reachabilityEnabled; return $this; } /** * How long in seconds after a `started typing` event until clients should assume that user is no longer typing, even if no `ended typing` message was received. The default is 5 seconds. * * @param int $typingIndicatorTimeout How long in seconds to wait before * assuming the user is no longer typing * @return $this Fluent Builder */ public function setTypingIndicatorTimeout(int $typingIndicatorTimeout): self { $this->options['typingIndicatorTimeout'] = $typingIndicatorTimeout; return $this; } /** * DEPRECATED. The interval in seconds between consumption reports submission batches from client endpoints. * * @param int $consumptionReportInterval DEPRECATED * @return $this Fluent Builder */ public function setConsumptionReportInterval(int $consumptionReportInterval): self { $this->options['consumptionReportInterval'] = $consumptionReportInterval; return $this; } /** * Whether to send a notification when a new message is added to a channel. The default is `false`. * * @param bool $notificationsNewMessageEnabled Whether to send a notification * when a new message is added to a * channel * @return $this Fluent Builder */ public function setNotificationsNewMessageEnabled(bool $notificationsNewMessageEnabled): self { $this->options['notificationsNewMessageEnabled'] = $notificationsNewMessageEnabled; return $this; } /** * The template to use to create the notification text displayed when a new message is added to a channel and `notifications.new_message.enabled` is `true`. * * @param string $notificationsNewMessageTemplate The template to use to create * the notification text * displayed when a new message * is added to a channel * @return $this Fluent Builder */ public function setNotificationsNewMessageTemplate(string $notificationsNewMessageTemplate): self { $this->options['notificationsNewMessageTemplate'] = $notificationsNewMessageTemplate; return $this; } /** * The name of the sound to play when a new message is added to a channel and `notifications.new_message.enabled` is `true`. * * @param string $notificationsNewMessageSound The name of the sound to play * when a new message is added to a * channel * @return $this Fluent Builder */ public function setNotificationsNewMessageSound(string $notificationsNewMessageSound): self { $this->options['notificationsNewMessageSound'] = $notificationsNewMessageSound; return $this; } /** * Whether the new message badge is enabled. The default is `false`. * * @param bool $notificationsNewMessageBadgeCountEnabled Whether the new * message badge is * enabled * @return $this Fluent Builder */ public function setNotificationsNewMessageBadgeCountEnabled(bool $notificationsNewMessageBadgeCountEnabled): self { $this->options['notificationsNewMessageBadgeCountEnabled'] = $notificationsNewMessageBadgeCountEnabled; return $this; } /** * Whether to send a notification when a member is added to a channel. The default is `false`. * * @param bool $notificationsAddedToChannelEnabled Whether to send a * notification when a member * is added to a channel * @return $this Fluent Builder */ public function setNotificationsAddedToChannelEnabled(bool $notificationsAddedToChannelEnabled): self { $this->options['notificationsAddedToChannelEnabled'] = $notificationsAddedToChannelEnabled; return $this; } /** * The template to use to create the notification text displayed when a member is added to a channel and `notifications.added_to_channel.enabled` is `true`. * * @param string $notificationsAddedToChannelTemplate The template to use to * create the notification * text displayed when a * member is added to a * channel * @return $this Fluent Builder */ public function setNotificationsAddedToChannelTemplate(string $notificationsAddedToChannelTemplate): self { $this->options['notificationsAddedToChannelTemplate'] = $notificationsAddedToChannelTemplate; return $this; } /** * The name of the sound to play when a member is added to a channel and `notifications.added_to_channel.enabled` is `true`. * * @param string $notificationsAddedToChannelSound The name of the sound to * play when a member is added * to a channel * @return $this Fluent Builder */ public function setNotificationsAddedToChannelSound(string $notificationsAddedToChannelSound): self { $this->options['notificationsAddedToChannelSound'] = $notificationsAddedToChannelSound; return $this; } /** * Whether to send a notification to a user when they are removed from a channel. The default is `false`. * * @param bool $notificationsRemovedFromChannelEnabled Whether to send a * notification to a user * when they are removed * from a channel * @return $this Fluent Builder */ public function setNotificationsRemovedFromChannelEnabled(bool $notificationsRemovedFromChannelEnabled): self { $this->options['notificationsRemovedFromChannelEnabled'] = $notificationsRemovedFromChannelEnabled; return $this; } /** * The template to use to create the notification text displayed to a user when they are removed from a channel and `notifications.removed_from_channel.enabled` is `true`. * * @param string $notificationsRemovedFromChannelTemplate The template to use * to create the * notification text * displayed to a user * when they are removed * @return $this Fluent Builder */ public function setNotificationsRemovedFromChannelTemplate(string $notificationsRemovedFromChannelTemplate): self { $this->options['notificationsRemovedFromChannelTemplate'] = $notificationsRemovedFromChannelTemplate; return $this; } /** * The name of the sound to play to a user when they are removed from a channel and `notifications.removed_from_channel.enabled` is `true`. * * @param string $notificationsRemovedFromChannelSound The name of the sound to * play to a user when they * are removed from a * channel * @return $this Fluent Builder */ public function setNotificationsRemovedFromChannelSound(string $notificationsRemovedFromChannelSound): self { $this->options['notificationsRemovedFromChannelSound'] = $notificationsRemovedFromChannelSound; return $this; } /** * Whether to send a notification when a user is invited to a channel. The default is `false`. * * @param bool $notificationsInvitedToChannelEnabled Whether to send a * notification when a user * is invited to a channel * @return $this Fluent Builder */ public function setNotificationsInvitedToChannelEnabled(bool $notificationsInvitedToChannelEnabled): self { $this->options['notificationsInvitedToChannelEnabled'] = $notificationsInvitedToChannelEnabled; return $this; } /** * The template to use to create the notification text displayed when a user is invited to a channel and `notifications.invited_to_channel.enabled` is `true`. * * @param string $notificationsInvitedToChannelTemplate The template to use to * create the notification * text displayed when a * user is invited to a * channel * @return $this Fluent Builder */ public function setNotificationsInvitedToChannelTemplate(string $notificationsInvitedToChannelTemplate): self { $this->options['notificationsInvitedToChannelTemplate'] = $notificationsInvitedToChannelTemplate; return $this; } /** * The name of the sound to play when a user is invited to a channel and `notifications.invited_to_channel.enabled` is `true`. * * @param string $notificationsInvitedToChannelSound The name of the sound to * play when a user is * invited to a channel * @return $this Fluent Builder */ public function setNotificationsInvitedToChannelSound(string $notificationsInvitedToChannelSound): self { $this->options['notificationsInvitedToChannelSound'] = $notificationsInvitedToChannelSound; return $this; } /** * The URL for pre-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. * * @param string $preWebhookUrl The webhook URL for pre-event webhooks * @return $this Fluent Builder */ public function setPreWebhookUrl(string $preWebhookUrl): self { $this->options['preWebhookUrl'] = $preWebhookUrl; return $this; } /** * The URL for post-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. * * @param string $postWebhookUrl The URL for post-event webhooks * @return $this Fluent Builder */ public function setPostWebhookUrl(string $postWebhookUrl): self { $this->options['postWebhookUrl'] = $postWebhookUrl; return $this; } /** * The HTTP method to use for calls to the `pre_webhook_url` and `post_webhook_url` webhooks. Can be: `POST` or `GET` and the default is `POST`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. * * @param string $webhookMethod The HTTP method to use for both PRE and POST * webhooks * @return $this Fluent Builder */ public function setWebhookMethod(string $webhookMethod): self { $this->options['webhookMethod'] = $webhookMethod; return $this; } /** * The list of webhook events that are enabled for this Service instance. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. * * @param string[] $webhookFilters The list of webhook events that are enabled * for this Service instance * @return $this Fluent Builder */ public function setWebhookFilters(array $webhookFilters): self { $this->options['webhookFilters'] = $webhookFilters; return $this; } /** * The maximum number of Members that can be added to Channels within this Service. Can be up to 1,000. * * @param int $limitsChannelMembers The maximum number of Members that can be * added to Channels within this Service * @return $this Fluent Builder */ public function setLimitsChannelMembers(int $limitsChannelMembers): self { $this->options['limitsChannelMembers'] = $limitsChannelMembers; return $this; } /** * The maximum number of Channels Users can be a Member of within this Service. Can be up to 1,000. * * @param int $limitsUserChannels The maximum number of Channels Users can be a * Member of within this Service * @return $this Fluent Builder */ public function setLimitsUserChannels(int $limitsUserChannels): self { $this->options['limitsUserChannels'] = $limitsUserChannels; return $this; } /** * The message to send when a media message has no text. Can be used as placeholder message. * * @param string $mediaCompatibilityMessage The message to send when a media * message has no text * @return $this Fluent Builder */ public function setMediaCompatibilityMessage(string $mediaCompatibilityMessage): self { $this->options['mediaCompatibilityMessage'] = $mediaCompatibilityMessage; return $this; } /** * The number of times to retry a call to the `pre_webhook_url` if the request times out (after 5 seconds) or it receives a 429, 503, or 504 HTTP response. Default retry count is 0 times, which means the call won't be retried. * * @param int $preWebhookRetryCount Count of times webhook will be retried in * case of timeout or 429/503/504 HTTP * responses * @return $this Fluent Builder */ public function setPreWebhookRetryCount(int $preWebhookRetryCount): self { $this->options['preWebhookRetryCount'] = $preWebhookRetryCount; return $this; } /** * The number of times to retry a call to the `post_webhook_url` if the request times out (after 5 seconds) or it receives a 429, 503, or 504 HTTP response. The default is 0, which means the call won't be retried. * * @param int $postWebhookRetryCount The number of times calls to the * `post_webhook_url` will be retried * @return $this Fluent Builder */ public function setPostWebhookRetryCount(int $postWebhookRetryCount): self { $this->options['postWebhookRetryCount'] = $postWebhookRetryCount; return $this; } /** * Whether to log notifications. The default is `false`. * * @param bool $notificationsLogEnabled Whether to log notifications * @return $this Fluent Builder */ public function setNotificationsLogEnabled(bool $notificationsLogEnabled): self { $this->options['notificationsLogEnabled'] = $notificationsLogEnabled; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V2.UpdateServiceOptions ' . $options . ']'; } }src/Twilio/Rest/Chat/V2/CredentialOptions.php000064400000027120150515725700015035 0ustar00options['friendlyName'] = $friendlyName; $this->options['certificate'] = $certificate; $this->options['privateKey'] = $privateKey; $this->options['sandbox'] = $sandbox; $this->options['apiKey'] = $apiKey; $this->options['secret'] = $secret; } /** * A descriptive string that you create to describe the new resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * [APN only] The URL encoded representation of the certificate. For example, `-----BEGIN CERTIFICATE----- MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEF.....A== -----END CERTIFICATE-----` * * @param string $certificate [APN only] The URL encoded representation of the * certificate * @return $this Fluent Builder */ public function setCertificate(string $certificate): self { $this->options['certificate'] = $certificate; return $this; } /** * [APN only] The URL encoded representation of the private key. For example, `-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fG... -----END RSA PRIVATE KEY-----` * * @param string $privateKey [APN only] The URL encoded representation of the * private key * @return $this Fluent Builder */ public function setPrivateKey(string $privateKey): self { $this->options['privateKey'] = $privateKey; return $this; } /** * [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. * * @param bool $sandbox [APN only] Whether to send the credential to sandbox * APNs * @return $this Fluent Builder */ public function setSandbox(bool $sandbox): self { $this->options['sandbox'] = $sandbox; return $this; } /** * [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential. * * @param string $apiKey [GCM only] The API key for the project that was * obtained from the Google Developer console for your * GCM Service application credential * @return $this Fluent Builder */ public function setApiKey(string $apiKey): self { $this->options['apiKey'] = $apiKey; return $this; } /** * [FCM only] The **Server key** of your project from the Firebase console, found under Settings / Cloud messaging. * * @param string $secret [FCM only] The Server key of your project from * Firebase console * @return $this Fluent Builder */ public function setSecret(string $secret): self { $this->options['secret'] = $secret; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V2.CreateCredentialOptions ' . $options . ']'; } } class UpdateCredentialOptions extends Options { /** * @param string $friendlyName A string to describe the resource * @param string $certificate [APN only] The URL encoded representation of the * certificate * @param string $privateKey [APN only] The URL encoded representation of the * private key * @param bool $sandbox [APN only] Whether to send the credential to sandbox * APNs * @param string $apiKey [GCM only] The API key for the project that was * obtained from the Google Developer console for your * GCM Service application credential * @param string $secret [FCM only] The Server key of your project from * Firebase console */ public function __construct(string $friendlyName = Values::NONE, string $certificate = Values::NONE, string $privateKey = Values::NONE, bool $sandbox = Values::NONE, string $apiKey = Values::NONE, string $secret = Values::NONE) { $this->options['friendlyName'] = $friendlyName; $this->options['certificate'] = $certificate; $this->options['privateKey'] = $privateKey; $this->options['sandbox'] = $sandbox; $this->options['apiKey'] = $apiKey; $this->options['secret'] = $secret; } /** * A descriptive string that you create to describe the resource. It can be up to 64 characters long. * * @param string $friendlyName A string to describe the resource * @return $this Fluent Builder */ public function setFriendlyName(string $friendlyName): self { $this->options['friendlyName'] = $friendlyName; return $this; } /** * [APN only] The URL encoded representation of the certificate. For example, `-----BEGIN CERTIFICATE----- MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEF.....A== -----END CERTIFICATE-----` * * @param string $certificate [APN only] The URL encoded representation of the * certificate * @return $this Fluent Builder */ public function setCertificate(string $certificate): self { $this->options['certificate'] = $certificate; return $this; } /** * [APN only] The URL encoded representation of the private key. For example, `-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fG... -----END RSA PRIVATE KEY-----` * * @param string $privateKey [APN only] The URL encoded representation of the * private key * @return $this Fluent Builder */ public function setPrivateKey(string $privateKey): self { $this->options['privateKey'] = $privateKey; return $this; } /** * [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. * * @param bool $sandbox [APN only] Whether to send the credential to sandbox * APNs * @return $this Fluent Builder */ public function setSandbox(bool $sandbox): self { $this->options['sandbox'] = $sandbox; return $this; } /** * [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential. * * @param string $apiKey [GCM only] The API key for the project that was * obtained from the Google Developer console for your * GCM Service application credential * @return $this Fluent Builder */ public function setApiKey(string $apiKey): self { $this->options['apiKey'] = $apiKey; return $this; } /** * [FCM only] The **Server key** of your project from the Firebase console, found under Settings / Cloud messaging. * * @param string $secret [FCM only] The Server key of your project from * Firebase console * @return $this Fluent Builder */ public function setSecret(string $secret): self { $this->options['secret'] = $secret; return $this; } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $options = \http_build_query(Values::of($this->options), '', ' '); return '[Twilio.Chat.V2.UpdateCredentialOptions ' . $options . ']'; } }src/Twilio/Rest/Chat/V2/ServicePage.php000064400000002163150515725700013604 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return ServiceInstance \Twilio\Rest\Chat\V2\ServiceInstance */ public function buildInstance(array $payload): ServiceInstance { return new ServiceInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V2.ServicePage]'; } }src/Twilio/Rest/Chat/V2/CredentialPage.php000064400000002205150515725700014253 0ustar00solution = $solution; } /** * @param array $payload Payload response from the API * @return CredentialInstance \Twilio\Rest\Chat\V2\CredentialInstance */ public function buildInstance(array $payload): CredentialInstance { return new CredentialInstance($this->version, $payload); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V2.CredentialPage]'; } }src/Twilio/Rest/Chat/V2/ServiceList.php000064400000012036150515725700013643 0ustar00solution = []; $this->uri = '/Services'; } /** * Create the ServiceInstance * * @param string $friendlyName A string to describe the resource * @return ServiceInstance Created ServiceInstance * @throws TwilioException When an HTTP error occurs. */ public function create(string $friendlyName): ServiceInstance { $data = Values::of(['FriendlyName' => $friendlyName, ]); $payload = $this->version->create('POST', $this->uri, [], $data); return new ServiceInstance($this->version, $payload); } /** * Streams ServiceInstance records from the API as a generator stream. * This operation lazily loads records as efficiently as possible until the * limit * is reached. * The results are returned as a generator, so this operation is memory * efficient. * * @param int $limit Upper limit for the number of records to return. stream() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, stream() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return Stream stream of results */ public function stream(int $limit = null, $pageSize = null): Stream { $limits = $this->version->readLimits($limit, $pageSize); $page = $this->page($limits['pageSize']); return $this->version->stream($page, $limits['limit'], $limits['pageLimit']); } /** * Reads ServiceInstance records from the API as a list. * Unlike stream(), this operation is eager and will load `limit` records into * memory before returning. * * @param int $limit Upper limit for the number of records to return. read() * guarantees to never return more than limit. Default is no * limit * @param mixed $pageSize Number of records to fetch per request, when not set * will use the default value of 50 records. If no * page_size is defined but a limit is defined, read() * will attempt to read the limit with the most * efficient page size, i.e. min(limit, 1000) * @return ServiceInstance[] Array of results */ public function read(int $limit = null, $pageSize = null): array { return \iterator_to_array($this->stream($limit, $pageSize), false); } /** * Retrieve a single page of ServiceInstance records from the API. * Request is executed immediately * * @param mixed $pageSize Number of records to return, defaults to 50 * @param string $pageToken PageToken provided by the API * @param mixed $pageNumber Page Number, this value is simply for client state * @return ServicePage Page of ServiceInstance */ public function page($pageSize = Values::NONE, string $pageToken = Values::NONE, $pageNumber = Values::NONE): ServicePage { $params = Values::of(['PageToken' => $pageToken, 'Page' => $pageNumber, 'PageSize' => $pageSize, ]); $response = $this->version->page('GET', $this->uri, $params); return new ServicePage($this->version, $response, $this->solution); } /** * Retrieve a specific page of ServiceInstance records from the API. * Request is executed immediately * * @param string $targetUrl API-generated URL for the requested results page * @return ServicePage Page of ServiceInstance */ public function getPage(string $targetUrl): ServicePage { $response = $this->version->getDomain()->getClient()->request( 'GET', $targetUrl ); return new ServicePage($this->version, $response, $this->solution); } /** * Constructs a ServiceContext * * @param string $sid The SID of the Service resource to fetch */ public function getContext(string $sid): ServiceContext { return new ServiceContext($this->version, $sid); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { return '[Twilio.Chat.V2.ServiceList]'; } }src/Twilio/Rest/Chat/V2/CredentialInstance.php000064400000007737150515725700015162 0ustar00properties = [ 'sid' => Values::array_get($payload, 'sid'), 'accountSid' => Values::array_get($payload, 'account_sid'), 'friendlyName' => Values::array_get($payload, 'friendly_name'), 'type' => Values::array_get($payload, 'type'), 'sandbox' => Values::array_get($payload, 'sandbox'), '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 = ['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 CredentialContext Context for this CredentialInstance */ protected function proxy(): CredentialContext { if (!$this->context) { $this->context = new CredentialContext($this->version, $this->solution['sid']); } return $this->context; } /** * Fetch the CredentialInstance * * @return CredentialInstance Fetched CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): CredentialInstance { return $this->proxy()->fetch(); } /** * Update the CredentialInstance * * @param array|Options $options Optional Arguments * @return CredentialInstance Updated CredentialInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): CredentialInstance { return $this->proxy()->update($options); } /** * Delete the CredentialInstance * * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(): bool { 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(string $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(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Chat.V2.CredentialInstance ' . \implode(' ', $context) . ']'; } }src/Twilio/InstanceContext.php000064400000000464150515725700012437 0ustar00version = $version; } public function __toString(): string { return '[InstanceContext]'; } } src/Twilio/Exceptions/HttpException.php000064400000000127150515725700014241 0ustar00statusCode = $statusCode; $this->moreInfo = $moreInfo; $this->details = $details; parent::__construct($message, $code); } /** * Get the HTTP Status Code of the RestException * @return int HTTP Status Code */ public function getStatusCode(): int { return $this->statusCode; } /** * Get more information of the RestException * @return string More error information */ public function getMoreInfo(): string { return $this->moreInfo; } /** * Get the details of the RestException * @return exception details */ public function getDetails(): array { return $this->details; } } src/Twilio/Exceptions/ConfigurationException.php000064400000000140150515725700016124 0ustar00nest(new Body($message)); } /** * Add Media child. * * @param string $url Media URL * @return Media Child element. */ public function media($url): Media { return $this->nest(new Media($url)); } /** * Add To attribute. * * @param string $to Phone Number to send Message to */ public function setTo($to): self { return $this->setAttribute('to', $to); } /** * Add From attribute. * * @param string $from Phone Number to send Message from */ public function setFrom($from): self { return $this->setAttribute('from', $from); } /** * Add Action attribute. * * @param string $action Action URL */ public function setAction($action): self { return $this->setAttribute('action', $action); } /** * Add Method attribute. * * @param string $method Action URL Method */ public function setMethod($method): self { return $this->setAttribute('method', $method); } /** * Add StatusCallback attribute. * * @param string $statusCallback Status callback URL. Deprecated in favor of * action. */ public function setStatusCallback($statusCallback): self { return $this->setAttribute('statusCallback', $statusCallback); } }src/Twilio/TwiML/Messaging/Media.php000064400000000575150515725700013261 0ustar00setAttribute('method', $method); } }src/Twilio/TwiML/Messaging/Body.php000064400000000611150515725700013126 0ustar00nest(new Fax\Receive($attributes)); } }src/Twilio/TwiML/Voice/Siprec.php000064400000002541150515725700012612 0ustar00nest(new Parameter($attributes)); } /** * Add Name attribute. * * @param string $name Friendly name given to SIPREC */ public function setName($name): self { return $this->setAttribute('name', $name); } /** * Add ConnectorName attribute. * * @param string $connectorName Unique name for Connector */ public function setConnectorName($connectorName): self { return $this->setAttribute('connectorName', $connectorName); } /** * Add Track attribute. * * @param string $track Track to be streamed to remote service */ public function setTrack($track): self { return $this->setAttribute('track', $track); } }src/Twilio/TwiML/Voice/SsmlW.php000064400000005157150515725700012440 0ustar00nest(new SsmlBreak($attributes)); } /** * Add Emphasis child. * * @param string $words Words to emphasize * @param array $attributes Optional attributes * @return SsmlEmphasis Child element. */ public function emphasis($words, $attributes = []): SsmlEmphasis { return $this->nest(new SsmlEmphasis($words, $attributes)); } /** * Add Phoneme child. * * @param string $words Words to speak * @param array $attributes Optional attributes * @return SsmlPhoneme Child element. */ public function phoneme($words, $attributes = []): SsmlPhoneme { return $this->nest(new SsmlPhoneme($words, $attributes)); } /** * Add Prosody child. * * @param string $words Words to speak * @param array $attributes Optional attributes * @return SsmlProsody Child element. */ public function prosody($words, $attributes = []): SsmlProsody { return $this->nest(new SsmlProsody($words, $attributes)); } /** * Add Say-As child. * * @param string $words Words to be interpreted * @param array $attributes Optional attributes * @return SsmlSayAs Child element. */ public function say_As($words, $attributes = []): SsmlSayAs { return $this->nest(new SsmlSayAs($words, $attributes)); } /** * Add Sub child. * * @param string $words Words to be substituted * @param array $attributes Optional attributes * @return SsmlSub Child element. */ public function sub($words, $attributes = []): SsmlSub { return $this->nest(new SsmlSub($words, $attributes)); } /** * Add Role attribute. * * @param string $role Customize the pronunciation of words by specifying the * word’s part of speech or alternate meaning */ public function setRole($role): self { return $this->setAttribute('role', $role); } }src/Twilio/TwiML/Voice/Connect.php000064400000003604150515725700012757 0ustar00nest(new Room($name, $attributes)); } /** * Add Autopilot child. * * @param string $name Autopilot assistant sid or unique name * @return Autopilot Child element. */ public function autopilot($name): Autopilot { return $this->nest(new Autopilot($name)); } /** * Add Stream child. * * @param array $attributes Optional attributes * @return Stream Child element. */ public function stream($attributes = []): Stream { return $this->nest(new Stream($attributes)); } /** * Add VirtualAgent child. * * @param array $attributes Optional attributes * @return VirtualAgent Child element. */ public function virtualAgent($attributes = []): VirtualAgent { return $this->nest(new VirtualAgent($attributes)); } /** * Add Action attribute. * * @param string $action Action URL */ public function setAction($action): self { return $this->setAttribute('action', $action); } /** * Add Method attribute. * * @param string $method Action URL method */ public function setMethod($method): self { return $this->setAttribute('method', $method); } }src/Twilio/TwiML/Voice/Identity.php000064400000000670150515725700013157 0ustar00setAttribute('action', $action); } /** * Add Method attribute. * * @param string $method Action URL method */ public function setMethod($method): self { return $this->setAttribute('method', $method); } /** * Add Timeout attribute. * * @param int $timeout Timeout to begin recording */ public function setTimeout($timeout): self { return $this->setAttribute('timeout', $timeout); } /** * Add FinishOnKey attribute. * * @param string $finishOnKey Finish recording on key */ public function setFinishOnKey($finishOnKey): self { return $this->setAttribute('finishOnKey', $finishOnKey); } /** * Add MaxLength attribute. * * @param int $maxLength Max time to record in seconds */ public function setMaxLength($maxLength): self { return $this->setAttribute('maxLength', $maxLength); } /** * Add PlayBeep attribute. * * @param bool $playBeep Play beep */ public function setPlayBeep($playBeep): self { return $this->setAttribute('playBeep', $playBeep); } /** * Add Trim attribute. * * @param string $trim Trim the recording */ public function setTrim($trim): self { return $this->setAttribute('trim', $trim); } /** * Add RecordingStatusCallback attribute. * * @param string $recordingStatusCallback Status callback URL */ public function setRecordingStatusCallback($recordingStatusCallback): self { return $this->setAttribute('recordingStatusCallback', $recordingStatusCallback); } /** * Add RecordingStatusCallbackMethod attribute. * * @param string $recordingStatusCallbackMethod Status callback URL method */ public function setRecordingStatusCallbackMethod($recordingStatusCallbackMethod): self { return $this->setAttribute('recordingStatusCallbackMethod', $recordingStatusCallbackMethod); } /** * Add RecordingStatusCallbackEvent attribute. * * @param string[] $recordingStatusCallbackEvent Recording status callback * events */ public function setRecordingStatusCallbackEvent($recordingStatusCallbackEvent): self { return $this->setAttribute('recordingStatusCallbackEvent', $recordingStatusCallbackEvent); } /** * Add Transcribe attribute. * * @param bool $transcribe Transcribe the recording */ public function setTranscribe($transcribe): self { return $this->setAttribute('transcribe', $transcribe); } /** * Add TranscribeCallback attribute. * * @param string $transcribeCallback Transcribe callback URL */ public function setTranscribeCallback($transcribeCallback): self { return $this->setAttribute('transcribeCallback', $transcribeCallback); } }src/Twilio/TwiML/Voice/Start.php000064400000002463150515725700012465 0ustar00nest(new Stream($attributes)); } /** * Add Siprec child. * * @param array $attributes Optional attributes * @return Siprec Child element. */ public function siprec($attributes = []): Siprec { return $this->nest(new Siprec($attributes)); } /** * Add Action attribute. * * @param string $action Action URL */ public function setAction($action): self { return $this->setAttribute('action', $action); } /** * Add Method attribute. * * @param string $method Action URL method */ public function setMethod($method): self { return $this->setAttribute('method', $method); } }src/Twilio/TwiML/Voice/Stop.php000064400000001477150515725700012321 0ustar00nest(new Stream($attributes)); } /** * Add Siprec child. * * @param array $attributes Optional attributes * @return Siprec Child element. */ public function siprec($attributes = []): Siprec { return $this->nest(new Siprec($attributes)); } }src/Twilio/TwiML/Voice/Play.php000064400000001554150515725700012275 0ustar00setAttribute('loop', $loop); } /** * Add Digits attribute. * * @param string $digits Play DTMF tones for digits */ public function setDigits($digits): self { return $this->setAttribute('digits', $digits); } }src/Twilio/TwiML/Voice/Autopilot.php000064400000000645150515725700013350 0ustar00setAttribute('interpret-as', $interpretAs); } /** * Add Role attribute. * * @param string $role Specify the format of the date when interpret-as is set * to date */ public function setRole($role): self { return $this->setAttribute('role', $role); } }src/Twilio/TwiML/Voice/Task.php000064400000001620150515725700012264 0ustar00setAttribute('priority', $priority); } /** * Add Timeout attribute. * * @param int $timeout Timeout associated with task */ public function setTimeout($timeout): self { return $this->setAttribute('timeout', $timeout); } }src/Twilio/TwiML/Voice/Enqueue.php000064400000003550150515725700012775 0ustar00nest(new Task($body, $attributes)); } /** * Add Action attribute. * * @param string $action Action URL */ public function setAction($action): self { return $this->setAttribute('action', $action); } /** * Add Method attribute. * * @param string $method Action URL method */ public function setMethod($method): self { return $this->setAttribute('method', $method); } /** * Add WaitUrl attribute. * * @param string $waitUrl Wait URL */ public function setWaitUrl($waitUrl): self { return $this->setAttribute('waitUrl', $waitUrl); } /** * Add WaitUrlMethod attribute. * * @param string $waitUrlMethod Wait URL method */ public function setWaitUrlMethod($waitUrlMethod): self { return $this->setAttribute('waitUrlMethod', $waitUrlMethod); } /** * Add WorkflowSid attribute. * * @param string $workflowSid TaskRouter Workflow SID */ public function setWorkflowSid($workflowSid): self { return $this->setAttribute('workflowSid', $workflowSid); } }src/Twilio/TwiML/Voice/SsmlPhoneme.php000064400000001643150515725700013621 0ustar00setAttribute('alphabet', $alphabet); } /** * Add Ph attribute. * * @param string $ph Specifiy the phonetic symbols for pronunciation */ public function setPh($ph): self { return $this->setAttribute('ph', $ph); } }src/Twilio/TwiML/Voice/Queue.php000064400000002604150515725700012451 0ustar00setAttribute('url', $url); } /** * Add Method attribute. * * @param string $method Action URL method */ public function setMethod($method): self { return $this->setAttribute('method', $method); } /** * Add ReservationSid attribute. * * @param string $reservationSid TaskRouter Reservation SID */ public function setReservationSid($reservationSid): self { return $this->setAttribute('reservationSid', $reservationSid); } /** * Add PostWorkActivitySid attribute. * * @param string $postWorkActivitySid TaskRouter Activity SID */ public function setPostWorkActivitySid($postWorkActivitySid): self { return $this->setAttribute('postWorkActivitySid', $postWorkActivitySid); } }src/Twilio/TwiML/Voice/Stream.php000064400000004174150515725700012624 0ustar00nest(new Parameter($attributes)); } /** * Add Name attribute. * * @param string $name Friendly name given to the Stream */ public function setName($name): self { return $this->setAttribute('name', $name); } /** * Add ConnectorName attribute. * * @param string $connectorName Unique name for Stream Connector */ public function setConnectorName($connectorName): self { return $this->setAttribute('connectorName', $connectorName); } /** * Add Url attribute. * * @param string $url URL of the remote service where the Stream is routed */ public function setUrl($url): self { return $this->setAttribute('url', $url); } /** * Add Track attribute. * * @param string $track Track to be streamed to remote service */ public function setTrack($track): self { return $this->setAttribute('track', $track); } /** * Add StatusCallback attribute. * * @param string $statusCallback Status Callback URL */ public function setStatusCallback($statusCallback): self { return $this->setAttribute('statusCallback', $statusCallback); } /** * Add StatusCallbackMethod attribute. * * @param string $statusCallbackMethod Status Callback URL method */ public function setStatusCallbackMethod($statusCallbackMethod): self { return $this->setAttribute('statusCallbackMethod', $statusCallbackMethod); } }src/Twilio/TwiML/Voice/Conference.php000064400000013361150515725700013436 0ustar00setAttribute('muted', $muted); } /** * Add Beep attribute. * * @param string $beep Play beep when joining */ public function setBeep($beep): self { return $this->setAttribute('beep', $beep); } /** * Add StartConferenceOnEnter attribute. * * @param bool $startConferenceOnEnter Start the conference on enter */ public function setStartConferenceOnEnter($startConferenceOnEnter): self { return $this->setAttribute('startConferenceOnEnter', $startConferenceOnEnter); } /** * Add EndConferenceOnExit attribute. * * @param bool $endConferenceOnExit End the conferenceon exit */ public function setEndConferenceOnExit($endConferenceOnExit): self { return $this->setAttribute('endConferenceOnExit', $endConferenceOnExit); } /** * Add WaitUrl attribute. * * @param string $waitUrl Wait URL */ public function setWaitUrl($waitUrl): self { return $this->setAttribute('waitUrl', $waitUrl); } /** * Add WaitMethod attribute. * * @param string $waitMethod Wait URL method */ public function setWaitMethod($waitMethod): self { return $this->setAttribute('waitMethod', $waitMethod); } /** * Add MaxParticipants attribute. * * @param int $maxParticipants Maximum number of participants */ public function setMaxParticipants($maxParticipants): self { return $this->setAttribute('maxParticipants', $maxParticipants); } /** * Add Record attribute. * * @param string $record Record the conference */ public function setRecord($record): self { return $this->setAttribute('record', $record); } /** * Add Region attribute. * * @param string $region Conference region */ public function setRegion($region): self { return $this->setAttribute('region', $region); } /** * Add Coach attribute. * * @param string $coach Call coach */ public function setCoach($coach): self { return $this->setAttribute('coach', $coach); } /** * Add Trim attribute. * * @param string $trim Trim the conference recording */ public function setTrim($trim): self { return $this->setAttribute('trim', $trim); } /** * Add StatusCallbackEvent attribute. * * @param string[] $statusCallbackEvent Events to call status callback URL */ public function setStatusCallbackEvent($statusCallbackEvent): self { return $this->setAttribute('statusCallbackEvent', $statusCallbackEvent); } /** * Add StatusCallback attribute. * * @param string $statusCallback Status callback URL */ public function setStatusCallback($statusCallback): self { return $this->setAttribute('statusCallback', $statusCallback); } /** * Add StatusCallbackMethod attribute. * * @param string $statusCallbackMethod Status callback URL method */ public function setStatusCallbackMethod($statusCallbackMethod): self { return $this->setAttribute('statusCallbackMethod', $statusCallbackMethod); } /** * Add RecordingStatusCallback attribute. * * @param string $recordingStatusCallback Recording status callback URL */ public function setRecordingStatusCallback($recordingStatusCallback): self { return $this->setAttribute('recordingStatusCallback', $recordingStatusCallback); } /** * Add RecordingStatusCallbackMethod attribute. * * @param string $recordingStatusCallbackMethod Recording status callback URL * method */ public function setRecordingStatusCallbackMethod($recordingStatusCallbackMethod): self { return $this->setAttribute('recordingStatusCallbackMethod', $recordingStatusCallbackMethod); } /** * Add RecordingStatusCallbackEvent attribute. * * @param string[] $recordingStatusCallbackEvent Recording status callback * events */ public function setRecordingStatusCallbackEvent($recordingStatusCallbackEvent): self { return $this->setAttribute('recordingStatusCallbackEvent', $recordingStatusCallbackEvent); } /** * Add EventCallbackUrl attribute. * * @param string $eventCallbackUrl Event callback URL */ public function setEventCallbackUrl($eventCallbackUrl): self { return $this->setAttribute('eventCallbackUrl', $eventCallbackUrl); } /** * Add JitterBufferSize attribute. * * @param string $jitterBufferSize Size of jitter buffer for participant */ public function setJitterBufferSize($jitterBufferSize): self { return $this->setAttribute('jitterBufferSize', $jitterBufferSize); } /** * Add ParticipantLabel attribute. * * @param string $participantLabel A label for participant */ public function setParticipantLabel($participantLabel): self { return $this->setAttribute('participantLabel', $participantLabel); } }src/Twilio/TwiML/Voice/SsmlLang.php000064400000007063150515725700013111 0ustar00nest(new SsmlBreak($attributes)); } /** * Add Emphasis child. * * @param string $words Words to emphasize * @param array $attributes Optional attributes * @return SsmlEmphasis Child element. */ public function emphasis($words, $attributes = []): SsmlEmphasis { return $this->nest(new SsmlEmphasis($words, $attributes)); } /** * Add Lang child. * * @param string $words Words to speak * @param array $attributes Optional attributes * @return SsmlLang Child element. */ public function lang($words, $attributes = []): SsmlLang { return $this->nest(new SsmlLang($words, $attributes)); } /** * Add P child. * * @param string $words Words to speak * @return SsmlP Child element. */ public function p($words): SsmlP { return $this->nest(new SsmlP($words)); } /** * Add Phoneme child. * * @param string $words Words to speak * @param array $attributes Optional attributes * @return SsmlPhoneme Child element. */ public function phoneme($words, $attributes = []): SsmlPhoneme { return $this->nest(new SsmlPhoneme($words, $attributes)); } /** * Add Prosody child. * * @param string $words Words to speak * @param array $attributes Optional attributes * @return SsmlProsody Child element. */ public function prosody($words, $attributes = []): SsmlProsody { return $this->nest(new SsmlProsody($words, $attributes)); } /** * Add S child. * * @param string $words Words to speak * @return SsmlS Child element. */ public function s($words): SsmlS { return $this->nest(new SsmlS($words)); } /** * Add Say-As child. * * @param string $words Words to be interpreted * @param array $attributes Optional attributes * @return SsmlSayAs Child element. */ public function say_As($words, $attributes = []): SsmlSayAs { return $this->nest(new SsmlSayAs($words, $attributes)); } /** * Add Sub child. * * @param string $words Words to be substituted * @param array $attributes Optional attributes * @return SsmlSub Child element. */ public function sub($words, $attributes = []): SsmlSub { return $this->nest(new SsmlSub($words, $attributes)); } /** * Add W child. * * @param string $words Words to speak * @param array $attributes Optional attributes * @return SsmlW Child element. */ public function w($words, $attributes = []): SsmlW { return $this->nest(new SsmlW($words, $attributes)); } /** * Add Xml:Lang attribute. * * @param string $xmlLang Specify the language */ public function setXmlLang($xmlLang): self { return $this->setAttribute('xml:Lang', $xmlLang); } }src/Twilio/TwiML/Voice/SsmlBreak.php000064400000001714150515725700013251 0ustar00setAttribute('strength', $strength); } /** * Add Time attribute. * * @param string $time Set a pause to a specific length of time in seconds or * milliseconds, available values: [number]s, [number]ms */ public function setTime($time): self { return $this->setAttribute('time', $time); } }src/Twilio/TwiML/Voice/SsmlEmphasis.php000064400000006221150515725700013774 0ustar00nest(new SsmlBreak($attributes)); } /** * Add Emphasis child. * * @param string $words Words to emphasize * @param array $attributes Optional attributes * @return SsmlEmphasis Child element. */ public function emphasis($words, $attributes = []): SsmlEmphasis { return $this->nest(new SsmlEmphasis($words, $attributes)); } /** * Add Lang child. * * @param string $words Words to speak * @param array $attributes Optional attributes * @return SsmlLang Child element. */ public function lang($words, $attributes = []): SsmlLang { return $this->nest(new SsmlLang($words, $attributes)); } /** * Add Phoneme child. * * @param string $words Words to speak * @param array $attributes Optional attributes * @return SsmlPhoneme Child element. */ public function phoneme($words, $attributes = []): SsmlPhoneme { return $this->nest(new SsmlPhoneme($words, $attributes)); } /** * Add Prosody child. * * @param string $words Words to speak * @param array $attributes Optional attributes * @return SsmlProsody Child element. */ public function prosody($words, $attributes = []): SsmlProsody { return $this->nest(new SsmlProsody($words, $attributes)); } /** * Add Say-As child. * * @param string $words Words to be interpreted * @param array $attributes Optional attributes * @return SsmlSayAs Child element. */ public function say_As($words, $attributes = []): SsmlSayAs { return $this->nest(new SsmlSayAs($words, $attributes)); } /** * Add Sub child. * * @param string $words Words to be substituted * @param array $attributes Optional attributes * @return SsmlSub Child element. */ public function sub($words, $attributes = []): SsmlSub { return $this->nest(new SsmlSub($words, $attributes)); } /** * Add W child. * * @param string $words Words to speak * @param array $attributes Optional attributes * @return SsmlW Child element. */ public function w($words, $attributes = []): SsmlW { return $this->nest(new SsmlW($words, $attributes)); } /** * Add Level attribute. * * @param string $level Specify the degree of emphasis */ public function setLevel($level): self { return $this->setAttribute('level', $level); } }src/Twilio/TwiML/Voice/Gather.php000064400000013407150515725700012602 0ustar00nest(new Say($message, $attributes)); } /** * Add Pause child. * * @param array $attributes Optional attributes * @return Pause Child element. */ public function pause($attributes = []): Pause { return $this->nest(new Pause($attributes)); } /** * Add Play child. * * @param string $url Media URL * @param array $attributes Optional attributes * @return Play Child element. */ public function play($url = null, $attributes = []): Play { return $this->nest(new Play($url, $attributes)); } /** * Add Input attribute. * * @param string[] $input Input type Twilio should accept */ public function setInput($input): self { return $this->setAttribute('input', $input); } /** * Add Action attribute. * * @param string $action Action URL */ public function setAction($action): self { return $this->setAttribute('action', $action); } /** * Add Method attribute. * * @param string $method Action URL method */ public function setMethod($method): self { return $this->setAttribute('method', $method); } /** * Add Timeout attribute. * * @param int $timeout Time to wait to gather input */ public function setTimeout($timeout): self { return $this->setAttribute('timeout', $timeout); } /** * Add SpeechTimeout attribute. * * @param string $speechTimeout Time to wait to gather speech input and it * should be either auto or a positive integer. */ public function setSpeechTimeout($speechTimeout): self { return $this->setAttribute('speechTimeout', $speechTimeout); } /** * Add MaxSpeechTime attribute. * * @param int $maxSpeechTime Max allowed time for speech input */ public function setMaxSpeechTime($maxSpeechTime): self { return $this->setAttribute('maxSpeechTime', $maxSpeechTime); } /** * Add ProfanityFilter attribute. * * @param bool $profanityFilter Profanity Filter on speech */ public function setProfanityFilter($profanityFilter): self { return $this->setAttribute('profanityFilter', $profanityFilter); } /** * Add FinishOnKey attribute. * * @param string $finishOnKey Finish gather on key */ public function setFinishOnKey($finishOnKey): self { return $this->setAttribute('finishOnKey', $finishOnKey); } /** * Add NumDigits attribute. * * @param int $numDigits Number of digits to collect */ public function setNumDigits($numDigits): self { return $this->setAttribute('numDigits', $numDigits); } /** * Add PartialResultCallback attribute. * * @param string $partialResultCallback Partial result callback URL */ public function setPartialResultCallback($partialResultCallback): self { return $this->setAttribute('partialResultCallback', $partialResultCallback); } /** * Add PartialResultCallbackMethod attribute. * * @param string $partialResultCallbackMethod Partial result callback URL method */ public function setPartialResultCallbackMethod($partialResultCallbackMethod): self { return $this->setAttribute('partialResultCallbackMethod', $partialResultCallbackMethod); } /** * Add Language attribute. * * @param string $language Language to use */ public function setLanguage($language): self { return $this->setAttribute('language', $language); } /** * Add Hints attribute. * * @param string $hints Speech recognition hints */ public function setHints($hints): self { return $this->setAttribute('hints', $hints); } /** * Add BargeIn attribute. * * @param bool $bargeIn Stop playing media upon speech */ public function setBargeIn($bargeIn): self { return $this->setAttribute('bargeIn', $bargeIn); } /** * Add Debug attribute. * * @param bool $debug Allow debug for gather */ public function setDebug($debug): self { return $this->setAttribute('debug', $debug); } /** * Add ActionOnEmptyResult attribute. * * @param bool $actionOnEmptyResult Force webhook to the action URL event if * there is no input */ public function setActionOnEmptyResult($actionOnEmptyResult): self { return $this->setAttribute('actionOnEmptyResult', $actionOnEmptyResult); } /** * Add SpeechModel attribute. * * @param string $speechModel Specify the model that is best suited for your * use case */ public function setSpeechModel($speechModel): self { return $this->setAttribute('speechModel', $speechModel); } /** * Add Enhanced attribute. * * @param bool $enhanced Use enhanced speech model */ public function setEnhanced($enhanced): self { return $this->setAttribute('enhanced', $enhanced); } }src/Twilio/TwiML/Voice/SsmlS.php000064400000005516150515725700012433 0ustar00nest(new SsmlBreak($attributes)); } /** * Add Emphasis child. * * @param string $words Words to emphasize * @param array $attributes Optional attributes * @return SsmlEmphasis Child element. */ public function emphasis($words, $attributes = []): SsmlEmphasis { return $this->nest(new SsmlEmphasis($words, $attributes)); } /** * Add Lang child. * * @param string $words Words to speak * @param array $attributes Optional attributes * @return SsmlLang Child element. */ public function lang($words, $attributes = []): SsmlLang { return $this->nest(new SsmlLang($words, $attributes)); } /** * Add Phoneme child. * * @param string $words Words to speak * @param array $attributes Optional attributes * @return SsmlPhoneme Child element. */ public function phoneme($words, $attributes = []): SsmlPhoneme { return $this->nest(new SsmlPhoneme($words, $attributes)); } /** * Add Prosody child. * * @param string $words Words to speak * @param array $attributes Optional attributes * @return SsmlProsody Child element. */ public function prosody($words, $attributes = []): SsmlProsody { return $this->nest(new SsmlProsody($words, $attributes)); } /** * Add Say-As child. * * @param string $words Words to be interpreted * @param array $attributes Optional attributes * @return SsmlSayAs Child element. */ public function say_As($words, $attributes = []): SsmlSayAs { return $this->nest(new SsmlSayAs($words, $attributes)); } /** * Add Sub child. * * @param string $words Words to be substituted * @param array $attributes Optional attributes * @return SsmlSub Child element. */ public function sub($words, $attributes = []): SsmlSub { return $this->nest(new SsmlSub($words, $attributes)); } /** * Add W child. * * @param string $words Words to speak * @param array $attributes Optional attributes * @return SsmlW Child element. */ public function w($words, $attributes = []): SsmlW { return $this->nest(new SsmlW($words, $attributes)); } }src/Twilio/TwiML/Voice/Sip.php000064400000004126150515725700012121 0ustar00setAttribute('username', $username); } /** * Add Password attribute. * * @param string $password SIP Password */ public function setPassword($password): self { return $this->setAttribute('password', $password); } /** * Add Url attribute. * * @param string $url Action URL */ public function setUrl($url): self { return $this->setAttribute('url', $url); } /** * Add Method attribute. * * @param string $method Action URL method */ public function setMethod($method): self { return $this->setAttribute('method', $method); } /** * Add StatusCallbackEvent attribute. * * @param string[] $statusCallbackEvent Status callback events */ public function setStatusCallbackEvent($statusCallbackEvent): self { return $this->setAttribute('statusCallbackEvent', $statusCallbackEvent); } /** * Add StatusCallback attribute. * * @param string $statusCallback Status callback URL */ public function setStatusCallback($statusCallback): self { return $this->setAttribute('statusCallback', $statusCallback); } /** * Add StatusCallbackMethod attribute. * * @param string $statusCallbackMethod Status callback URL method */ public function setStatusCallbackMethod($statusCallbackMethod): self { return $this->setAttribute('statusCallbackMethod', $statusCallbackMethod); } }src/Twilio/TwiML/Voice/ReferSip.php000064400000000604150515725700013102 0ustar00nest(new Prompt($attributes)); } /** * Add Parameter child. * * @param array $attributes Optional attributes * @return Parameter Child element. */ public function parameter($attributes = []): Parameter { return $this->nest(new Parameter($attributes)); } /** * Add Input attribute. * * @param string $input Input type Twilio should accept */ public function setInput($input): self { return $this->setAttribute('input', $input); } /** * Add Action attribute. * * @param string $action Action URL */ public function setAction($action): self { return $this->setAttribute('action', $action); } /** * Add BankAccountType attribute. * * @param string $bankAccountType Bank account type for ach transactions. If * set, payment method attribute must be * provided and value should be set to * ach-debit. defaults to consumer-checking */ public function setBankAccountType($bankAccountType): self { return $this->setAttribute('bankAccountType', $bankAccountType); } /** * Add StatusCallback attribute. * * @param string $statusCallback Status callback URL */ public function setStatusCallback($statusCallback): self { return $this->setAttribute('statusCallback', $statusCallback); } /** * Add StatusCallbackMethod attribute. * * @param string $statusCallbackMethod Status callback method */ public function setStatusCallbackMethod($statusCallbackMethod): self { return $this->setAttribute('statusCallbackMethod', $statusCallbackMethod); } /** * Add Timeout attribute. * * @param int $timeout Time to wait to gather input */ public function setTimeout($timeout): self { return $this->setAttribute('timeout', $timeout); } /** * Add MaxAttempts attribute. * * @param int $maxAttempts Maximum number of allowed retries when gathering * input */ public function setMaxAttempts($maxAttempts): self { return $this->setAttribute('maxAttempts', $maxAttempts); } /** * Add SecurityCode attribute. * * @param bool $securityCode Prompt for security code */ public function setSecurityCode($securityCode): self { return $this->setAttribute('securityCode', $securityCode); } /** * Add PostalCode attribute. * * @param string $postalCode Prompt for postal code and it should be true/false * or default postal code */ public function setPostalCode($postalCode): self { return $this->setAttribute('postalCode', $postalCode); } /** * Add MinPostalCodeLength attribute. * * @param int $minPostalCodeLength Prompt for minimum postal code length */ public function setMinPostalCodeLength($minPostalCodeLength): self { return $this->setAttribute('minPostalCodeLength', $minPostalCodeLength); } /** * Add PaymentConnector attribute. * * @param string $paymentConnector Unique name for payment connector */ public function setPaymentConnector($paymentConnector): self { return $this->setAttribute('paymentConnector', $paymentConnector); } /** * Add PaymentMethod attribute. * * @param string $paymentMethod Payment method to be used. defaults to * credit-card */ public function setPaymentMethod($paymentMethod): self { return $this->setAttribute('paymentMethod', $paymentMethod); } /** * Add TokenType attribute. * * @param string $tokenType Type of token */ public function setTokenType($tokenType): self { return $this->setAttribute('tokenType', $tokenType); } /** * Add ChargeAmount attribute. * * @param string $chargeAmount Amount to process. If value is greater than 0 * then make the payment else create a payment token */ public function setChargeAmount($chargeAmount): self { return $this->setAttribute('chargeAmount', $chargeAmount); } /** * Add Currency attribute. * * @param string $currency Currency of the amount attribute */ public function setCurrency($currency): self { return $this->setAttribute('currency', $currency); } /** * Add Description attribute. * * @param string $description Details regarding the payment */ public function setDescription($description): self { return $this->setAttribute('description', $description); } /** * Add ValidCardTypes attribute. * * @param string[] $validCardTypes Comma separated accepted card types */ public function setValidCardTypes($validCardTypes): self { return $this->setAttribute('validCardTypes', $validCardTypes); } /** * Add Language attribute. * * @param string $language Language to use */ public function setLanguage($language): self { return $this->setAttribute('language', $language); } }src/Twilio/TwiML/Voice/SsmlP.php000064400000006045150515725700012426 0ustar00nest(new SsmlBreak($attributes)); } /** * Add Emphasis child. * * @param string $words Words to emphasize * @param array $attributes Optional attributes * @return SsmlEmphasis Child element. */ public function emphasis($words, $attributes = []): SsmlEmphasis { return $this->nest(new SsmlEmphasis($words, $attributes)); } /** * Add Lang child. * * @param string $words Words to speak * @param array $attributes Optional attributes * @return SsmlLang Child element. */ public function lang($words, $attributes = []): SsmlLang { return $this->nest(new SsmlLang($words, $attributes)); } /** * Add Phoneme child. * * @param string $words Words to speak * @param array $attributes Optional attributes * @return SsmlPhoneme Child element. */ public function phoneme($words, $attributes = []): SsmlPhoneme { return $this->nest(new SsmlPhoneme($words, $attributes)); } /** * Add Prosody child. * * @param string $words Words to speak * @param array $attributes Optional attributes * @return SsmlProsody Child element. */ public function prosody($words, $attributes = []): SsmlProsody { return $this->nest(new SsmlProsody($words, $attributes)); } /** * Add S child. * * @param string $words Words to speak * @return SsmlS Child element. */ public function s($words): SsmlS { return $this->nest(new SsmlS($words)); } /** * Add Say-As child. * * @param string $words Words to be interpreted * @param array $attributes Optional attributes * @return SsmlSayAs Child element. */ public function say_As($words, $attributes = []): SsmlSayAs { return $this->nest(new SsmlSayAs($words, $attributes)); } /** * Add Sub child. * * @param string $words Words to be substituted * @param array $attributes Optional attributes * @return SsmlSub Child element. */ public function sub($words, $attributes = []): SsmlSub { return $this->nest(new SsmlSub($words, $attributes)); } /** * Add W child. * * @param string $words Words to speak * @param array $attributes Optional attributes * @return SsmlW Child element. */ public function w($words, $attributes = []): SsmlW { return $this->nest(new SsmlW($words, $attributes)); } }src/Twilio/TwiML/Voice/Pause.php000064400000001170150515725700012437 0ustar00setAttribute('length', $length); } }src/Twilio/TwiML/Voice/Sim.php000064400000000572150515725700012117 0ustar00nest(new Client($identity, $attributes)); } /** * Add Conference child. * * @param string $name Conference name * @param array $attributes Optional attributes * @return Conference Child element. */ public function conference($name, $attributes = []): Conference { return $this->nest(new Conference($name, $attributes)); } /** * Add Number child. * * @param string $phoneNumber Phone Number to dial * @param array $attributes Optional attributes * @return Number Child element. */ public function number($phoneNumber, $attributes = []): Number { return $this->nest(new Number($phoneNumber, $attributes)); } /** * Add Queue child. * * @param string $name Queue name * @param array $attributes Optional attributes * @return Queue Child element. */ public function queue($name, $attributes = []): Queue { return $this->nest(new Queue($name, $attributes)); } /** * Add Sim child. * * @param string $simSid SIM SID * @return Sim Child element. */ public function sim($simSid): Sim { return $this->nest(new Sim($simSid)); } /** * Add Sip child. * * @param string $sipUrl SIP URL * @param array $attributes Optional attributes * @return Sip Child element. */ public function sip($sipUrl, $attributes = []): Sip { return $this->nest(new Sip($sipUrl, $attributes)); } /** * Add Action attribute. * * @param string $action Action URL */ public function setAction($action): self { return $this->setAttribute('action', $action); } /** * Add Method attribute. * * @param string $method Action URL method */ public function setMethod($method): self { return $this->setAttribute('method', $method); } /** * Add Timeout attribute. * * @param int $timeout Time to wait for answer */ public function setTimeout($timeout): self { return $this->setAttribute('timeout', $timeout); } /** * Add HangupOnStar attribute. * * @param bool $hangupOnStar Hangup call on star press */ public function setHangupOnStar($hangupOnStar): self { return $this->setAttribute('hangupOnStar', $hangupOnStar); } /** * Add TimeLimit attribute. * * @param int $timeLimit Max time length */ public function setTimeLimit($timeLimit): self { return $this->setAttribute('timeLimit', $timeLimit); } /** * Add CallerId attribute. * * @param string $callerId Caller ID to display */ public function setCallerId($callerId): self { return $this->setAttribute('callerId', $callerId); } /** * Add Record attribute. * * @param string $record Record the call */ public function setRecord($record): self { return $this->setAttribute('record', $record); } /** * Add Trim attribute. * * @param string $trim Trim the recording */ public function setTrim($trim): self { return $this->setAttribute('trim', $trim); } /** * Add RecordingStatusCallback attribute. * * @param string $recordingStatusCallback Recording status callback URL */ public function setRecordingStatusCallback($recordingStatusCallback): self { return $this->setAttribute('recordingStatusCallback', $recordingStatusCallback); } /** * Add RecordingStatusCallbackMethod attribute. * * @param string $recordingStatusCallbackMethod Recording status callback URL * method */ public function setRecordingStatusCallbackMethod($recordingStatusCallbackMethod): self { return $this->setAttribute('recordingStatusCallbackMethod', $recordingStatusCallbackMethod); } /** * Add RecordingStatusCallbackEvent attribute. * * @param string[] $recordingStatusCallbackEvent Recording status callback * events */ public function setRecordingStatusCallbackEvent($recordingStatusCallbackEvent): self { return $this->setAttribute('recordingStatusCallbackEvent', $recordingStatusCallbackEvent); } /** * Add AnswerOnBridge attribute. * * @param bool $answerOnBridge Preserve the ringing behavior of the inbound * call until the Dialed call picks up */ public function setAnswerOnBridge($answerOnBridge): self { return $this->setAttribute('answerOnBridge', $answerOnBridge); } /** * Add RingTone attribute. * * @param string $ringTone Ringtone allows you to override the ringback tone * that Twilio will play back to the caller while * executing the Dial */ public function setRingTone($ringTone): self { return $this->setAttribute('ringTone', $ringTone); } /** * Add RecordingTrack attribute. * * @param string $recordingTrack To indicate which audio track should be * recorded */ public function setRecordingTrack($recordingTrack): self { return $this->setAttribute('recordingTrack', $recordingTrack); } /** * Add Sequential attribute. * * @param bool $sequential Used to determine if child TwiML nouns should be * dialed in order, one after the other (sequential) or * dial all at once (parallel). Default is false, * parallel */ public function setSequential($sequential): self { return $this->setAttribute('sequential', $sequential); } /** * Add ReferUrl attribute. * * @param string $referUrl Webhook that will receive future SIP REFER requests */ public function setReferUrl($referUrl): self { return $this->setAttribute('referUrl', $referUrl); } /** * Add ReferMethod attribute. * * @param string $referMethod The HTTP method to use for the refer Webhook */ public function setReferMethod($referMethod): self { return $this->setAttribute('referMethod', $referMethod); } }src/Twilio/TwiML/Voice/Say.php000064400000007670150515725700012131 0ustar00nest(new SsmlBreak($attributes)); } /** * Add Emphasis child. * * @param string $words Words to emphasize * @param array $attributes Optional attributes * @return SsmlEmphasis Child element. */ public function emphasis($words, $attributes = []): SsmlEmphasis { return $this->nest(new SsmlEmphasis($words, $attributes)); } /** * Add Lang child. * * @param string $words Words to speak * @param array $attributes Optional attributes * @return SsmlLang Child element. */ public function lang($words, $attributes = []): SsmlLang { return $this->nest(new SsmlLang($words, $attributes)); } /** * Add P child. * * @param string $words Words to speak * @return SsmlP Child element. */ public function p($words): SsmlP { return $this->nest(new SsmlP($words)); } /** * Add Phoneme child. * * @param string $words Words to speak * @param array $attributes Optional attributes * @return SsmlPhoneme Child element. */ public function phoneme($words, $attributes = []): SsmlPhoneme { return $this->nest(new SsmlPhoneme($words, $attributes)); } /** * Add Prosody child. * * @param string $words Words to speak * @param array $attributes Optional attributes * @return SsmlProsody Child element. */ public function prosody($words, $attributes = []): SsmlProsody { return $this->nest(new SsmlProsody($words, $attributes)); } /** * Add S child. * * @param string $words Words to speak * @return SsmlS Child element. */ public function s($words): SsmlS { return $this->nest(new SsmlS($words)); } /** * Add Say-As child. * * @param string $words Words to be interpreted * @param array $attributes Optional attributes * @return SsmlSayAs Child element. */ public function say_As($words, $attributes = []): SsmlSayAs { return $this->nest(new SsmlSayAs($words, $attributes)); } /** * Add Sub child. * * @param string $words Words to be substituted * @param array $attributes Optional attributes * @return SsmlSub Child element. */ public function sub($words, $attributes = []): SsmlSub { return $this->nest(new SsmlSub($words, $attributes)); } /** * Add W child. * * @param string $words Words to speak * @param array $attributes Optional attributes * @return SsmlW Child element. */ public function w($words, $attributes = []): SsmlW { return $this->nest(new SsmlW($words, $attributes)); } /** * Add Voice attribute. * * @param string $voice Voice to use */ public function setVoice($voice): self { return $this->setAttribute('voice', $voice); } /** * Add Loop attribute. * * @param int $loop Times to loop message */ public function setLoop($loop): self { return $this->setAttribute('loop', $loop); } /** * Add Language attribute. * * @param string $language Message langauge */ public function setLanguage($language): self { return $this->setAttribute('language', $language); } }src/Twilio/TwiML/Voice/Echo_.php000064400000000510150515725700012374 0ustar00setAttribute('connectorName', $connectorName); } /** * Add Language attribute. * * @param string $language Language to be used by Dialogflow to transcribe * speech */ public function setLanguage($language): self { return $this->setAttribute('language', $language); } /** * Add SentimentAnalysis attribute. * * @param bool $sentimentAnalysis Whether sentiment analysis needs to be * enabled or not */ public function setSentimentAnalysis($sentimentAnalysis): self { return $this->setAttribute('sentimentAnalysis', $sentimentAnalysis); } /** * Add StatusCallback attribute. * * @param string $statusCallback URL to post status callbacks from Twilio */ public function setStatusCallback($statusCallback): self { return $this->setAttribute('statusCallback', $statusCallback); } }src/Twilio/TwiML/Voice/Prompt.php000064400000004152150515725700012646 0ustar00nest(new Say($message, $attributes)); } /** * Add Play child. * * @param string $url Media URL * @param array $attributes Optional attributes * @return Play Child element. */ public function play($url = null, $attributes = []): Play { return $this->nest(new Play($url, $attributes)); } /** * Add Pause child. * * @param array $attributes Optional attributes * @return Pause Child element. */ public function pause($attributes = []): Pause { return $this->nest(new Pause($attributes)); } /** * Add For_ attribute. * * @param string $for_ Name of the payment source data element */ public function setFor_($for_): self { return $this->setAttribute('for_', $for_); } /** * Add ErrorType attribute. * * @param string[] $errorType Type of error */ public function setErrorType($errorType): self { return $this->setAttribute('errorType', $errorType); } /** * Add CardType attribute. * * @param string[] $cardType Type of the credit card */ public function setCardType($cardType): self { return $this->setAttribute('cardType', $cardType); } /** * Add Attempt attribute. * * @param int[] $attempt Current attempt count */ public function setAttempt($attempt): self { return $this->setAttribute('attempt', $attempt); } }src/Twilio/TwiML/Voice/Room.php000064400000001463150515725700012303 0ustar00setAttribute('participantIdentity', $participantIdentity); } }src/Twilio/TwiML/Voice/Leave.php000064400000000512150515725700012415 0ustar00setAttribute('alias', $alias); } }src/Twilio/TwiML/Voice/Sms.php000064400000002776150515725700012141 0ustar00setAttribute('to', $to); } /** * Add From attribute. * * @param string $from Number to send message from */ public function setFrom($from): self { return $this->setAttribute('from', $from); } /** * Add Action attribute. * * @param string $action Action URL */ public function setAction($action): self { return $this->setAttribute('action', $action); } /** * Add Method attribute. * * @param string $method Action URL method */ public function setMethod($method): self { return $this->setAttribute('method', $method); } /** * Add StatusCallback attribute. * * @param string $statusCallback Status callback URL */ public function setStatusCallback($statusCallback): self { return $this->setAttribute('statusCallback', $statusCallback); } }src/Twilio/TwiML/Voice/Parameter.php000064400000001533150515725700013305 0ustar00setAttribute('name', $name); } /** * Add Value attribute. * * @param string $value The value of the custom parameter */ public function setValue($value): self { return $this->setAttribute('value', $value); } }src/Twilio/TwiML/Voice/Reject.php000064400000001164150515725700012601 0ustar00setAttribute('reason', $reason); } }src/Twilio/TwiML/Voice/Number.php000064400000004236150515725700012620 0ustar00setAttribute('sendDigits', $sendDigits); } /** * Add Url attribute. * * @param string $url TwiML URL */ public function setUrl($url): self { return $this->setAttribute('url', $url); } /** * Add Method attribute. * * @param string $method TwiML URL method */ public function setMethod($method): self { return $this->setAttribute('method', $method); } /** * Add StatusCallbackEvent attribute. * * @param string[] $statusCallbackEvent Events to call status callback */ public function setStatusCallbackEvent($statusCallbackEvent): self { return $this->setAttribute('statusCallbackEvent', $statusCallbackEvent); } /** * Add StatusCallback attribute. * * @param string $statusCallback Status callback URL */ public function setStatusCallback($statusCallback): self { return $this->setAttribute('statusCallback', $statusCallback); } /** * Add StatusCallbackMethod attribute. * * @param string $statusCallbackMethod Status callback URL method */ public function setStatusCallbackMethod($statusCallbackMethod): self { return $this->setAttribute('statusCallbackMethod', $statusCallbackMethod); } /** * Add Byoc attribute. * * @param string $byoc BYOC trunk SID (Beta) */ public function setByoc($byoc): self { return $this->setAttribute('byoc', $byoc); } }src/Twilio/TwiML/Voice/Hangup.php000064400000000515150515725700012606 0ustar00setAttribute('method', $method); } }src/Twilio/TwiML/Voice/Refer.php000064400000002033150515725700012424 0ustar00nest(new ReferSip($sipUrl)); } /** * Add Action attribute. * * @param string $action Action URL */ public function setAction($action): self { return $this->setAttribute('action', $action); } /** * Add Method attribute. * * @param string $method Action URL method */ public function setMethod($method): self { return $this->setAttribute('method', $method); } }src/Twilio/TwiML/Voice/SsmlProsody.php000064400000010347150515725700013666 0ustar00nest(new SsmlBreak($attributes)); } /** * Add Emphasis child. * * @param string $words Words to emphasize * @param array $attributes Optional attributes * @return SsmlEmphasis Child element. */ public function emphasis($words, $attributes = []): SsmlEmphasis { return $this->nest(new SsmlEmphasis($words, $attributes)); } /** * Add Lang child. * * @param string $words Words to speak * @param array $attributes Optional attributes * @return SsmlLang Child element. */ public function lang($words, $attributes = []): SsmlLang { return $this->nest(new SsmlLang($words, $attributes)); } /** * Add P child. * * @param string $words Words to speak * @return SsmlP Child element. */ public function p($words): SsmlP { return $this->nest(new SsmlP($words)); } /** * Add Phoneme child. * * @param string $words Words to speak * @param array $attributes Optional attributes * @return SsmlPhoneme Child element. */ public function phoneme($words, $attributes = []): SsmlPhoneme { return $this->nest(new SsmlPhoneme($words, $attributes)); } /** * Add Prosody child. * * @param string $words Words to speak * @param array $attributes Optional attributes * @return SsmlProsody Child element. */ public function prosody($words, $attributes = []): SsmlProsody { return $this->nest(new SsmlProsody($words, $attributes)); } /** * Add S child. * * @param string $words Words to speak * @return SsmlS Child element. */ public function s($words): SsmlS { return $this->nest(new SsmlS($words)); } /** * Add Say-As child. * * @param string $words Words to be interpreted * @param array $attributes Optional attributes * @return SsmlSayAs Child element. */ public function say_As($words, $attributes = []): SsmlSayAs { return $this->nest(new SsmlSayAs($words, $attributes)); } /** * Add Sub child. * * @param string $words Words to be substituted * @param array $attributes Optional attributes * @return SsmlSub Child element. */ public function sub($words, $attributes = []): SsmlSub { return $this->nest(new SsmlSub($words, $attributes)); } /** * Add W child. * * @param string $words Words to speak * @param array $attributes Optional attributes * @return SsmlW Child element. */ public function w($words, $attributes = []): SsmlW { return $this->nest(new SsmlW($words, $attributes)); } /** * Add Volume attribute. * * @param string $volume Specify the volume, available values: default, silent, * x-soft, soft, medium, loud, x-loud, +ndB, -ndB */ public function setVolume($volume): self { return $this->setAttribute('volume', $volume); } /** * Add Rate attribute. * * @param string $rate Specify the rate, available values: x-slow, slow, * medium, fast, x-fast, n% */ public function setRate($rate): self { return $this->setAttribute('rate', $rate); } /** * Add Pitch attribute. * * @param string $pitch Specify the pitch, available values: default, x-low, * low, medium, high, x-high, +n%, -n% */ public function setPitch($pitch): self { return $this->setAttribute('pitch', $pitch); } }src/Twilio/TwiML/Voice/Client.php000064400000004365150515725700012611 0ustar00nest(new Identity($clientIdentity)); } /** * Add Parameter child. * * @param array $attributes Optional attributes * @return Parameter Child element. */ public function parameter($attributes = []): Parameter { return $this->nest(new Parameter($attributes)); } /** * Add Url attribute. * * @param string $url Client URL */ public function setUrl($url): self { return $this->setAttribute('url', $url); } /** * Add Method attribute. * * @param string $method Client URL Method */ public function setMethod($method): self { return $this->setAttribute('method', $method); } /** * Add StatusCallbackEvent attribute. * * @param string[] $statusCallbackEvent Events to trigger status callback */ public function setStatusCallbackEvent($statusCallbackEvent): self { return $this->setAttribute('statusCallbackEvent', $statusCallbackEvent); } /** * Add StatusCallback attribute. * * @param string $statusCallback Status Callback URL */ public function setStatusCallback($statusCallback): self { return $this->setAttribute('statusCallback', $statusCallback); } /** * Add StatusCallbackMethod attribute. * * @param string $statusCallbackMethod Status Callback URL Method */ public function setStatusCallbackMethod($statusCallbackMethod): self { return $this->setAttribute('statusCallbackMethod', $statusCallbackMethod); } }src/Twilio/TwiML/MessagingResponse.php000064400000001762150515725700013760 0ustar00nest(new Messaging\Message($body, $attributes)); } /** * Add Redirect child. * * @param string $url Redirect URL * @param array $attributes Optional attributes * @return Messaging\Redirect Child element. */ public function redirect($url, $attributes = []): Messaging\Redirect { return $this->nest(new Messaging\Redirect($url, $attributes)); } }src/Twilio/TwiML/Fax/Receive.php000064400000003235150515725700012421 0ustar00setAttribute('action', $action); } /** * Add Method attribute. * * @param string $method Receive action URL method */ public function setMethod($method): self { return $this->setAttribute('method', $method); } /** * Add MediaType attribute. * * @param string $mediaType The media type used to store media in the fax media * store */ public function setMediaType($mediaType): self { return $this->setAttribute('mediaType', $mediaType); } /** * Add PageSize attribute. * * @param string $pageSize What size to interpret received pages as */ public function setPageSize($pageSize): self { return $this->setAttribute('pageSize', $pageSize); } /** * Add StoreMedia attribute. * * @param bool $storeMedia Whether or not to store received media in the fax * media store */ public function setStoreMedia($storeMedia): self { return $this->setAttribute('storeMedia', $storeMedia); } }src/Twilio/TwiML/TwiML.php000064400000006722150515725700011321 0ustar00name = $name; $this->attributes = $attributes; $this->children = []; if ($value !== null) { $this->children[] = $value; } } /** * Add a TwiML element. * * @param TwiML|string $twiml TwiML element to add * @return TwiML $this */ public function append($twiml): TwiML { $this->children[] = $twiml; return $this; } /** * Add a TwiML element. * * @param TwiML $twiml TwiML element to add * @return TwiML added TwiML element */ public function nest(TwiML $twiml): TwiML { $this->children[] = $twiml; return $twiml; } /** * Set TwiML attribute. * * @param string $key name of attribute * @param string $value value of attribute * @return static $this */ public function setAttribute(string $key, string $value): TwiML { $this->attributes[$key] = $value; return $this; } /** * @param string $name XML element name * @param string $value XML value * @param array $attributes XML attributes * @return TwiML */ public function addChild(string $name, string $value = null, array $attributes = []): TwiML { return $this->nest(new GenericNode($name, $value, $attributes)); } /** * Convert TwiML to XML string. * * @return string TwiML XML representation */ public function asXML(): string { return (string)$this; } /** * Convert TwiML to XML string. * * @return string TwiML XML representation */ public function __toString(): string { return $this->xml()->saveXML(); } /** * Build TwiML element. * * @param TwiML $twiml TwiML element to convert to XML * @param DOMDocument $document XML document for the element * @return DOMElement $element */ private function buildElement(TwiML $twiml, DOMDocument $document): DOMElement { $element = $document->createElement($twiml->name); foreach ($twiml->attributes as $name => $value) { if (\is_bool($value)) { $value = ($value === true) ? 'true' : 'false'; } $element->setAttribute($name, $value); } foreach ($twiml->children as $child) { if (\is_string($child)) { $element->appendChild($document->createTextNode($child)); } else { $element->appendChild($this->buildElement($child, $document)); } } return $element; } /** * Build XML element. * * @return DOMDocument Build TwiML element */ private function xml(): DOMDocument { $document = new DOMDocument('1.0', 'UTF-8'); $document->appendChild($this->buildElement($this, $document)); return $document; } } src/Twilio/TwiML/GenericNode.php000064400000000713150515725700012501 0ustar00name = $name; $this->value = $value; } } src/Twilio/TwiML/Video/Room.php000064400000000572150515725700012304 0ustar00nest(new Voice\Connect($attributes)); } /** * Add Dial child. * * @param string $number Phone number to dial * @param array $attributes Optional attributes * @return Voice\Dial Child element. */ public function dial($number = null, $attributes = []): Voice\Dial { return $this->nest(new Voice\Dial($number, $attributes)); } /** * Add Echo child. * * @return Voice\Echo_ Child element. */ public function echo_(): Voice\Echo_ { return $this->nest(new Voice\Echo_()); } /** * Add Enqueue child. * * @param string $name Friendly name * @param array $attributes Optional attributes * @return Voice\Enqueue Child element. */ public function enqueue($name = null, $attributes = []): Voice\Enqueue { return $this->nest(new Voice\Enqueue($name, $attributes)); } /** * Add Gather child. * * @param array $attributes Optional attributes * @return Voice\Gather Child element. */ public function gather($attributes = []): Voice\Gather { return $this->nest(new Voice\Gather($attributes)); } /** * Add Hangup child. * * @return Voice\Hangup Child element. */ public function hangup(): Voice\Hangup { return $this->nest(new Voice\Hangup()); } /** * Add Leave child. * * @return Voice\Leave Child element. */ public function leave(): Voice\Leave { return $this->nest(new Voice\Leave()); } /** * Add Pause child. * * @param array $attributes Optional attributes * @return Voice\Pause Child element. */ public function pause($attributes = []): Voice\Pause { return $this->nest(new Voice\Pause($attributes)); } /** * Add Play child. * * @param string $url Media URL * @param array $attributes Optional attributes * @return Voice\Play Child element. */ public function play($url = null, $attributes = []): Voice\Play { return $this->nest(new Voice\Play($url, $attributes)); } /** * Add Queue child. * * @param string $name Queue name * @param array $attributes Optional attributes * @return Voice\Queue Child element. */ public function queue($name, $attributes = []): Voice\Queue { return $this->nest(new Voice\Queue($name, $attributes)); } /** * Add Record child. * * @param array $attributes Optional attributes * @return Voice\Record Child element. */ public function record($attributes = []): Voice\Record { return $this->nest(new Voice\Record($attributes)); } /** * Add Redirect child. * * @param string $url Redirect URL * @param array $attributes Optional attributes * @return Voice\Redirect Child element. */ public function redirect($url, $attributes = []): Voice\Redirect { return $this->nest(new Voice\Redirect($url, $attributes)); } /** * Add Reject child. * * @param array $attributes Optional attributes * @return Voice\Reject Child element. */ public function reject($attributes = []): Voice\Reject { return $this->nest(new Voice\Reject($attributes)); } /** * Add Say child. * * @param string $message Message to say * @param array $attributes Optional attributes * @return Voice\Say Child element. */ public function say($message, $attributes = []): Voice\Say { return $this->nest(new Voice\Say($message, $attributes)); } /** * Add Sms child. * * @param string $message Message body * @param array $attributes Optional attributes * @return Voice\Sms Child element. */ public function sms($message, $attributes = []): Voice\Sms { return $this->nest(new Voice\Sms($message, $attributes)); } /** * Add Pay child. * * @param array $attributes Optional attributes * @return Voice\Pay Child element. */ public function pay($attributes = []): Voice\Pay { return $this->nest(new Voice\Pay($attributes)); } /** * Add Prompt child. * * @param array $attributes Optional attributes * @return Voice\Prompt Child element. */ public function prompt($attributes = []): Voice\Prompt { return $this->nest(new Voice\Prompt($attributes)); } /** * Add Start child. * * @param array $attributes Optional attributes * @return Voice\Start Child element. */ public function start($attributes = []): Voice\Start { return $this->nest(new Voice\Start($attributes)); } /** * Add Stop child. * * @return Voice\Stop Child element. */ public function stop(): Voice\Stop { return $this->nest(new Voice\Stop()); } /** * Add Refer child. * * @param array $attributes Optional attributes * @return Voice\Refer Child element. */ public function refer($attributes = []): Voice\Refer { return $this->nest(new Voice\Refer($attributes)); } }src/Twilio/Version.php000064400000016027150515725700010755 0ustar00domain = $domain; $this->version = null; } /** * Generate an absolute URL from a version relative uri * @param string $uri Version relative uri * @return string Absolute URL */ public function absoluteUrl(string $uri): string { return $this->getDomain()->absoluteUrl($this->relativeUri($uri)); } /** * Generate a domain relative uri from a version relative uri * @param string $uri Version relative uri * @return string Domain relative uri */ public function relativeUri(string $uri): string { return \trim($this->version, '/') . '/' . \trim($uri, '/'); } public function request(string $method, string $uri, array $params = [], array $data = [], array $headers = [], string $username = null, string $password = null, int $timeout = null): Response { $uri = $this->relativeUri($uri); return $this->getDomain()->request( $method, $uri, $params, $data, $headers, $username, $password, $timeout ); } /** * Create the best possible exception for the response. * * Attempts to parse the response for Twilio Standard error messages and use * those to populate the exception, falls back to generic error message and * HTTP status code. * * @param Response $response Error response * @param string $header Header for exception message * @return TwilioException */ protected function exception(Response $response, string $header): TwilioException { $message = '[HTTP ' . $response->getStatusCode() . '] ' . $header; $content = $response->getContent(); if (\is_array($content)) { $message .= isset($content['message']) ? ': ' . $content['message'] : ''; $code = isset($content['code']) ? $content['code'] : $response->getStatusCode(); $moreInfo = $content['more_info'] ?? ''; $details = $content['details'] ?? []; return new RestException($message, $code, $response->getStatusCode(), $moreInfo, $details); } return new RestException($message, $response->getStatusCode(), $response->getStatusCode()); } /** * @throws TwilioException */ public function fetch(string $method, string $uri, array $params = [], array $data = [], array $headers = [], string $username = null, string $password = null, int $timeout = null) { $response = $this->request( $method, $uri, $params, $data, $headers, $username, $password, $timeout ); // 3XX response codes are allowed here to allow for 307 redirect from Deactivations API. if ($response->getStatusCode() < 200 || $response->getStatusCode() >= 400) { throw $this->exception($response, 'Unable to fetch record'); } return $response->getContent(); } /** * @throws TwilioException */ public function update(string $method, string $uri, array $params = [], array $data = [], array $headers = [], string $username = null, string $password = null, int $timeout = null) { $response = $this->request( $method, $uri, $params, $data, $headers, $username, $password, $timeout ); if ($response->getStatusCode() < 200 || $response->getStatusCode() >= 300) { throw $this->exception($response, 'Unable to update record'); } return $response->getContent(); } /** * @throws TwilioException */ public function delete(string $method, string $uri, array $params = [], array $data = [], array $headers = [], string $username = null, string $password = null, int $timeout = null): bool { $response = $this->request( $method, $uri, $params, $data, $headers, $username, $password, $timeout ); if ($response->getStatusCode() < 200 || $response->getStatusCode() >= 300) { throw $this->exception($response, 'Unable to delete record'); } return $response->getStatusCode() === 204; } public function readLimits(int $limit = null, int $pageSize = null): array { if ($limit && $pageSize === null) { $pageSize = $limit; } $pageSize = \min($pageSize, self::MAX_PAGE_SIZE); return [ 'limit' => $limit ?: Values::NONE, 'pageSize' => $pageSize ?: Values::NONE, 'pageLimit' => Values::NONE, ]; } public function page(string $method, string $uri, array $params = [], array $data = [], array $headers = [], string $username = null, string $password = null, int $timeout = null): Response { return $this->request( $method, $uri, $params, $data, $headers, $username, $password, $timeout ); } public function stream(Page $page, $limit = null, $pageLimit = null): Stream { return new Stream($page, $limit, $pageLimit); } /** * @throws TwilioException */ public function create(string $method, string $uri, array $params = [], array $data = [], array $headers = [], string $username = null, string $password = null, int $timeout = null) { $response = $this->request( $method, $uri, $params, $data, $headers, $username, $password, $timeout ); if ($response->getStatusCode() < 200 || $response->getStatusCode() >= 300) { throw $this->exception($response, 'Unable to create record'); } return $response->getContent(); } public function getDomain(): Domain { return $this->domain; } public function __toString(): string { return '[Version]'; } } src/Twilio/Page.php000064400000013467150515725700010211 0ustar00processResponse($response); $this->version = $version; $this->payload = $payload; $this->solution = []; $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(); $details = []; $moreInfo = ''; if (\is_array($content)) { $message .= isset($content['message']) ? ': ' . $content['message'] : ''; $code = $content['code'] ?? $code; $moreInfo = $content['more_info'] ?? ''; $details = $content['details'] ?? [] ; } throw new RestException($message, $code, $response->getStatusCode(), $moreInfo, $details); } return $response->getContent(); } protected function isPagingEol(?array $content): bool { return $content !== null && \array_key_exists('code', $content) && $content['code'] === 20006; } protected function hasMeta(string $key): bool { return \array_key_exists('meta', $this->payload) && \array_key_exists($key, $this->payload['meta']); } protected function getMeta(string $key, string $default = null): ?string { return $this->hasMeta($key) ? $this->payload['meta'][$key] : $default; } protected function loadPage(): array { $key = $this->getMeta('key'); if ($key) { return $this->payload[$key]; } $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 []; } throw new DeserializeException('Page Records can not be deserialized'); } public function getPreviousPageUrl(): ?string { 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(): ?string { 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(): ?Page { 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(): ?Page { if (!$this->getPreviousPageUrl()) { return null; } $response = $this->getVersion()->getDomain()->getClient()->request('GET', $this->getPreviousPageUrl()); return new static($this->getVersion(), $response, $this->solution); } /** * (PHP 5 >= 5.0.0)
* 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 >= 5.0.0)
* Move forward to next element * @link http://php.net/manual/en/iterator.next.php * @return void Any returned value is ignored. */ public function next(): void { $this->records->next(); } /** * (PHP 5 >= 5.0.0)
* 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 >= 5.0.0)
* Checks if current position is valid * @link http://php.net/manual/en/iterator.valid.php * @return bool The return value will be casted to boolean and then evaluated. * Returns true on success or false on failure. */ public function valid(): bool { return $this->records->valid(); } /** * (PHP 5 >= 5.0.0)
* 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(): void { $this->records->rewind(); } public function getVersion(): Version { return $this->version; } public function __toString(): string { return '[Page]'; } } src/Twilio/Deserialize.php000064400000001121150515725700011555 0ustar00client = $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(string $uri): string { return \implode('/', [\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 int $timeout Request timeout * @return Response the response for the request */ public function request(string $method, string $uri, array $params = [], array $data = [], array $headers = [], string $user = null, string $password = null, int $timeout = null): Response { $url = $this->absoluteUrl($uri); return $this->client->request( $method, $url, $params, $data, $headers, $user, $password, $timeout ); } public function getClient(): Client { return $this->client; } public function __toString(): string { return '[Domain]'; } } src/Twilio/Values.php000064400000004753150515725700010572 0ustar00 $value) { if ($value !== self::NONE && $value !== self::ARRAY_NONE) { $result[$key] = $value; } } return $result; } public function __construct(array $options) { $this->options = []; foreach ($options as $key => $value) { $this->options[\strtolower($key)] = $value; } } /** * (PHP 5 >= 5.0.0)
* Whether a offset exists * @link http://php.net/manual/en/arrayaccess.offsetexists.php * @param mixed $offset

* An offset to check for. *

* @return bool true on success or false on failure. *

*

* The return value will be casted to boolean if non-boolean was returned. */ public function offsetExists($offset): bool { return true; } /** * (PHP 5 >= 5.0.0)
* Offset to retrieve * @link http://php.net/manual/en/arrayaccess.offsetget.php * @param mixed $offset

* The offset to retrieve. *

* @return mixed Can return all value types. */ public function offsetGet($offset) { $offset = \strtolower($offset); return \array_key_exists($offset, $this->options) ? $this->options[$offset] : self::NONE; } /** * (PHP 5 >= 5.0.0)
* Offset to set * @link http://php.net/manual/en/arrayaccess.offsetset.php * @param mixed $offset

* The offset to assign the value to. *

* @param mixed $value

* The value to set. *

* @return void */ public function offsetSet($offset, $value): void { $this->options[\strtolower($offset)] = $value; } /** * (PHP 5 >= 5.0.0)
* Offset to unset * @link http://php.net/manual/en/arrayaccess.offsetunset.php * @param mixed $offset

* The offset to unset. *

* @return void */ public function offsetUnset($offset): void { unset($this->options[$offset]); } } src/Twilio/VersionInfo.php000064400000000352150515725700011563 0ustar00> $GITHUB_ENV - name: Install dependencies run: composer install - name: Build & Push docker image run: make docker-build docker-push notify-on-failure: name: Slack notify on failure if: failure() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref_type == 'tag') needs: [ test, deploy ] runs-on: ubuntu-latest steps: - uses: rtCamp/action-slack-notify@v2 env: SLACK_COLOR: failure SLACK_ICON_EMOJI: ':github:' SLACK_MESSAGE: ${{ format('Tests *{0}*, Deploy *{1}*, {2}/{3}/actions/runs/{4}', needs.test.result, needs.deploy.result, github.server_url, github.repository, github.run_id) }} SLACK_TITLE: Action Failure - ${{ github.repository }} SLACK_USERNAME: GitHub Actions SLACK_MSG_AUTHOR: twilio-dx SLACK_FOOTER: Posted automatically using GitHub Actions SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} MSG_MINIMAL: true composer.json000064400000001502150515725700007273 0ustar00{ "name": "twilio/sdk", "type": "library", "description": "A PHP wrapper for Twilio's API", "keywords": ["twilio", "sms", "api"], "homepage": "http://github.com/twilio/twilio-php", "license": "MIT", "authors": [ { "name": "Twilio API Team", "email": "api@twilio.com" } ], "require": { "php": ">=7.1.0" }, "require-dev": { "guzzlehttp/guzzle": "^6.3 || ^7.0", "phpunit/phpunit": ">=4.5", "theseer/phpdox": "^0.12.0" }, "suggest": { "guzzlehttp/guzzle": "An HTTP client to execute the API requests" }, "autoload": { "psr-4": { "Twilio\\": "src/Twilio/" } }, "autoload-dev": { "psr-4": { "Twilio\\Tests\\": "tests/Twilio/" } } } CODE_OF_CONDUCT.md000064400000006263150515725700007361 0ustar00# Contributor Covenant Code of Conduct ## Our Pledge In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards Examples of behavior that contributes to creating a positive environment include: - Using welcoming and inclusive language - Being respectful of differing viewpoints and experiences - Gracefully accepting constructive criticism - Focusing on what is best for the community - Showing empathy towards other community members Examples of unacceptable behavior by participants include: - The use of sexualized language or imagery and unwelcome sexual attention or advances - Trolling, insulting/derogatory comments, and personal or political attacks - Public or private harassment - Publishing others' private information, such as a physical or electronic address, without explicit permission - Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. ## Scope This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at open-source@twilio.com. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html [homepage]: https://www.contributor-covenant.org Dockerfile000064400000000343150515725700006545 0ustar00FROM php:7.4 RUN mkdir /twilio WORKDIR /twilio COPY src src COPY composer* ./ RUN curl --silent --show-error https://getcomposer.org/installer | php RUN mv composer.phar /usr/local/bin/composer RUN composer install --no-dev