NAME

GitLab::API::v4::Paginator - Iterate through paginated GitLab v4 API records.

DESCRIPTION

There should be no need to create objects of this type directly, instead use "paginator" in GitLab::API::v4 which simplifies things a bit.

REQUIRED ARGUMENTS

method

The name of the method subroutine to call on the "api" object to get records from.

This method must accept a hash ref of parameters as the last argument, adhere to the page and per_page parameters, and return an array ref.

api

The GitLab::API::v4 object.

OPTIONAL ARGUMENTS

args

The arguments to use when calling the "method", the same arguments you would use when you call the method yourself on the "api" object, minus the \%params hash ref.

params

The \%params hash ref argument.

METHODS

next_page

while (my $records = $paginator->next_page()) { ... }

Returns an array ref of records for the next page.

next

while (my $record = $paginator->next()) { ... }

Returns the next record in the current page. If all records have been exhausted then "next_page" will automatically be called. This way if you want to ignore pagination you can just call next over and over again to walk through all the records.

all

my $records = $paginator->all();

This is just an alias for calling "next_page" over and over again to build an array ref of all records.

reset

$paginator->reset();

Reset the paginator back to its original state on the first page with no records retrieved yet.

SUPPORT

See "SUPPORT" in GitLab::API::v4.

AUTHORS

See "AUTHORS" in GitLab::API::v4.

LICENSE

See "LICENSE" in GitLab::API::v4.