NAME

WWW::Gitea - Perl client for the Gitea REST API

VERSION

version 0.001

SYNOPSIS

use WWW::Gitea;

my $gitea = WWW::Gitea->new(
    url   => 'https://gitea.example.com',     # instance root, no /api/v1
    token => $ENV{GITEA_TOKEN},               # personal access token
);

# Who am I, and which Gitea version is this?
my $me      = $gitea->current_user;           # WWW::Gitea::User
my $version = $gitea->version;                 # e.g. "1.22.0"

# Repositories
my $repo = $gitea->repos->get('getty', 'p5-www-gitea');
print $repo->full_name, " ", $repo->stars_count, "\n";

my $new = $gitea->repos->create(
    name        => 'my-new-repo',
    description => 'created via WWW::Gitea',
    private     => 1,
    auto_init   => 1,
);

# Issues
my $issue = $gitea->issues->create('getty', 'p5-www-gitea',
    title => 'Something is broken',
    body  => 'Steps to reproduce ...',
    labels => [1, 2],
);
$issue->add_comment('on it!');
$issue->close;

# Pull requests
my $pr = $gitea->pulls->create('getty', 'p5-www-gitea',
    head  => 'feature-branch',
    base  => 'main',
    title => 'Add the thing',
);
$gitea->pulls->merge('getty', 'p5-www-gitea', $pr->number, Do => 'squash');

# Releases
$gitea->releases->create('getty', 'p5-www-gitea',
    tag_name => 'v1.0.0',
    name     => 'First release',
    body     => 'Changelog ...',
);

DESCRIPTION

WWW::Gitea is a lightweight Moo client for the Gitea REST API (api/v1). It covers the resources you reach for day to day — repositories, issues, pull requests, labels, milestones, releases, organizations and users — and exposes them through resource controllers hanging off the main client object.

Operation dispatch uses pre-computed operation tables (see WWW::Gitea::Role::OpenAPI), so there is no OpenAPI spec parsing at runtime. Each call returns a small entity object wrapping the decoded JSON, with the raw data always available on $entity->data.

Gitea is self-hosted, so unlike a single-vendor SaaS client there is no built-in base URL — you always pass "url" (and usually a "token").

url

The Gitea instance root URL, e.g. https://gitea.example.com (without the /api/v1 suffix — that is added for you). Defaults to the GITEA_URL environment variable. A trailing slash or an accidental /api/v1 suffix is tolerated.

token

Personal access token. Sent as Authorization: token .... Defaults to the GITEA_TOKEN environment variable. When set, it takes precedence over "username" / "password".

username

Username for HTTP Basic auth (used only when no "token" is set). Defaults to the GITEA_USERNAME environment variable.

password

Password (or token) for HTTP Basic auth. Defaults to the GITEA_PASSWORD environment variable.

api_url

The fully-qualified api/v1 base URL, derived from "url". All request paths are appended to this.

misc

A WWW::Gitea::API::Misc controller for instance-level endpoints (version, the authenticated user).

users

A WWW::Gitea::API::Users controller for looking up and searching users.

repos

A WWW::Gitea::API::Repos controller for repositories.

issues

A WWW::Gitea::API::Issues controller for issues and issue comments.

pulls

A WWW::Gitea::API::PullRequests controller for pull requests.

labels

A WWW::Gitea::API::Labels controller for repository labels.

milestones

A WWW::Gitea::API::Milestones controller for repository milestones.

releases

A WWW::Gitea::API::Releases controller for repository releases.

orgs

A WWW::Gitea::API::Orgs controller for organizations.

version

my $v = $gitea->version;

Returns the Gitea server version string. Shortcut for $gitea->misc->version.

current_user

my $me = $gitea->current_user;

Returns the authenticated WWW::Gitea::User. Shortcut for $gitea->misc->current_user.

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.