NAME

Twilio::TokenPaginationPage - A page of records from an API that pages by token

SYNOPSIS

my $page = $list->page({}, 50);

while ($page) {
  say $_->sid for $page->records;
  $page = $page->next_page;
}

DESCRIPTION

The newer Twilio APIs answer with meta.nextToken and meta.previousToken instead of a URL. This class builds that URL from the last request, keeping its other parameters, so it works like any Twilio::Page. Generated pages inherit from it, and each one implements build_instance.

A record that is not a hash reference reaches build_instance as { id => $record }.

METHODS

See Twilio::Page for the inherited methods.

new

my $page = $class->new($version, $response, \%solution);

instance_for

my $instance = $page->instance_for($record);

Returns the instance for one record, as described above.

get_next_page_url

get_previous_page_url

Return the URL of that page, or nothing when there is none. A token equal to the one that fetched this page counts as none, because a server that repeats itself would otherwise keep a Twilio::Stream reading forever.

They throw Twilio::Exceptions::TwilioException when the HTTP client did not record the last request, as Twilio::Http::Client does, because ending the list there would hide records.

LICENSE

Copyright (c) 2026 Francisco Zarabozo. Released under the MIT License.