Provided by: libpithub-perl_0.01021-1_all bug

NAME

       Pithub::Result - Github v3 result object

VERSION

       version 0.01021

DESCRIPTION

       Every method call which maps directly to a Github API call returns a Pithub::Result
       object. Once you got the result object, you can set attributes on them or call methods.

ATTRIBUTES

   auto_pagination
       If you set this to true and use the "next" method to iterate over the result rows, it will
       call automatically "next_page" for you until you got all the results. Be careful using
       this feature, if there are 100 pages, this will make 100 API calls.  By default it's off.
       Instead of setting it per Pithub::Result you can also set it directly on any of the Pithub
       API objects.

       Examples:

           my $r = Pithub::Repos->new;
           my $result = $r->list( user => 'rjbs' );

           # This would just show the first 30 by default
           while ( my $row = $result->next ) {
               printf "%s: %s\n", $row->{name}, $row->{description};
           }

           # Let's do the same thing using auto_pagination to fetch all
           $result = $r->list( user => 'rjbs' );
           $result->auto_pagination(1);
           while ( my $row = $result->next ) {
               printf "%s: %s\n", $row->{name}, $row->{description};
           }

           # Turn auto_pagination on for all L<Pithub::Result> objects
           my $p = Pithub::Repos->new( auto_pagination => 1 );
           my $result = $p->list( user => 'rjbs' );
           while ( my $row = $result->next ) {
               printf "%s: %s\n", $row->{name}, $row->{description};
           }

   content
       The decoded JSON response. May be an arrayref or hashref, depending on the API call. For
       some calls there is no content at all.

   first_page_uri
       The extracted value from the "Link" header for the first page.  This can return undef.

   last_page_uri
       The extracted value from the "Link" header for the last page.  This can return undef.

   next_page_uri
       The extracted value from the "Link" header for the next page.  This can return undef.

   prev_page_uri
       The extracted value from the "Link" header for the previous page. This can return undef.

   response
       The HTTP::Response object.

METHODS

   count
       Returns the count of the elements in "content". If the result is not an arrayref but a
       hashref, it will still return 1. Some calls return an empty hashref, for those calls it
       returns 0.

   first
       Return the first element from "content" if "content" is an arrayref. If it's a hashref, it
       returns just that.

   first_page
       Get the Pithub::Result of the first page. Returns undef if there is no first page (if
       you're on the first page already or if there is no pages at all).

   get_page
       Get the Pithub::Result for a specific page. The parameter is not validated, if you hit a
       page that does not exist, the Github API will tell you so. If there is only one page, this
       method will return undef, no matter which page you ask for, even for page 1.

   last_page
       Get the Pithub::Result of the last page. Returns undef if there is no last page (if you're
       on the last page already or if there is only one page or no pages at all).

   next
       Most of the results returned by the Github API calls are arrayrefs of hashrefs. The data
       structures can be retrieved directly by calling "content". Besides that it's possible to
       iterate over the results using this method.

       Examples:

           my $r = Pithub::Repos->new;
           my $result = $r->list( user => 'rjbs' );

           while ( my $row = $result->next ) {
               printf "%s: %s\n", $row->{name}, $row->{description};
           }

   next_page
       Get the Pithub::Result of the next page. Returns undef if there is no next page (there's
       only one page at all).

       Examples:

       •   List all followers in order, from the first one on the first page to the last one on
           the last page. See also "auto_pagination".

               my $followers = Pithub->new->users->followers;
               my $result = $followers->list( user => 'rjbs' );
               do {
                   if ( $result->success ) {
                       while ( my $row = $result->next ) {
                           printf "%s\n", $row->{login};
                       }
                   }
               } while $result = $result->next_page;

           The nature of the implementation requires you here to do a "do { ... } while ..."
           loop. If you're going to fetch all results of all pages, I suggest to use the
           "auto_pagination" feature, it's much more convenient.

   prev_page
       Get the Pithub::Result of the previous page. Returns undef if there is no previous page
       (you're on the first page).

       Examples:

       •   List all followers in reverse order, from the last one on the last page to the first
           one on the first page. See also "auto_pagination".

               my $followers = Pithub->new->users->followers;
               my $result = $followers->list( user => 'rjbs' )->last_page;    # this makes two requests!
               do {
                   if ( $result->success ) {
                       while ( my $row = $result->next ) {
                           printf "%s\n", $row->{login};
                       }
                   }
               } while $result = $result->prev_page;

   ratelimit
       Returns the value of the "X-Ratelimit-Limit" http header.

   ratelimit_remaining
       Returns the value of the "X-Ratelimit-Remaining" http header.

AUTHOR

       Johannes Plunien <plu@cpan.org>

COPYRIGHT AND LICENSE

       This software is copyright (c) 2011 by Johannes Plunien.

       This is free software; you can redistribute it and/or modify it under the same terms as
       the Perl 5 programming language system itself.