NAME
Twilio::Version - Base class for one version of a Twilio API
SYNOPSIS
package Twilio::Rest::Api::V2010;
use parent 'Twilio::Version';
sub new {
my ($class, $domain) = @_;
my $self = $class->SUPER::new($domain);
$self->{version} = '2010-04-01';
return $self;
}
DESCRIPTION
A version adds its path to the URLs of a Twilio::Domain, and turns error responses into exceptions. Subclasses set version in their constructor. Applications reach versions through Twilio::Rest::Client and do not use this class directly.
METHODS
new
my $version = Twilio::Version->new($domain);
absolute_url
my $url = $version->absolute_url('/Accounts.json');
Returns the URL for a path in this version.
relative_uri
my $uri = $version->relative_uri('/Accounts.json');
Returns the path with the version added, such as 2010-04-01/Accounts.json.
request
my $response = $version->request($method, $uri, \%options);
Sends a request for a path in this version. The options are those of "request" in Twilio::Http::Client.
handle_request
my $response = $version->handle_request($method, $uri, 'create', \%options);
Sends a request like "request" and throws Twilio::Exceptions::RestException on a status below 200 or from 400 up. The third argument names the operation in the message, as in [HTTP 404] Unable to fetch record: Not found.
exception
my $error = $version->exception($response, 'Unable to fetch record');
Returns a Twilio::Exceptions::RestException for an error response, without throwing it. It uses Twilio's code, message, more_info and details when the body has them, and the HTTP status code otherwise. A body in the RFC 9457 form gives a Twilio::Exceptions::TwilioServiceException instead.
read_limits
my $limits = $version->read_limits($limit, $page_size);
Returns a hash reference with limit, page_size and page_limit. Without a page size, a limit is also used as the page size, so that a small limit does not download a full page. The page size is capped at 1000, the largest Twilio returns. Values of zero mean no limit, and are returned as undef.
page
my $response = $version->page($method, $uri, \%options);
Sends the request for a page of results, and returns the response.
stream
my $stream = $version->stream($page, $limit, $page_limit);
Returns a Twilio::Stream that starts at $page.
get_domain
Returns the Twilio::Domain.
get_version
Returns the version path, such as 2010-04-01.
LICENSE
Copyright (c) 2026 Francisco Zarabozo. Released under the MIT License.