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:
Michael Gerdemann
2020-01-17 08:38:49 +01:00
parent d4bb8a6108
commit 5aaff48c99
4 changed files with 201 additions and 0 deletions

View File

@ -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)