Subiendo proyecto completo sin restricciones de git ignore

This commit is contained in:
Jose Sanchez
2023-08-17 11:44:02 -04:00
parent a0d4f5ba3b
commit 20f1c60600
19921 changed files with 2509159 additions and 45 deletions

View File

@@ -0,0 +1,58 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1;
use Twilio\Exceptions\TwilioException;
use Twilio\InstanceContext;
use Twilio\Version;
/**
* PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
*/
class ArchivedCallContext extends InstanceContext {
/**
* Initialize the ArchivedCallContext
*
* @param Version $version Version that contains the resource
* @param \DateTime $date The date of the Call in UTC.
* @param string $sid The unique string that identifies this resource
*/
public function __construct(Version $version, $date, $sid) {
parent::__construct($version);
// Path Solution
$this->solution = ['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) . ']';
}
}

View File

@@ -0,0 +1,110 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1;
use Twilio\Deserialize;
use Twilio\Exceptions\TwilioException;
use Twilio\InstanceResource;
use Twilio\Values;
use Twilio\Version;
/**
* PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
*
* @property \DateTime $date
* @property string $sid
* @property string $url
*/
class ArchivedCallInstance extends InstanceResource {
/**
* Initialize the ArchivedCallInstance
*
* @param Version $version Version that contains the resource
* @param mixed[] $payload The response payload
* @param \DateTime $date The date of the Call in UTC.
* @param string $sid The unique string that identifies this resource
*/
public function __construct(Version $version, array $payload, \DateTime $date = null, string $sid = null) {
parent::__construct($version);
// Marshaled Properties
$this->properties = [
'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) . ']';
}
}

View File

@@ -0,0 +1,49 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1;
use Twilio\ListResource;
use Twilio\Version;
/**
* PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
*/
class ArchivedCallList extends ListResource {
/**
* Construct the ArchivedCallList
*
* @param Version $version Version that contains the resource
*/
public function __construct(Version $version) {
parent::__construct($version);
// Path Solution
$this->solution = [];
}
/**
* 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]';
}
}

View File

@@ -0,0 +1,48 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1;
use Twilio\Http\Response;
use Twilio\Page;
use Twilio\Version;
/**
* PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
*/
class ArchivedCallPage extends Page {
/**
* @param Version $version Version that contains the resource
* @param Response $response Response from the API
* @param array $solution The context solution
*/
public function __construct(Version $version, Response $response, array $solution) {
parent::__construct($version, $response);
// Path Solution
$this->solution = $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]';
}
}

View File

@@ -0,0 +1,97 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1;
use Twilio\Exceptions\TwilioException;
use Twilio\InstanceContext;
use Twilio\Options;
use Twilio\Serialize;
use Twilio\Values;
use Twilio\Version;
class ByocTrunkContext extends InstanceContext {
/**
* Initialize the ByocTrunkContext
*
* @param Version $version Version that contains the resource
* @param string $sid The unique string that identifies the resource
*/
public function __construct(Version $version, $sid) {
parent::__construct($version);
// Path Solution
$this->solution = ['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) . ']';
}
}

View File

@@ -0,0 +1,146 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1;
use Twilio\Deserialize;
use Twilio\Exceptions\TwilioException;
use Twilio\InstanceResource;
use Twilio\Options;
use Twilio\Values;
use Twilio\Version;
/**
* @property string $accountSid
* @property string $sid
* @property string $friendlyName
* @property string $voiceUrl
* @property string $voiceMethod
* @property string $voiceFallbackUrl
* @property string $voiceFallbackMethod
* @property string $statusCallbackUrl
* @property string $statusCallbackMethod
* @property bool $cnamLookupEnabled
* @property string $connectionPolicySid
* @property string $fromDomainSid
* @property \DateTime $dateCreated
* @property \DateTime $dateUpdated
* @property string $url
*/
class ByocTrunkInstance extends InstanceResource {
/**
* Initialize the ByocTrunkInstance
*
* @param Version $version Version that contains the resource
* @param mixed[] $payload The response payload
* @param string $sid The unique string that identifies the resource
*/
public function __construct(Version $version, array $payload, string $sid = null) {
parent::__construct($version);
// Marshaled Properties
$this->properties = [
'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) . ']';
}
}

