.\" 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::Repos 3pm" .TH Net::GitHub::V3::Repos 3pm "2014-06-27" "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::Repos \- GitHub Repos API .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Net::GitHub::V3; \& \& my $gh = Net::GitHub::V3\->new; # read L to set right authentication info \& my $repos = $gh\->repos; \& \& # set :user/:repo for simple calls \& $repos\->set_default_user_repo(\*(Aqfayland\*(Aq, \*(Aqperl\-net\-github\*(Aq); \& my @contributors = $repos\->contributors; # don\*(Aqt need pass user and repos .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" .SS "\s-1METHODS\s0" .IX Subsection "METHODS" \fIRepos\fR .IX Subsection "Repos" .PP .IP "list" 4 .IX Item "list" .PD 0 .IP "list_all" 4 .IX Item "list_all" .PD .Vb 4 \& # All public repositories on Github \& my @rp = $repos\->list_all; \& # starting at id 500 \& my @rp = $repos\->list_all(500); .Ve .IP "list_user" 4 .IX Item "list_user" .PD 0 .IP "list_org" 4 .IX Item "list_org" .PD .Vb 11 \& my @rp = $repos\->list; # or my $rp = $repos\->list; \& my @rp = $repos\->list({ \& type => \*(Aqprivate\*(Aq \& sort => \*(Aqupdated\*(Aq \& }); \& my @rp = $repos\->list_user(\*(Aqc9s\*(Aq); \& my @rp = $repos\->list_user(\*(Aqc9s\*(Aq, { \& type => \*(Aqmember\*(Aq \& }); \& my @rp = $repos\->list_org(\*(Aqperlchina\*(Aq); \& my @rp = $repos\->list_org(\*(Aqperlchina\*(Aq, \*(Aqpublic\*(Aq); .Ve .IP "create" 4 .IX Item "create" .Vb 10 \& # 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" \& } ); .Ve .IP "get" 4 .IX Item "get" .Vb 1 \& my $rp = $repos\->get(\*(Aqfayland\*(Aq, \*(Aqperl\-net\-github\*(Aq); .Ve .PP \&\fBTo ease the keyboard, we provied 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 3 \& $gh\->set_default_user_repo(\*(Aqfayland\*(Aq, \*(Aqperl\-net\-github\*(Aq); # take effects for all $gh\-> \& $repos\->set_default_user_repo(\*(Aqfayland\*(Aq, \*(Aqperl\-net\-github\*(Aq); # only take effect to $gh\->repos \& my @contributors = $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 .IP "update" 4 .IX Item "update" .Vb 1 \& $repos\->update({ homepage => \*(Aqhttps://metacpan.org/module/Net::GitHub\*(Aq }); .Ve .IP "delete" 4 .IX Item "delete" .Vb 1 \& $repos\->delete(); .Ve .IP "contributors" 4 .IX Item "contributors" .PD 0 .IP "languages" 4 .IX Item "languages" .IP "teams" 4 .IX Item "teams" .IP "tags" 4 .IX Item "tags" .IP "contributors" 4 .IX Item "contributors" .PD .Vb 6 \& my @contributors = $repos\->contributors; \& my @languages = $repos\->languages; \& my @teams = $repos\->teams; \& my @tags = $repos\->tags; \& my @branches = $repos\->branches; \& my $branch = $repos\->branch(\*(Aqmaster\*(Aq); .Ve .PP \fIRepo Collaborators \s-1API\s0\fR .IX Subsection "Repo Collaborators API" .PP .IP "collaborators" 4 .IX Item "collaborators" .PD 0 .IP "is_collaborator" 4 .IX Item "is_collaborator" .IP "add_collaborator" 4 .IX Item "add_collaborator" .IP "delete_collaborator" 4 .IX Item "delete_collaborator" .PD .Vb 4 \& my @collaborators = $repos\->collaborators; \& my $is = $repos\->is_collaborator(\*(Aqfayland\*(Aq); \& $repos\->add_collaborator(\*(Aqfayland\*(Aq); \& $repos\->delete_collaborator(\*(Aqfayland\*(Aq); .Ve .PP \fICommits \s-1API\s0\fR .IX Subsection "Commits API" .PP .IP "commits" 4 .IX Item "commits" .PD 0 .IP "commit" 4 .IX Item "commit" .PD .Vb 5 \& my @commits = $repos\->commits; \& my @commits = $repos\->commits({ \& author => \*(Aqfayland\*(Aq \& }); \& my $commit = $repos\->commit($sha); .Ve .IP "comments" 4 .IX Item "comments" .PD 0 .IP "commit_comments" 4 .IX Item "commit_comments" .IP "create_comment" 4 .IX Item "create_comment" .IP "comment" 4 .IX Item "comment" .IP "update_comment" 4 .IX Item "update_comment" .IP "delete_comment" 4 .IX Item "delete_comment" .PD .Vb 10 \& 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); .Ve .IP "compare_commits" 4 .IX Item "compare_commits" .Vb 1 \& my $diffs = $repos\->compare_commits($base, $head); .Ve .PP \fIForks \s-1API\s0\fR .IX Subsection "Forks API" .PP .IP "forks" 4 .IX Item "forks" .PD 0 .IP "create_fork" 4 .IX Item "create_fork" .PD .Vb 3 \& my @forks = $repos\->forks; \& my $fork = $repos\->create_fork; \& my $fork = $repos\->create_fork($org); .Ve .PP \fIRepos Deploy Keys \s-1API\s0\fR .IX Subsection "Repos Deploy Keys API" .PP .IP "keys" 4 .IX Item "keys" .PD 0 .IP "key" 4 .IX Item "key" .IP "create_key" 4 .IX Item "create_key" .IP "update_key" 4 .IX Item "update_key" .IP "delete_key" 4 .IX Item "delete_key" .PD .Vb 11 \& my @keys = $repos\->keys; \& my $key = $repos\->key($key_id); # get key \& $repos\->create_key( { \& title => \*(Aqtitle\*(Aq, \& key => $key \& } ); \& $repos\->update_key($key_id, { \& title => $title, \& key => $key \& }); \& $repos\->delete_key($key_id); .Ve .PP \fIRepo Watching \s-1API\s0\fR .IX Subsection "Repo Watching API" .PP .IP "watchers" 4 .IX Item "watchers" .Vb 1 \& my @watchers = $repos\->watchers; .Ve .IP "watched" 4 .IX Item "watched" .Vb 2 \& my @repos = $repos\->watched; # what I watched \& my @repos = $repos\->watched(\*(Aqc9s\*(Aq); .Ve .IP "is_watching" 4 .IX Item "is_watching" .Vb 2 \& my $is_watching = $repos\->is_watching; \& my $is_watching = $repos\->is_watching(\*(Aqfayland\*(Aq, \*(Aqperl\-net\-github\*(Aq); .Ve .IP "watch" 4 .IX Item "watch" .PD 0 .IP "unwatch" 4 .IX Item "unwatch" .PD .Vb 4 \& my $st = $repos\->watch(); \& my $st = $repos\->watch(\*(Aqfayland\*(Aq, \*(Aqperl\-net\-github\*(Aq); \& my $st = $repos\->unwatch(); \& my $st = $repos\->unwatch(\*(Aqfayland\*(Aq, \*(Aqperl\-net\-github\*(Aq); .Ve .PP \fISubscriptions\fR .IX Subsection "Subscriptions" .PP Github changed the ideas of Watchers (stars) and Subscriptions (new watchers). .PP .Vb 1 \& https://github.com/blog/1204\-notifications\-stars .Ve .PP The Watchers code in this module predates the terminology change, so the new Watcher methods use the GitHub 'subscription' terminology. .IP "subscribers" 4 .IX Item "subscribers" Returns a list of subscriber data hashes. .IP "is_subscribed" 4 .IX Item "is_subscribed" Returns true or false if you are subscribed .Sp .Vb 2 \& $repos\->is_subscribed(); \& $repos\->is_subscribed(\*(Aqfayland\*(Aq,\*(Aqperl\-net\-github\*(Aq); .Ve .IP "subscription" 4 .IX Item "subscription" Returns more information about your subscription to a repo. is_subscribed is a shortcut to calling this and checking for subscribed => 1. .IP "subscribe" 4 .IX Item "subscribe" Required argument telling github if you want to subscribe or if you want to ignore mentions. If you want to change from subscribed to ignores you need to unsubscribe first. .Sp .Vb 2 \& $repos\->subscribe(\*(Aqfayland\*(Aq,\*(Aqperl\-net\-github\*(Aq, { subscribed => 1 }) \& $repos\->subscribe(\*(Aqfayland\*(Aq,\*(Aqperl\-net\-github\*(Aq, { ignored => 1 }) .Ve .IP "unsubscribe" 4 .IX Item "unsubscribe" .Vb 1 \& $repos\->unsubscribe(\*(Aqfayland\*(Aq,\*(Aqperl\-net\-github\*(Aq); .Ve .PP \fIHooks \s-1API\s0\fR .IX Subsection "Hooks API" .PP .IP "hooks" 4 .IX Item "hooks" .PD 0 .IP "hook" 4 .IX Item "hook" .IP "create_hook" 4 .IX Item "create_hook" .IP "update_hook" 4 .IX Item "update_hook" .IP "test_hook" 4 .IX Item "test_hook" .IP "delete_hook" 4 .IX Item "delete_hook" .PD .Vb 6 \& 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); .Ve .PP \fIRepo Merging \s-1API\s0\fR .IX Subsection "Repo Merging API" .PP .IP "merges" 4 .IX Item "merges" .Vb 5 \& my $status = $repos\->merges( { \& "base" => "master", \& "head" => "cool_feature", \& "commit_message" => "Shipped cool_feature!" \& } ); .Ve .PP \fIRepo Statuses \s-1API\s0\fR .IX Subsection "Repo Statuses API" .PP .IP "list_statuses" 4 .IX Item "list_statuses" .Vb 1 \& my @statuses = $repos\->list_statuses($sha1); .Ve .IP "create_status" 4 .IX Item "create_status" .Vb 5 \& my $status = $repos\->create_status( { \& "state" => "success", \& "target_url" => "https://example.com/build/status", \& "description" => "The build succeeded!" \& } ); .Ve .PP \fIRepo Releases \s-1API\s0\fR .IX Subsection "Repo Releases API" .PP .IP "releases" 4 .IX Item "releases" .Vb 1 \& my @releases = $repos\->releases(); .Ve .IP "release" 4 .IX Item "release" .Vb 1 \& my $release = $repos\->release($release_id); .Ve .IP "create_release" 4 .IX Item "create_release" .Vb 7 \& my $release = $repos\->create_release({ \& "tag_name" => "v1.0.0", \& "target_commitish" => "master", \& "name" => "v1.0.0", \& "body" => "Description of the release", \& "draft" => \e1, \& }); .Ve .IP "update_release" 4 .IX Item "update_release" .Vb 6 \& my $release = $repos\->update_release($release_id, { \& "tag_name" => "v1.0.0", \& "target_commitish" => "master", \& "name" => "v1.0.0", \& "body" => "Description of the release", \& }); .Ve .IP "delete_release" 4 .IX Item "delete_release" .Vb 1 \& $repos\->delete_release($release_id); .Ve .IP "release_assets" 4 .IX Item "release_assets" .Vb 1 \& my @release_assets = $repos\->release_assets($release_id); .Ve .IP "upload_asset" 4 .IX Item "upload_asset" .Vb 1 \& my $asset = $repos\->upload_asset($release_id, $name, $content_type, $file_content); .Ve .Sp Check examples/upload_asset.pl for a working example. .IP "release_asset" 4 .IX Item "release_asset" .Vb 1 \& my $release_asset = $repos\->release_asset($release_id, $asset_id); .Ve .IP "update_release_asset" 4 .IX Item "update_release_asset" .Vb 4 \& my $release_asset = $repos\->update_release_asset($release_id, $asset_id, { \& name" => "foo\-1.0.0\-osx.zip", \& "label" => "Mac binary" \& }); .Ve .IP "delete_release_asset" 4 .IX Item "delete_release_asset" .Vb 1 \& my $ok = $repos\->delete_release_asset($release_id, $asset_id); .Ve .SH "AUTHOR & COPYRIGHT & LICENSE" .IX Header "AUTHOR & COPYRIGHT & LICENSE" Refer Net::GitHub