The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::GitHub::V3 - Github API v3

SYNOPSIS

Prefer:

    use Net::GitHub;
    my $gh = Net::GitHub->new(
        version => 3,
        login => 'fayland', pass => 'mypass',
        # or
        # access_token => $oauth_token
    );

Or:

    use Net::GitHub::V3;
    my $gh = Net::GitHub::V3->new(
        login => 'fayland', pass => 'mypass',
        # or
        # access_token => $oauth_token
    );

DESCRIPTION

http://develop.github.com/

ATTRIBUTES

Authentication

There are two ways to authenticate through GitHub API v3:

login/pass
    my $gh = Net::GitHub::V3->new( login => $ENV{GITHUB_USER}, pass => $ENV{GITHUB_PASS} );
    
access_token
    my $gh = Net::GitHub->new( access_token => $ENV{GITHUB_ACCESS_TOKEN} );

raw_response

    my $gh = Net::GitHub->new(
        # login/pass or access_token
        raw_response => 1
    );

return raw HTTP::Response object

raw_string

    my $gh = Net::GitHub->new(
        # login/pass or access_token
        raw_string => 1
    );
    

return HTTP::Response response content as string

api_throttle

    my $gh = Net::GitHub->new(
        # login/pass or access_token
        api_throttle => 0
    );

To disable call rate limiting (e.g. if your account is whitelisted), set api_throttle to 0.

RaiseError

By default, error responses are propagated to the user as they are received from the API. By switching RaiseError on you can make the be turned into exceptions instead, so that you don't have to check for error response after every call.

METHODS

query($method, $url, $data)

    my $data = $gh->query('/user');
    $gh->query('PATCH', '/user', $data);
    $gh->query('DELETE', '/user/emails', [ 'myemail@somewhere.com' ]);

query API directly

set_default_user_repo

    $gh->set_default_user_repo('fayland', 'perl-net-github'); # take effects for all $gh->
    $gh->repos->set_default_user_repo('fayland', 'perl-net-github'); # take effects on $gh->repos

To ease the keyboard, we provied two ways to call any method which starts with :user/:repo

1. SET user/repos before call methods below

    $gh->set_default_user_repo('fayland', 'perl-net-github');
    my @contributors = $gh->repos->contributors;

2. If it is just for once, we can pass :user, :repo before any arguments

    my @contributors = $repos->contributors($user, $repo);

MODULES

user

    my $user = $gh->user->show('nothingmuch');
    $gh->user->update( bio => 'Just Another Perl Programmer' );

Net::GitHub::V3::Users

repos

    my @repos = $gh->repos->list;
    my $rp = $gh->repos->create( {
        "name" => "Hello-World",
        "description" => "This is your first repo",
        "homepage" => "https://github.com"
    } );

Net::GitHub::V3::Repos

issue

    my @issues = $gh->issue->issues();
    my $issue  = $gh->issue->issue($issue_id);

Net::GitHub::V3::Issues

pull_request

    my @pulls = $gh->pull_request->pulls();

Net::GitHub::V3::PullRequests

org

    my @orgs   = $gh->org->orgs;
    

Net::GitHub::V3::Orgs

git_data

Net::GitHub::V3::GitData

gist

Net::GitHub::V3::Gists

SEE ALSO

Any::Moose, Pithub

AUTHOR & COPYRIGHT & LICENSE

Refer Net::GitHub