NAME

WWW::Gitea::API::PullRequests - Gitea pull requests API

VERSION

version 0.001

SYNOPSIS

my $pulls = $gitea->pulls->list('getty', 'p5-www-gitea', state => 'open');

my $pr = $gitea->pulls->create('getty', 'p5-www-gitea',
    head => 'feature', base => 'main', title => 'Add feature',
);

$gitea->pulls->merge('getty', 'p5-www-gitea', $pr->number, Do => 'squash');
my $merged = $gitea->pulls->is_merged('getty', 'p5-www-gitea', $pr->number);

DESCRIPTION

Controller for the Gitea pull requests API. Reached via $gitea->pulls. Pull requests are addressed by their per-repository index (they share the issue number space).

client

The parent WWW::Gitea client providing HTTP transport.

openapi_operations

Pre-computed operation table (operationId{method, path}).

list

my $pulls = $gitea->pulls->list('getty', 'p5-www-gitea',
    state => 'open', sort => 'recentupdate');

Lists pull requests. Accepts the Gitea query parameters (stateopen/closed/all, sort, milestone, labels, poster, page, limit). Returns an ArrayRef of WWW::Gitea::PullRequest.

create

my $pr = $gitea->pulls->create('getty', 'p5-www-gitea',
    head  => 'feature-branch',     # or 'user:branch' for cross-fork
    base  => 'main',
    title => 'Add the feature',
    body  => '...',
);

Creates a pull request. head, base and title are required; other arguments are passed through as the JSON body. Returns a WWW::Gitea::PullRequest.

get

my $pr = $gitea->pulls->get('getty', 'p5-www-gitea', 12);

Fetches a pull request by its repository index. Returns a WWW::Gitea::PullRequest.

edit

$gitea->pulls->edit('getty', 'p5-www-gitea', 12, state => 'closed');

Edits a pull request. Arguments are passed through as the JSON body. Returns the updated WWW::Gitea::PullRequest.

merge

$gitea->pulls->merge('getty', 'p5-www-gitea', 12);                  # plain merge
$gitea->pulls->merge('getty', 'p5-www-gitea', 12, Do => 'squash');

Merges a pull request. The merge style is given by Do (merge/rebase/rebase-merge/squash/manually-merged), defaulting to merge. Other arguments (MergeTitleField, MergeMessageField, delete_branch_after_merge, ...) are passed through. Returns a true value on success.

is_merged

if ($gitea->pulls->is_merged('getty', 'p5-www-gitea', 12)) { ... }

Checks whether a pull request has been merged. Gitea answers this status-only endpoint with 204 (merged) or 404 (not merged), so this returns a plain boolean rather than a body. Returns 1 if merged, 0 otherwise.

SEE ALSO

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://codeberg.org/getty/p5-www-gitea/issues.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.