View File

@@ -0,0 +1,158 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1;
use Twilio\Exceptions\TwilioException;
use Twilio\ListResource;
use Twilio\Options;
use Twilio\Serialize;
use Twilio\Stream;
use Twilio\Values;
use Twilio\Version;
class ByocTrunkList extends ListResource {
/**
* Construct the ByocTrunkList
*
* @param Version $version Version that contains the resource
*/
public function __construct(Version $version) {
parent::__construct($version);
// Path Solution
$this->solution = [];
$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]';
}
}

View File

@@ -0,0 +1,385 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1;
use Twilio\Options;
use Twilio\Values;
abstract class ByocTrunkOptions {
/**
* @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 to 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 to use 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
* @return CreateByocTrunkOptions Options builder
*/
public static function create(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): CreateByocTrunkOptions {
return new CreateByocTrunkOptions($friendlyName, $voiceUrl, $voiceMethod, $voiceFallbackUrl, $voiceFallbackMethod, $statusCallbackUrl, $statusCallbackMethod, $cnamLookupEnabled, $connectionPolicySid, $fromDomainSid);
}
/**
* @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
* @return UpdateByocTrunkOptions Options builder
*/
public static function update(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): UpdateByocTrunkOptions {
return new UpdateByocTrunkOptions($friendlyName, $voiceUrl, $voiceMethod, $voiceFallbackUrl, $voiceFallbackMethod, $statusCallbackUrl, $statusCallbackMethod, $cnamLookupEnabled, $connectionPolicySid, $fromDomainSid);
}
}
class CreateByocTrunkOptions 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 to 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 to use 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`. 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 . ']';
}
}

View File

@@ -0,0 +1,45 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1;
use Twilio\Http\Response;
use Twilio\Page;
use Twilio\Version;
class ByocTrunkPage extends Page {
/**
* @param Version $version Version that contains the resource
* @param Response $response Response from the API
* @param array $solution The context solution
*/
public function __construct(Version $version, Response $response, array $solution) {
parent::__construct($version, $response);
// Path Solution
$this->solution = $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]';
}
}

View File

@@ -0,0 +1,104 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1\ConnectionPolicy;
use Twilio\Exceptions\TwilioException;
use Twilio\InstanceContext;
use Twilio\Options;
use Twilio\Serialize;
use Twilio\Values;
use Twilio\Version;
class ConnectionPolicyTargetContext extends InstanceContext {
/**
* Initialize the ConnectionPolicyTargetContext
*
* @param Version $version Version that contains the resource
* @param string $connectionPolicySid The SID of the Connection Policy that
* owns the Target
* @param string $sid The unique string that identifies the resource
*/
public function __construct(Version $version, $connectionPolicySid, $sid) {
parent::__construct($version);
// Path Solution
$this->solution = ['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) . ']';
}
}

View File

@@ -0,0 +1,148 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1\ConnectionPolicy;
use Twilio\Deserialize;
use Twilio\Exceptions\TwilioException;
use Twilio\InstanceResource;
use Twilio\Options;
use Twilio\Values;
use Twilio\Version;
/**
* @property string $accountSid
* @property string $connectionPolicySid
* @property string $sid
* @property string $friendlyName
* @property string $target
* @property int $priority
* @property int $weight
* @property bool $enabled
* @property \DateTime $dateCreated
* @property \DateTime $dateUpdated
* @property string $url
*/
class ConnectionPolicyTargetInstance extends InstanceResource {
/**
* Initialize the ConnectionPolicyTargetInstance
*
* @param Version $version Version that contains the resource
* @param mixed[] $payload The response payload
* @param string $connectionPolicySid The SID of the Connection Policy that
* owns the Target
* @param string $sid The unique string that identifies the resource
*/
public function __construct(Version $version, array $payload, string $connectionPolicySid, string $sid = null) {
parent::__construct($version);
// Marshaled Properties
$this->properties = [
'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) . ']';
}
}

View File

@@ -0,0 +1,167 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1\ConnectionPolicy;
use Twilio\Exceptions\TwilioException;
use Twilio\ListResource;
use Twilio\Options;
use Twilio\Serialize;
use Twilio\Stream;
use Twilio\Values;
use Twilio\Version;
class ConnectionPolicyTargetList extends ListResource {
/**
* Construct the ConnectionPolicyTargetList
*
* @param Version $version Version that contains the resource
* @param string $connectionPolicySid The SID of the Connection Policy that
* owns the Target
*/
public function __construct(Version $version, string $connectionPolicySid) {
parent::__construct($version);
// Path Solution
$this->solution = ['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]';
}
}

View File

@@ -0,0 +1,195 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1\ConnectionPolicy;
use Twilio\Options;
use Twilio\Values;
abstract class ConnectionPolicyTargetOptions {
/**
* @param string $friendlyName A string to describe the resource
* @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
* @return CreateConnectionPolicyTargetOptions Options builder
*/
public static function create(string $friendlyName = Values::NONE, int $priority = Values::NONE, int $weight = Values::NONE, bool $enabled = Values::NONE): CreateConnectionPolicyTargetOptions {
return new CreateConnectionPolicyTargetOptions($friendlyName, $priority, $weight, $enabled);
}
/**
* @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
* @return UpdateConnectionPolicyTargetOptions Options builder
*/
public static function update(string $friendlyName = Values::NONE, string $target = Values::NONE, int $priority = Values::NONE, int $weight = Values::NONE, bool $enabled = Values::NONE): UpdateConnectionPolicyTargetOptions {
return new UpdateConnectionPolicyTargetOptions($friendlyName, $target, $priority, $weight, $enabled);
}
}
class CreateConnectionPolicyTargetOptions extends Options {
/**
* @param string $friendlyName A string to describe the resource
* @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, int $priority = Values::NONE, int $weight = Values::NONE, bool $enabled = Values::NONE) {
$this->options['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 . ']';
}
}

View File

@@ -0,0 +1,49 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1\ConnectionPolicy;
use Twilio\Http\Response;
use Twilio\Page;
use Twilio\Version;
class ConnectionPolicyTargetPage extends Page {
/**
* @param Version $version Version that contains the resource
* @param Response $response Response from the API
* @param array $solution The context solution
*/
public function __construct(Version $version, Response $response, array $solution) {
parent::__construct($version, $response);
// Path Solution
$this->solution = $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]';
}
}

View File

@@ -0,0 +1,137 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1;
use Twilio\Exceptions\TwilioException;
use Twilio\InstanceContext;
use Twilio\ListResource;
use Twilio\Options;
use Twilio\Rest\Voice\V1\ConnectionPolicy\ConnectionPolicyTargetList;
use Twilio\Values;
use Twilio\Version;
/**
* @property ConnectionPolicyTargetList $targets
* @method \Twilio\Rest\Voice\V1\ConnectionPolicy\ConnectionPolicyTargetContext targets(string $sid)
*/
class ConnectionPolicyContext extends InstanceContext {
protected $_targets;
/**
* Initialize the ConnectionPolicyContext
*
* @param Version $version Version that contains the resource
* @param string $sid The unique string that identifies the resource
*/
public function __construct(Version $version, $sid) {
parent::__construct($version);
// Path Solution
$this->solution = ['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) . ']';
}
}

View File

@@ -0,0 +1,140 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1;
use Twilio\Deserialize;
use Twilio\Exceptions\TwilioException;
use Twilio\InstanceResource;
use Twilio\Options;
use Twilio\Rest\Voice\V1\ConnectionPolicy\ConnectionPolicyTargetList;
use Twilio\Values;
use Twilio\Version;
/**
* @property string $accountSid
* @property string $sid
* @property string $friendlyName
* @property \DateTime $dateCreated
* @property \DateTime $dateUpdated
* @property string $url
* @property array $links
*/
class ConnectionPolicyInstance extends InstanceResource {
protected $_targets;
/**
* Initialize the ConnectionPolicyInstance
*
* @param Version $version Version that contains the resource
* @param mixed[] $payload The response payload
* @param string $sid The unique string that identifies the resource
*/
public function __construct(Version $version, array $payload, string $sid = null) {
parent::__construct($version);
// Marshaled Properties
$this->properties = [
'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) . ']';
}
}

View File

@@ -0,0 +1,146 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1;
use Twilio\Exceptions\TwilioException;
use Twilio\ListResource;
use Twilio\Options;
use Twilio\Stream;
use Twilio\Values;
use Twilio\Version;
class ConnectionPolicyList extends ListResource {
/**
* Construct the ConnectionPolicyList
*
* @param Version $version Version that contains the resource
*/
public function __construct(Version $version) {
parent::__construct($version);
// Path Solution
$this->solution = [];
$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]';
}
}

View File

@@ -0,0 +1,91 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1;
use Twilio\Options;
use Twilio\Values;
abstract class ConnectionPolicyOptions {
/**
* @param string $friendlyName A string to describe the resource
* @return CreateConnectionPolicyOptions Options builder
*/
public static function create(string $friendlyName = Values::NONE): CreateConnectionPolicyOptions {
return new CreateConnectionPolicyOptions($friendlyName);
}
/**
* @param string $friendlyName A string to describe the resource
* @return UpdateConnectionPolicyOptions Options builder
*/
public static function update(string $friendlyName = Values::NONE): UpdateConnectionPolicyOptions {
return new UpdateConnectionPolicyOptions($friendlyName);
}
}
class CreateConnectionPolicyOptions 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.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 . ']';
}
}

View File

@@ -0,0 +1,45 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1;
use Twilio\Http\Response;
use Twilio\Page;
use Twilio\Version;
class ConnectionPolicyPage extends Page {
/**
* @param Version $version Version that contains the resource
* @param Response $response Response from the API
* @param array $solution The context solution
*/
public function __construct(Version $version, Response $response, array $solution) {
parent::__construct($version, $response);
// Path Solution
$this->solution = $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]';
}
}

View File

@@ -0,0 +1,70 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1\DialingPermissions;
use Twilio\Exceptions\TwilioException;
use Twilio\InstanceResource;
use Twilio\Values;
use Twilio\Version;
/**
* PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
*
* @property int $updateCount
* @property string $updateRequest
*/
class BulkCountryUpdateInstance extends InstanceResource {
/**
* Initialize the BulkCountryUpdateInstance
*
* @param Version $version Version that contains the resource
* @param mixed[] $payload The response payload
*/
public function __construct(Version $version, array $payload) {
parent::__construct($version);
// Marshaled Properties
$this->properties = [
'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]';
}
}

View File

@@ -0,0 +1,58 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1\DialingPermissions;
use Twilio\Exceptions\TwilioException;
use Twilio\ListResource;
use Twilio\Values;
use Twilio\Version;
/**
* PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
*/
class BulkCountryUpdateList extends ListResource {
/**
* Construct the BulkCountryUpdateList
*
* @param Version $version Version that contains the resource
*/
public function __construct(Version $version) {
parent::__construct($version);
// Path Solution
$this->solution = [];
$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]';
}
}

View File

@@ -0,0 +1,48 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1\DialingPermissions;
use Twilio\Http\Response;
use Twilio\Page;
use Twilio\Version;
/**
* PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
*/
class BulkCountryUpdatePage extends Page {
/**
* @param Version $version Version that contains the resource
* @param Response $response Response from the API
* @param array $solution The context solution
*/
public function __construct(Version $version, Response $response, array $solution) {
parent::__construct($version, $response);
// Path Solution
$this->solution = $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]';
}
}

View File

@@ -0,0 +1,67 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1\DialingPermissions\Country;
use Twilio\Exceptions\TwilioException;
use Twilio\InstanceResource;
use Twilio\Values;
use Twilio\Version;
/**
* PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
*
* @property string $prefix
*/
class HighriskSpecialPrefixInstance extends InstanceResource {
/**
* Initialize the HighriskSpecialPrefixInstance
*
* @param Version $version Version that contains the resource
* @param mixed[] $payload The response payload
* @param string $isoCode The ISO country code
*/
public function __construct(Version $version, array $payload, string $isoCode) {
parent::__construct($version);
// Marshaled Properties
$this->properties = ['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]';
}
}

View File

@@ -0,0 +1,124 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1\DialingPermissions\Country;
use Twilio\ListResource;
use Twilio\Stream;
use Twilio\Values;
use Twilio\Version;
/**
* PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
*/
class HighriskSpecialPrefixList extends ListResource {
/**
* Construct the HighriskSpecialPrefixList
*
* @param Version $version Version that contains the resource
* @param string $isoCode The ISO country code
*/
public function __construct(Version $version, string $isoCode) {
parent::__construct($version);
// Path Solution
$this->solution = ['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]';
}
}

View File

@@ -0,0 +1,48 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1\DialingPermissions\Country;
use Twilio\Http\Response;
use Twilio\Page;
use Twilio\Version;
/**
* PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
*/
class HighriskSpecialPrefixPage extends Page {
/**
* @param Version $version Version that contains the resource
* @param Response $response Response from the API
* @param array $solution The context solution
*/
public function __construct(Version $version, Response $response, array $solution) {
parent::__construct($version, $response);
// Path Solution
$this->solution = $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]';
}
}

View File

@@ -0,0 +1,113 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1\DialingPermissions;
use Twilio\Exceptions\TwilioException;
use Twilio\InstanceContext;
use Twilio\ListResource;
use Twilio\Rest\Voice\V1\DialingPermissions\Country\HighriskSpecialPrefixList;
use Twilio\Values;
use Twilio\Version;
/**
* PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
*
* @property HighriskSpecialPrefixList $highriskSpecialPrefixes
*/
class CountryContext extends InstanceContext {
protected $_highriskSpecialPrefixes;
/**
* Initialize the CountryContext
*
* @param Version $version Version that contains the resource
* @param string $isoCode The ISO country code
*/
public function __construct(Version $version, $isoCode) {
parent::__construct($version);
// Path Solution
$this->solution = ['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) . ']';
}
}

View File

@@ -0,0 +1,123 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1\DialingPermissions;
use Twilio\Exceptions\TwilioException;
use Twilio\InstanceResource;
use Twilio\Rest\Voice\V1\DialingPermissions\Country\HighriskSpecialPrefixList;
use Twilio\Values;
use Twilio\Version;
/**
* PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
*
* @property string $isoCode
* @property string $name
* @property string $continent
* @property string[] $countryCodes
* @property bool $lowRiskNumbersEnabled
* @property bool $highRiskSpecialNumbersEnabled
* @property bool $highRiskTollfraudNumbersEnabled
* @property string $url
* @property array $links
*/
class CountryInstance extends InstanceResource {
protected $_highriskSpecialPrefixes;
/**
* Initialize the CountryInstance
*
* @param Version $version Version that contains the resource
* @param mixed[] $payload The response payload
* @param string $isoCode The ISO country code
*/
public function __construct(Version $version, array $payload, string $isoCode = null) {
parent::__construct($version);
// Marshaled Properties
$this->properties = [
'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) . ']';
}
}

View File

@@ -0,0 +1,147 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1\DialingPermissions;
use Twilio\ListResource;
use Twilio\Options;
use Twilio\Serialize;
use Twilio\Stream;
use Twilio\Values;
use Twilio\Version;
/**
* PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
*/
class CountryList extends ListResource {
/**
* Construct the CountryList
*
* @param Version $version Version that contains the resource
*/
public function __construct(Version $version) {
parent::__construct($version);
// Path Solution
$this->solution = [];
$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]';
}
}

View File

@@ -0,0 +1,156 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1\DialingPermissions;
use Twilio\Options;
use Twilio\Values;
/**
* PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
*/
abstract class CountryOptions {
/**
* @param string $isoCode Filter to retrieve the country permissions by
* specifying the ISO country code
* @param string $continent Filter to retrieve the country permissions by
* specifying the continent
* @param string $countryCode Country code filter
* @param bool $lowRiskNumbersEnabled Filter to retrieve the country
* permissions with dialing to low-risk
* numbers enabled
* @param bool $highRiskSpecialNumbersEnabled Filter to retrieve the country
* permissions with dialing to
* high-risk special service numbers
* enabled
* @param bool $highRiskTollfraudNumbersEnabled Filter to retrieve the country
* permissions with dialing to
* high-risk toll fraud numbers
* enabled
* @return ReadCountryOptions Options builder
*/
public static function read(string $isoCode = Values::NONE, string $continent = Values::NONE, string $countryCode = Values::NONE, bool $lowRiskNumbersEnabled = Values::NONE, bool $highRiskSpecialNumbersEnabled = Values::NONE, bool $highRiskTollfraudNumbersEnabled = Values::NONE): ReadCountryOptions {
return new ReadCountryOptions($isoCode, $continent, $countryCode, $lowRiskNumbersEnabled, $highRiskSpecialNumbersEnabled, $highRiskTollfraudNumbersEnabled);
}
}
class ReadCountryOptions extends Options {
/**
* @param string $isoCode Filter to retrieve the country permissions by
* specifying the ISO country code
* @param string $continent Filter to retrieve the country permissions by
* specifying the continent
* @param string $countryCode Country code filter
* @param bool $lowRiskNumbersEnabled Filter to retrieve the country
* permissions with dialing to low-risk
* numbers enabled
* @param bool $highRiskSpecialNumbersEnabled Filter to retrieve the country
* permissions with dialing to
* high-risk special service numbers
* enabled
* @param bool $highRiskTollfraudNumbersEnabled Filter to retrieve the country
* permissions with dialing to
* high-risk toll fraud numbers
* enabled
*/
public function __construct(string $isoCode = Values::NONE, string $continent = Values::NONE, string $countryCode = Values::NONE, bool $lowRiskNumbersEnabled = Values::NONE, bool $highRiskSpecialNumbersEnabled = Values::NONE, bool $highRiskTollfraudNumbersEnabled = Values::NONE) {
$this->options['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 . ']';
}
}

View File

@@ -0,0 +1,48 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1\DialingPermissions;
use Twilio\Http\Response;
use Twilio\Page;
use Twilio\Version;
/**
* PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
*/
class CountryPage extends Page {
/**
* @param Version $version Version that contains the resource
* @param Response $response Response from the API
* @param array $solution The context solution
*/
public function __construct(Version $version, Response $response, array $solution) {
parent::__construct($version, $response);
// Path Solution
$this->solution = $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]';
}
}

View File

@@ -0,0 +1,80 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1\DialingPermissions;
use Twilio\Exceptions\TwilioException;
use Twilio\InstanceContext;
use Twilio\Options;
use Twilio\Serialize;
use Twilio\Values;
use Twilio\Version;
/**
* PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
*/
class SettingsContext extends InstanceContext {
/**
* Initialize the SettingsContext
*
* @param Version $version Version that contains the resource
*/
public function __construct(Version $version) {
parent::__construct($version);
// Path Solution
$this->solution = [];
$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) . ']';
}
}

View File

@@ -0,0 +1,110 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1\DialingPermissions;
use Twilio\Exceptions\TwilioException;
use Twilio\InstanceResource;
use Twilio\Options;
use Twilio\Values;
use Twilio\Version;
/**
* PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
*
* @property bool $dialingPermissionsInheritance
* @property string $url
*/
class SettingsInstance extends InstanceResource {
/**
* Initialize the SettingsInstance
*
* @param Version $version Version that contains the resource
* @param mixed[] $payload The response payload
*/
public function __construct(Version $version, array $payload) {
parent::__construct($version);
// Marshaled Properties
$this->properties = [
'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) . ']';
}
}

View File

@@ -0,0 +1,46 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1\DialingPermissions;
use Twilio\ListResource;
use Twilio\Version;
/**
* PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
*/
class SettingsList extends ListResource {
/**
* Construct the SettingsList
*
* @param Version $version Version that contains the resource
*/
public function __construct(Version $version) {
parent::__construct($version);
// Path Solution
$this->solution = [];
}
/**
* 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]';
}
}

View File

@@ -0,0 +1,65 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1\DialingPermissions;
use Twilio\Options;
use Twilio\Values;
/**
* PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
*/
abstract class SettingsOptions {
/**
* @param bool $dialingPermissionsInheritance `true` for the sub-account to
* inherit voice dialing permissions
* from the Master Project;
* otherwise `false`
* @return UpdateSettingsOptions Options builder
*/
public static function update(bool $dialingPermissionsInheritance = Values::NONE): UpdateSettingsOptions {
return new UpdateSettingsOptions($dialingPermissionsInheritance);
}
}
class UpdateSettingsOptions extends Options {
/**
* @param bool $dialingPermissionsInheritance `true` for the sub-account to
* inherit voice dialing permissions
* from the Master Project;
* otherwise `false`
*/
public function __construct(bool $dialingPermissionsInheritance = Values::NONE) {
$this->options['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 . ']';
}
}

View File

@@ -0,0 +1,48 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1\DialingPermissions;
use Twilio\Http\Response;
use Twilio\Page;
use Twilio\Version;
/**
* PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
*/
class SettingsPage extends Page {
/**
* @param Version $version Version that contains the resource
* @param Response $response Response from the API
* @param array $solution The context solution
*/
public function __construct(Version $version, Response $response, array $solution) {
parent::__construct($version, $response);
// Path Solution
$this->solution = $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]';
}
}

View File

@@ -0,0 +1,61 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1;
use Twilio\Exceptions\TwilioException;
use Twilio\InstanceResource;
use Twilio\Values;
use Twilio\Version;
/**
* PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
*/
class DialingPermissionsInstance extends InstanceResource {
/**
* Initialize the DialingPermissionsInstance
*
* @param Version $version Version that contains the resource
* @param mixed[] $payload The response payload
*/
public function __construct(Version $version, array $payload) {
parent::__construct($version);
$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.DialingPermissionsInstance]';
}
}

View File

@@ -0,0 +1,120 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1;
use Twilio\Exceptions\TwilioException;
use Twilio\InstanceContext;
use Twilio\ListResource;
use Twilio\Rest\Voice\V1\DialingPermissions\BulkCountryUpdateList;
use Twilio\Rest\Voice\V1\DialingPermissions\CountryList;
use Twilio\Rest\Voice\V1\DialingPermissions\SettingsList;
use Twilio\Version;
/**
* PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
*
* @property CountryList $countries
* @property SettingsList $settings
* @property BulkCountryUpdateList $bulkCountryUpdates
* @method \Twilio\Rest\Voice\V1\DialingPermissions\CountryContext countries(string $isoCode)
* @method \Twilio\Rest\Voice\V1\DialingPermissions\SettingsContext settings()
*/
class DialingPermissionsList extends ListResource {
protected $_countries = null;
protected $_settings = null;
protected $_bulkCountryUpdates = null;
/**
* Construct the DialingPermissionsList
*
* @param Version $version Version that contains the resource
*/
public function __construct(Version $version) {
parent::__construct($version);
// Path Solution
$this->solution = [];
}
/**
* 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]';
}
}

View File

@@ -0,0 +1,48 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1;
use Twilio\Http\Response;
use Twilio\Page;
use Twilio\Version;
/**
* PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
*/
class DialingPermissionsPage extends Page {
/**
* @param Version $version Version that contains the resource
* @param Response $response Response from the API
* @param array $solution The context solution
*/
public function __construct(Version $version, Response $response, array $solution) {
parent::__construct($version, $response);
// Path Solution
$this->solution = $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]';
}
}

View File

@@ -0,0 +1,85 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1;
use Twilio\Exceptions\TwilioException;
use Twilio\InstanceContext;
use Twilio\Options;
use Twilio\Values;
use Twilio\Version;
class IpRecordContext extends InstanceContext {
/**
* Initialize the IpRecordContext
*
* @param Version $version Version that contains the resource
* @param string $sid The unique string that identifies the resource
*/
public function __construct(Version $version, $sid) {
parent::__construct($version);
// Path Solution
$this->solution = ['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) . ']';
}
}

View File

@@ -0,0 +1,132 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1;
use Twilio\Deserialize;
use Twilio\Exceptions\TwilioException;
use Twilio\InstanceResource;
use Twilio\Options;
use Twilio\Values;
use Twilio\Version;
/**
* @property string $accountSid
* @property string $sid
* @property string $friendlyName
* @property string $ipAddress
* @property int $cidrPrefixLength
* @property \DateTime $dateCreated
* @property \DateTime $dateUpdated
* @property string $url
*/
class IpRecordInstance extends InstanceResource {
/**
* Initialize the IpRecordInstance
*
* @param Version $version Version that contains the resource
* @param mixed[] $payload The response payload
* @param string $sid The unique string that identifies the resource
*/
public function __construct(Version $version, array $payload, string $sid = null) {
parent::__construct($version);
// Marshaled Properties
$this->properties = [
'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) . ']';
}
}

View File

@@ -0,0 +1,151 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1;
use Twilio\Exceptions\TwilioException;
use Twilio\ListResource;
use Twilio\Options;
use Twilio\Stream;
use Twilio\Values;
use Twilio\Version;
class IpRecordList extends ListResource {
/**
* Construct the IpRecordList
*
* @param Version $version Version that contains the resource
*/
public function __construct(Version $version) {
parent::__construct($version);
// Path Solution
$this->solution = [];
$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]';
}
}

View File

@@ -0,0 +1,117 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1;
use Twilio\Options;
use Twilio\Values;
abstract class IpRecordOptions {
/**
* @param string $friendlyName A string to describe the resource
* @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 CreateIpRecordOptions Options builder
*/
public static function create(string $friendlyName = Values::NONE, int $cidrPrefixLength = Values::NONE): CreateIpRecordOptions {
return new CreateIpRecordOptions($friendlyName, $cidrPrefixLength);
}
/**
* @param string $friendlyName A string to describe the resource
* @return UpdateIpRecordOptions Options builder
*/
public static function update(string $friendlyName = Values::NONE): UpdateIpRecordOptions {
return new UpdateIpRecordOptions($friendlyName);
}
}
class CreateIpRecordOptions extends Options {
/**
* @param string $friendlyName A string to describe the resource
* @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.
*/
public function __construct(string $friendlyName = Values::NONE, int $cidrPrefixLength = Values::NONE) {
$this->options['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 . ']';
}
}

View File

@@ -0,0 +1,45 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1;
use Twilio\Http\Response;
use Twilio\Page;
use Twilio\Version;
class IpRecordPage extends Page {
/**
* @param Version $version Version that contains the resource
* @param Response $response Response from the API
* @param array $solution The context solution
*/
public function __construct(Version $version, Response $response, array $solution) {
parent::__construct($version, $response);
// Path Solution
$this->solution = $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]';
}
}

View File

@@ -0,0 +1,82 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1;
use Twilio\Exceptions\TwilioException;
use Twilio\InstanceContext;
use Twilio\Values;
use Twilio\Version;
class SourceIpMappingContext extends InstanceContext {
/**
* Initialize the SourceIpMappingContext
*
* @param Version $version Version that contains the resource
* @param string $sid The unique string that identifies the resource
*/
public function __construct(Version $version, $sid) {
parent::__construct($version);
// Path Solution
$this->solution = ['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) . ']';
}
}

View File

@@ -0,0 +1,127 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1;
use Twilio\Deserialize;
use Twilio\Exceptions\TwilioException;
use Twilio\InstanceResource;
use Twilio\Values;
use Twilio\Version;
/**
* @property string $sid
* @property string $ipRecordSid
* @property string $sipDomainSid
* @property \DateTime $dateCreated
* @property \DateTime $dateUpdated
* @property string $url
*/
class SourceIpMappingInstance extends InstanceResource {
/**
* Initialize the SourceIpMappingInstance
*
* @param Version $version Version that contains the resource
* @param mixed[] $payload The response payload
* @param string $sid The unique string that identifies the resource
*/
public function __construct(Version $version, array $payload, string $sid = null) {
parent::__construct($version);
// Marshaled Properties
$this->properties = [
'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) . ']';
}
}

View File

@@ -0,0 +1,144 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1;
use Twilio\Exceptions\TwilioException;
use Twilio\ListResource;
use Twilio\Stream;
use Twilio\Values;
use Twilio\Version;
class SourceIpMappingList extends ListResource {
/**
* Construct the SourceIpMappingList
*
* @param Version $version Version that contains the resource
*/
public function __construct(Version $version) {
parent::__construct($version);
// Path Solution
$this->solution = [];
$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]';
}
}

View File

@@ -0,0 +1,45 @@
<?php
/**
* This code was generated by
* \ / _ _ _| _ _
* | (_)\/(_)(_|\/| |(/_ v1.0.0
* / /
*/
namespace Twilio\Rest\Voice\V1;
use Twilio\Http\Response;
use Twilio\Page;
use Twilio\Version;
class SourceIpMappingPage extends Page {
/**
* @param Version $version Version that contains the resource
* @param Response $response Response from the API
* @param array $solution The context solution
*/
public function __construct(Version $version, Response $response, array $solution) {
parent::__construct($version, $response);
// Path Solution
$this->solution = $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]';
}
}