mirror of
https://github.com/avency/Gitea.git
synced 2025-10-29 18:52:33 +01:00
Adds the client with first basic authentication and the first endpoint `repositories` with first method.
80 lines
1.7 KiB
Markdown
80 lines
1.7 KiB
Markdown
# Gitea API Client
|
|
|
|
This package provides an API client for [Gitea](https://gitea.io) API Version 1.
|
|
|
|
*Caution! This package is still under development*
|
|
|
|
## Getting Started
|
|
|
|
### Prerequisites
|
|
|
|
This package has the following requirements:
|
|
|
|
* PHP 7.2
|
|
|
|
### Installing
|
|
|
|
Install latest version via composer:
|
|
|
|
```
|
|
composer require avency/gitea
|
|
```
|
|
|
|
### Basic usage
|
|
|
|
```
|
|
// 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::AUTH_TOKEN,
|
|
'auth' => 'your-auth-token'
|
|
]
|
|
);
|
|
|
|
or
|
|
|
|
$giteaClient = new Avency\Gitea\Client(
|
|
'https://gitea.yourdomain.com',
|
|
[
|
|
'type' => Avency\Gitea::AUTH_BASIC_AUTH,
|
|
'auth' => [
|
|
'username' => 'your-username',
|
|
'password' => 'your-password',
|
|
]
|
|
]
|
|
);
|
|
|
|
// - - - - -
|
|
|
|
// Get a single repository
|
|
$repository = $giteaClient->api('repositories')->get('owner', 'repoName');
|
|
```
|
|
|
|
## Contributing
|
|
|
|
Please read [CONTRIBUTING.md](https://github.com/avency/gitea//blob/master/CONTRIBUTING.md)
|
|
for details on our code of conduct, and the process for submitting pull requests to us.
|
|
|
|
## Versioning
|
|
|
|
We use [SemVer](http://semver.org/) for versioning. For the versions available,
|
|
see the [tags on this repository](https://github.com/avency/gitea/contributors).
|
|
|
|
## Authors
|
|
|
|
* Michael Gerdemann - [avency GmbH](https://www.avency.de)
|
|
|
|
See also the list of [contributors](https://github.com/avency/gitea/graphs/contributors) who
|
|
participated in this project.
|
|
|
|
## License
|
|
|
|
This project is licensed under the MIT License - see the
|
|
[LICENSE.md](https://github.com/avency/gitea//blob/master/LICENSE.md) file for details
|