mirror of
https://github.com/avency/Gitea.git
synced 2025-10-29 18:52:33 +01:00
feat: Add basic client and first basic endpoint
Adds the client with first basic authentication and the first endpoint `repositories` with first method.
This commit is contained in:
36
README.md
36
README.md
@ -20,6 +20,42 @@ 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)
|
||||
|
||||
Reference in New Issue
Block a user