feat : add Gitea test connection endpoint

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Matthieu
2026-03-13 13:57:50 +01:00
parent be2e7c60a3
commit 5577884c13
2 changed files with 59 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace App\State;
use ApiPlatform\Metadata\Operation;
use ApiPlatform\State\ProcessorInterface;
use ApiPlatform\State\ProviderInterface;
use App\ApiResource\GiteaTestConnection;
use App\Service\GiteaApiService;
final readonly class GiteaTestConnectionProvider implements ProviderInterface, ProcessorInterface
{
public function __construct(
private GiteaApiService $giteaApiService,
) {}
public function provide(Operation $operation, array $uriVariables = [], array $context = []): GiteaTestConnection
{
return new GiteaTestConnection();
}
public function process(mixed $data, Operation $operation, array $uriVariables = [], array $context = []): GiteaTestConnection
{
$result = new GiteaTestConnection();
$result->success = $this->giteaApiService->testConnection();
return $result;
}
}