Scroll to navigation

Net::GitHub::V3::Repos(3pm) User Contributed Perl Documentation Net::GitHub::V3::Repos(3pm)

NAME

Net::GitHub::V3::Repos - GitHub Repos API

SYNOPSIS

    use Net::GitHub::V3;
    my $gh = Net::GitHub::V3->new; # read L<Net::GitHub::V3> to set right authentication info
    my $repos = $gh->repos;
    
    # set :user/:repo for simple calls
    $repos->set_default_user_repo('fayland', 'perl-net-github');
    my @contributors = $repos->contributors; # don't need pass user and repos

DESCRIPTION

METHODS

Repos
<http://developer.github.com/v3/repos/>
list
list_user
list_org
    my @rp = $repos->list; # or my $rp = $repos->list;
    my @rp = $repos->list('private');
    my @rp = $repos->list_user('c9s');
    my @rp = $repos->list_user('c9s', 'member');
    my @rp = $repos->list_org('perlchina');
    my @rp = $repos->list_org('perlchina', 'public');
    
create
    # create for yourself
    my $rp = $repos->create( {
        "name" => "Hello-World",
        "description" => "This is your first repo",
        "homepage" => "https://github.com"
    } );
    # create for organization
    my $rp = $repos->create( {
        "org"  => "perlchina", ## the organization
        "name" => "Hello-World",
        "description" => "This is your first repo",
        "homepage" => "https://github.com"
    } );
    
get
    my $rp = $repos->get('fayland', 'perl-net-github');
    
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'); # take effects for all $gh->
    $repos->set_default_user_repo('fayland', 'perl-net-github'); # only take effect to $gh->repos
    my @contributors = $repos->contributors;
2. If it is just for once, we can pass :user, :repo before any arguments
    my @contributors = $repos->contributors($user, $repo);
update
    $repos->update({ homepage => 'https://metacpan.org/module/Net::GitHub' });
    
contributors
languages
teams
tags
contributors
    my @contributors = $repos->contributors;
    my @languages = $repos->languages;
    my @teams = $repos->teams;
    my @tags = $repos->tags;
    my @branches = $repos->branches;
    
Repo Collaborators API
<http://developer.github.com/v3/repos/collaborators/>
collaborators
is_collaborator
add_collaborator
delete_collaborator
    my @collaborators = $repos->collaborators;
    my $is = $repos->is_collaborator('fayland');
    $repos->add_collaborator('fayland');
    $repos->delete_collaborator('fayland');
    
Commits API
<http://developer.github.com/v3/repos/commits/>
commits
commit
    my @commits = $repos->commits;
    my $commit  = $repos->commit($sha);
    
comments
commit_comments
create_comment
comment
update_comment
delete_comment
    my @comments = $repos->comments;
    my @comments = $repos->commit_comments($sha);
    my $comment  = $repos->create_comment($sha, {
        "body" => "Nice change",
        "commit_id" => "6dcb09b5b57875f334f61aebed695e2e4193db5e",
        "line" => 1,
        "path" => "file1.txt",
        "position" => 4
    });
    my $comment = $repos->comment($comment_id);
    my $comment = $repos->update_comment($comment_id, {
        "body" => "Nice change"
    });
    my $st = $repos->delete_comment($comment_id);
    
compare_commits
    my $diffs = $repos->compare_commits($base, $head);
    
Downloads
<http://developer.github.com/v3/repos/downloads/>
downloads
download
delete_download
    my @downloads = $repos->downloads;
    my $download  = $repos->download($download_id);
    my $st = $repos->delete_download($download_id);
    
create_download
upload_download
    my $download = $repos->create_download( {
        "name" => "new_file.jpg",
        "size" => 114034,
        "description" => "Latest release",
        "content_type" => "text/plain"
    } );
    my $st = $repos->upload_download($download, "/path/to/new_file.jpg");
    
    # or batch it
    my $st = $repos->create_download( {
        "name" => "new_file.jpg",
        "size" => 114034,
        "description" => "Latest release",
        "content_type" => "text/plain",
        file => '/path/to/new_file.jpg',
    } );
    
Forks API
<http://developer.github.com/v3/repos/forks/>
forks
create_fork
    my @forks = $repos->forks;
    my $fork = $repos->create_fork;
    my $fork = $repos->create_fork($org);
    
Repos Deploy Keys API
<http://developer.github.com/v3/repos/keys/>
keys
key
create_key
update_key
delete_key
    my @keys = $repos->keys;
    my $key  = $repos->key($key_id); # get key
    $repos->create_key( {
        title => 'title',
        key   => $key
    } );
    $repos->update_key($key_id, {
        title => $title,
        key   => $key
    });
    $repos->delete_key($key_id);
    
Repo Watching API
<http://developer.github.com/v3/repos/watching/>
watchers
    my @watchers = $repos->watchers;
    
watched
    my @repos = $repos->watched; # what I watched
    my @repos = $repos->watched('c9s');
    
is_watching
    my $is_watching = $repos->is_watching;
    my $is_watching = $repos->is_watching('fayland', 'perl-net-github');
    
watch
unwatch
    my $st = $repos->watch();
    my $st = $repos->watch('fayland', 'perl-net-github');
    my $st = $repos->unwatch();
    my $st = $repos->unwatch('fayland', 'perl-net-github');
    
Hooks API
<http://developer.github.com/v3/repos/hooks/>
hooks
hook
create_hook
update_hook
test_hook
delete_hook
    my @hooks = $repos->hooks;
    my $hook  = $repos->hook($hook_id);
    my $hook  = $repos->create_hook($hook_hash);
    my $hook  = $repos->update_hook($hook_id, $new_hook_hash);
    my $st    = $repos->test_hook($hook_id);
    my $st    = $repos->delete_hook($hook_id);
    

AUTHOR & COPYRIGHT & LICENSE

Refer Net::GitHub
2012-03-22 perl v5.14.2