avency / gitea
Gitea API
1.0
2020-01-21 06:48 UTC
Requires
- php: ^7.2
- guzzlehttp/guzzle: ~6.0
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 进行版本控制。有关可用版本,请参阅本仓库的 标签。
作者
- Michael Gerdemann - avency GmbH
请参阅参与此项目的 贡献者列表。
许可证
本项目采用 MIT 许可证 - 详细信息请参阅 LICENSE.md 文件