avency/gitea

Gitea API

1.0 2020-01-21 06:48 UTC

This package is auto-updated.

Last update: 2024-09-10 12:59:54 UTC


README

本包为 Gitea API 版本 1 提供了一个 API 客户端。

入门指南

先决条件

本包有以下要求

  • PHP 7.2

安装

通过 Composer 安装最新版本

composer require avency/gitea

基本用法

// This file is generated by Composer
require_once __DIR__ . '/vendor/autoload.php';

// - - - - -

// Create client and authenticate
$giteaClient = new Avency\Gitea\Client(
    'https://gitea.yourdomain.com',
    [
        'type' => Avency\Gitea\Client::AUTH_TOKEN,
        'auth' => 'your-auth-token'
    ]
);

or

$giteaClient = new Avency\Gitea\Client(
    'https://gitea.yourdomain.com',
    [
        'type' => Avency\Gitea\Client::AUTH_BASIC_AUTH,
        'auth' => [
            'username' => 'your-username',
            'password' => 'your-password',
        ]
    ]
);

// - - - - -

// Get a single repository
$repository = $giteaClient->repositories()->get('owner', 'repoName');

// Get version
$repository = $giteaClient->miscellaneous()->version();

以其他用户的身份运行 API 调用

// e.g. check subscription status as a user
$status = $giteaClient->sudo('username')->repositories()->checkSubscription();

版本控制

我们使用 SemVer 进行版本控制。有关可用版本,请参阅本仓库的 标签

作者

请参阅参与此项目的 贡献者列表

许可证

本项目采用 MIT 许可证 - 详细信息请参阅 LICENSE.md 文件

端点状态

管理员

杂项

组织

问题

仓库

用户

用户