Net::G...equests(3pm)
π NAME π
Net::GitHub::V3::PullRequests β the GitHub Pull Requests API, bestie. Pull requests. Reviews. Comments. The whole vibe. This page is part of the User Contributed Perl Documentation, so like, community-made, we love that for us π«Ά
β¨ SYNOPSIS β¨
okay so first you gotta manifest the object into existence:
use Net::GitHub::V3;
my $gh = Net::GitHub::V3->new; # read L<Net::GitHub::V3> to set right authentication info
my $pull_request = $gh->pull_request;
tiny heads-up bestie: go read Net::GitHub::V3 so you actually set your authentication info right, otherwise the API is gonna be like "who r u" π
πΈ DESCRIPTION πΈ
so to save your poor little keyboard from typing :user and :repo over and over (we care about your wrists fr fr), we provied two ways to call any method that starts with :user/:repo. pick your fighter:
- SET user/repos before call methods below β set it once, live your life.
$gh->set_default_user_repo('fayland', 'perl-net-github'); # take effects for all $gh->
$pull_request->set_default_user_repo('fayland', 'perl-net-github'); # only take effect to $gh->pull_request
my @pulls = $pull_request->pulls();
look at that β the first one is giving global main character energy for every single $gh->, the second one is lowkey just for $gh->pull_request and nobody else πββοΈ
- If it is just for once, we can pass
:user,:repobefore any arguments β one-off, no commitment, we love a situationship.
my @pulls = $pull_request->pulls($user, $repo);
π METHODS π
π Pull Requets π
<http://developer.github.com/v3/pulls/>
pulls
grab all the pulls, or filter by state, or iterate one at a time like the icon you are:
my @pulls = $pull_request->pulls();
my @pulls = $pull_request->pulls( { state => 'open' } );
while (my $pr = $pull_request->next_pull( { state => 'open' } )) { ...; }
pull
get exactly one pull, by number:
my $pull = $pull_request->pull($pull_number);
create_pull / update_pull
making new ones, changing old ones β glow up season:
my $pull = $pull_request->create_pull( {
"title" => "Amazing new feature",
"body" => "Please pull this in!",
"head" => "octocat:new-feature",
"base" => "master"
} );
my $pull = $pull_request->update_pull( $pull_number, $new_pull_data );
commits / files
the receipts β¨ and the actual diff:
my @commits = $pull_request->commits($pull_number);
my @files = $pull_request->files($pull_number);
while (my $commit = $pull_request->next_commit($pull_number)) { ...; }
while (my $file = $pull_request->next_file($pull_number)) { ...; }
is_merged / merge
the vibe check and the commitment ceremony:
my $is_merged = $pull_request->is_merged($pull_number);
my $result = $pull_request->merge($pull_number);
π Pull Request Comments API π
<http://developer.github.com/v3/pulls/comments/>
comments / comment / create_comment / update_comment / delete_comment
list 'em, read one, post one, fix one, yeet one:
my @comments = $pull_request->comments($pull_number);
while (my $comment = $pull_request->next_comment($pull_number)) { ...; }
my $comment = $pull_request->comment($comment_id);
my $comment = $pull_request->create_comment($pull_number, {
"body" => "a new comment",
commit_id => '586fe4be94c32248043b344e99fa15c72b40d1c2',
path => 'test',
position => 1,
});
my $comment = $pull_request->update_comment($comment_id, {
"body" => "Nice change"
});
my $st = $pull_request->delete_comment($comment_id);
π¦ Pull Request Reviews API π¦
<http://developer.github.com/v3/pulls/reviews/>
reviews / review / create_review / update_review / delete_review
same energy, but reviews β the formal bestie opinion:
my @reviews = $pull_request->reviews($pull_number);
while (my $review = $pull_request->next_review($pull_number)) { ...; }
my $review = $pull_request->review($review_id);
my $review = $pull_request->create_review($pull_number, {
"body" => "a new review",
commit_id => '586fe4be94c32248043b344e99fa15c72b40d1c2',
event => 'APPROVE',
});
my $review = $pull_request->update_review($review_id, {
"body" => "Nice change"
});
my $st = $pull_request->delete_review($review_id);
π Pull Request Review API π
<https://developer.github.com/v3/pulls/review_requests/>
reviewers / add_reviewers / delete_reviewers
who's being summoned to look at your code π:
my @reviewers = $pull_request->reviewers($pull_number);
my $result = $pull_request->add_reviewers($pull_number, {
reviewers => [$user1, $user2],
team_reviewers => [$team1],
);
my $result = $pull_request->delete_reviewers($pull_number, {
reviewers => [$user1, $user2],
team_reviewers => [$team1],
);
π AUTHOR & COPYRIGHT & LICENSE π
Refer Net::GitHub. that's the whole thing, go look at the parent module, it has all the receipts.
okay that's the page!! this doc shipped as part of perl v5.36.0, dated 2022-10-08, under the User Contributed Perl Documentation banner. slay, go merge something π β¨
π¦ where this page comes from
- ubuntu noble: libnet-github-perl 1.05-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libnet-github-perl 1.05-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libnet-github-perl 1.05-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms