.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Net::GitHub::V3 3pm" .TH Net::GitHub::V3 3pm "2014-09-11" "perl v5.20.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Net::GitHub::V3 \- Github API v3 .SH "SYNOPSIS" .IX Header "SYNOPSIS" Prefer: .PP .Vb 7 \& use Net::GitHub; \& my $gh = Net::GitHub\->new( \& version => 3, \& login => \*(Aqfayland\*(Aq, pass => \*(Aqmypass\*(Aq, \& # or \& # access_token => $oauth_token \& ); .Ve .PP Or: .PP .Vb 6 \& use Net::GitHub::V3; \& my $gh = Net::GitHub::V3\->new( \& login => \*(Aqfayland\*(Aq, pass => \*(Aqmypass\*(Aq, \& # or \& # access_token => $oauth_token \& ); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" .SS "\s-1ATTRIBUTES\s0" .IX Subsection "ATTRIBUTES" \fIAuthentication\fR .IX Subsection "Authentication" .PP There are two ways to authenticate through GitHub \s-1API\s0 v3: .IP "login/pass" 4 .IX Item "login/pass" .Vb 1 \& my $gh = Net::GitHub::V3\->new( login => $ENV{GITHUB_USER}, pass => $ENV{GITHUB_PASS} ); .Ve .IP "access_token" 4 .IX Item "access_token" .Vb 1 \& my $gh = Net::GitHub\->new( access_token => $ENV{GITHUB_ACCESS_TOKEN} ); .Ve .PP \fIraw_response\fR .IX Subsection "raw_response" .PP .Vb 4 \& my $gh = Net::GitHub\->new( \& # login/pass or access_token \& raw_response => 1 \& ); .Ve .PP return raw HTTP::Response object .PP \fIraw_string\fR .IX Subsection "raw_string" .PP .Vb 4 \& my $gh = Net::GitHub\->new( \& # login/pass or access_token \& raw_string => 1 \& ); .Ve .PP return HTTP::Response response content as string .PP \fIapi_throttle\fR .IX Subsection "api_throttle" .PP .Vb 4 \& my $gh = Net::GitHub\->new( \& # login/pass or access_token \& api_throttle => 0 \& ); .Ve .PP To disable call rate limiting (e.g. if your account is whitelisted), set \fBapi_throttle\fR to 0. .PP \fIRaiseError\fR .IX Subsection "RaiseError" .PP By default, error responses are propagated to the user as they are received from the \s-1API.\s0 By switching \fBRaiseError\fR on you can make the be turned into exceptions instead, so that you don't have to check for error response after every call. .PP \fInext_url, last_url, prev_url, first_url\fR .IX Subsection "next_url, last_url, prev_url, first_url" .PP Any methods which return multiple results \fImay\fR be paginated. After performing a query you should check to see if there are more results. These attributes will be reset for each query. .PP The predicates to check these attributes are \f(CW\*(C`has_next_page\*(C'\fR, \f(CW\*(C`has_last_page\*(C'\fR, \&\f(CW\*(C`has_prev_page\*(C'\fR and \f(CW\*(C`has_first_page\*(C'\fR. .PP See Github's documentation: .PP The \f(CW\*(C`per_page\*(C'\fR parameter mentioned in their docs is \fB\s-1NOT\s0\fR supported by this module. .PP .Vb 6 \& my @issues = $gh\->issue\->repos_issues; \& while ($gh\->issue\->has_next_page) { \& push @issues, $gh\->issue\->query($gh\->issue\->next_url); \& ## OR ## \& push @issues, $gh\->issue\->next_page; \& } .Ve .PP \fIua\fR .IX Subsection "ua" .PP To set the proxy for ua, you can do something like following .PP .Vb 1 \& $gh\->ua\->proxy(\*(Aqhttps\*(Aq, \*(Aqsocks://127.0.0.1:9050\*(Aq); .Ve .PP \&\f(CW$gh\fR\->ua is an instance of LWP::UserAgent .SS "\s-1METHODS\s0" .IX Subsection "METHODS" \fIquery($method, \f(CI$url\fI, \f(CI$data\fI)\fR .IX Subsection "query($method, $url, $data)" .PP .Vb 3 \& my $data = $gh\->query(\*(Aq/user\*(Aq); \& $gh\->query(\*(AqPATCH\*(Aq, \*(Aq/user\*(Aq, $data); \& $gh\->query(\*(AqDELETE\*(Aq, \*(Aq/user/emails\*(Aq, [ \*(Aqmyemail@somewhere.com\*(Aq ]); .Ve .PP query \s-1API\s0 directly .PP \fInext_page\fR .IX Subsection "next_page" .PP When the results have been paginated, \f(CW\*(C`next_page\*(C'\fR is sugar for the common case of iterating through all the pages in order. It simply calls \f(CW\*(C`query\*(C'\fR with the \f(CW\*(C`next_url\*(C'\fR. .PP \fIset_default_user_repo\fR .IX Subsection "set_default_user_repo" .PP .Vb 2 \& $gh\->set_default_user_repo(\*(Aqfayland\*(Aq, \*(Aqperl\-net\-github\*(Aq); # take effects for all $gh\-> \& $gh\->repos\->set_default_user_repo(\*(Aqfayland\*(Aq, \*(Aqperl\-net\-github\*(Aq); # take effects on $gh\->repos .Ve .PP \&\fBTo ease the keyboard, we provided two ways to call any method which starts with :user/:repo\fR .PP 1. \s-1SET\s0 user/repos before call methods below .PP .Vb 2 \& $gh\->set_default_user_repo(\*(Aqfayland\*(Aq, \*(Aqperl\-net\-github\*(Aq); \& my @contributors = $gh\->repos\->contributors; .Ve .PP 2. If it is just for once, we can pass :user, :repo before any arguments .PP .Vb 1 \& my @contributors = $repos\->contributors($user, $repo); .Ve .SS "\s-1MODULES\s0" .IX Subsection "MODULES" \fIuser\fR .IX Subsection "user" .PP .Vb 2 \& my $user = $gh\->user\->show(\*(Aqnothingmuch\*(Aq); \& $gh\->user\->update( bio => \*(AqJust Another Perl Programmer\*(Aq ); .Ve .PP Net::GitHub::V3::Users .PP \fIrepos\fR .IX Subsection "repos" .PP .Vb 6 \& my @repos = $gh\->repos\->list; \& my $rp = $gh\->repos\->create( { \& "name" => "Hello\-World", \& "description" => "This is your first repo", \& "homepage" => "https://github.com" \& } ); .Ve .PP Net::GitHub::V3::Repos .PP \fIissue\fR .IX Subsection "issue" .PP .Vb 2 \& my @issues = $gh\->issue\->issues(); \& my $issue = $gh\->issue\->issue($issue_id); .Ve .PP Net::GitHub::V3::Issues .PP \fIpull_request\fR .IX Subsection "pull_request" .PP .Vb 1 \& my @pulls = $gh\->pull_request\->pulls(); .Ve .PP Net::GitHub::V3::PullRequests .PP \fIorg\fR .IX Subsection "org" .PP .Vb 1 \& my @orgs = $gh\->org\->orgs; .Ve .PP Net::GitHub::V3::Orgs .PP \fIgit_data\fR .IX Subsection "git_data" .PP Net::GitHub::V3::GitData .PP \fIgist\fR .IX Subsection "gist" .PP Net::GitHub::V3::Gists .PP \fIoauth\fR .IX Subsection "oauth" .PP Net::GitHub::V3::OAuth .PP \fIevent\fR .IX Subsection "event" .PP Net::GitHub::V3::Events .PP \fIsearch\fR .IX Subsection "search" .PP Net::GitHub::V3::Search .SH "SEE ALSO" .IX Header "SEE ALSO" Pithub .SH "AUTHOR & COPYRIGHT & LICENSE" .IX Header "AUTHOR & COPYRIGHT & LICENSE" Refer Net::GitHub