feat : add task Gitea branches endpoints (list + create)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
46
src/ApiResource/GiteaBranch.php
Normal file
46
src/ApiResource/GiteaBranch.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\ApiResource;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use ApiPlatform\Metadata\GetCollection;
|
||||
use ApiPlatform\Metadata\Post;
|
||||
use App\State\GiteaBranchProcessor;
|
||||
use App\State\GiteaBranchProvider;
|
||||
use Symfony\Component\Serializer\Attribute\Groups;
|
||||
|
||||
#[ApiResource(
|
||||
operations: [
|
||||
new GetCollection(
|
||||
uriTemplate: '/tasks/{taskId}/gitea/branches',
|
||||
normalizationContext: ['groups' => ['gitea_branch:read']],
|
||||
provider: GiteaBranchProvider::class,
|
||||
),
|
||||
new Post(
|
||||
uriTemplate: '/tasks/{taskId}/gitea/branches',
|
||||
denormalizationContext: ['groups' => ['gitea_branch:write']],
|
||||
normalizationContext: ['groups' => ['gitea_branch:read']],
|
||||
provider: GiteaBranchProvider::class,
|
||||
processor: GiteaBranchProcessor::class,
|
||||
),
|
||||
],
|
||||
)]
|
||||
final class GiteaBranch
|
||||
{
|
||||
#[Groups(['gitea_branch:read'])]
|
||||
public string $name = '';
|
||||
|
||||
#[Groups(['gitea_branch:write'])]
|
||||
public string $type = 'feature';
|
||||
|
||||
#[Groups(['gitea_branch:write'])]
|
||||
public string $baseBranch = 'main';
|
||||
|
||||
/**
|
||||
* @var array<array{sha: string, message: string, author: string, date: string}>
|
||||
*/
|
||||
#[Groups(['gitea_branch:read'])]
|
||||
public array $commits = [];
|
||||
}
|
||||
Reference in New Issue
Block a user