GitLab...inator(3pm)

πŸ’– GitLab::API::v4::Paginator β€” the 3pm page bestie πŸ’–

okay so real talk, this is the GitLab::API::v4::Paginator page from the User Contributed Perl Documentation, and it's literally just the little goblin that walks you through paginated GitLab v4 API records. page by page. record by record. no cap. πŸ¦‹


✨ NAME ✨

GitLab::API::v4::Paginator β€” iterate through paginated GitLab v4 API records. that's it, that's the whole job. πŸ’…


🌸 DESCRIPTION 🌸

so, bestie, there should be no need to create objects of this type directly. like, none. instead use "paginator" in GitLab::API::v4 which simplifies things a bit. it's giving "let the nice wrapper handle it" energy. πŸŽ€


πŸ‘‘ 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. those are the rules, periodt. ✨

api

the GitLab::API::v4 object. your main character. πŸ‘‘


🧚 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. so like, everything except that one thing. πŸ’œ

params

the \%params hash ref argument. yep. that's the one. πŸ“


πŸ”₯ METHODS πŸ”₯

next_page

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

returns an array ref of records for the next page. one page at a time, bestie, we love a slow reveal. 🌈

next

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

returns the next record in the current page. and if all records have been exhausted then "next_page" will automatically be called. so if you wanna ignore pagination entirely you can literally just call "next" over and over again to walk through all the records. obsessed with the convenience ngl. 😭✨

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. it ate and left no crumbs. πŸ”₯

reset

$paginator->reset();

reset the paginator back to its original state on the first page with no records retrieved yet. a little refresh, a little glow-up, a little back-to-square-one moment. πŸ’…πŸ¦‹


🫢 SUPPORT 🫢

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


πŸ’– AUTHORS πŸ’–

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


πŸ“œ LICENSE πŸ“œ

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


and that's the whole page, bestie!! πŸ’– this little love letter was baked with perl v5.36.0 and dated 2023-06-13, so shoutout to that exact vintage. stay paginated, stay iconic, iykyk. πŸŽ€βœ¨πŸ’œ

πŸ“¦ where this page comes from