|
NAMEPithub::Result - Github v3 result objectVERSIONversion 0.01036DESCRIPTIONEvery 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.ATTRIBUTESauto_paginationIf 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}; } contentThe 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_uriThe extracted value from the "Link" header for the first page. This can return undef.last_page_uriThe extracted value from the "Link" header for the last page. This can return undef.next_page_uriThe extracted value from the "Link" header for the next page. This can return undef.prev_page_uriThe extracted value from the "Link" header for the previous page. This can return undef.responseThe HTTP::Response object.utf8This can set utf8 flag.METHODSraw_contentReturns the content of the API response as a string, it will probably be JSON.requestReturns the HTTP::Request object used to make the API call.codeReturns the HTTP code from the API call.successReturns whether the API call was successful.countReturns 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.firstReturn the first element from "content" if "content" is an arrayref. If it's a hashref, it returns just that.first_pageGet 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_pageGet 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_pageGet 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).nextMost 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_pageGet the Pithub::Result of the next page. Returns undef if there is no next page (there's only one page at all).Examples:
prev_pageGet the Pithub::Result of the previous page. Returns undef if there is no previous page (you're on the first page).Examples:
etagReturns the value of the "ETag" http header.ratelimitReturns the value of the "X-Ratelimit-Limit" http header.ratelimit_remainingReturns the value of the "X-Ratelimit-Remaining" http header.AUTHORJohannes Plunien <plu@cpan.org>COPYRIGHT AND LICENSEThis software is copyright (c) 2011-2019 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.
Visit the GSP FreeBSD Man Page Interface. |